This site Web
Home Page | The Sun API | Gallery | InfoSearch | News | Links | Contact Us

Sunlit Design > The Sun API > Documentation > sdDUnpackx Function


Index


- Introduction
+ Using the Functions
+ User Guide
+ Function Reference
+ Constants

Contact Developer

Downloads

sdDUnpackx Function

Description

Returns the component parts of a degree value in an XML string format. The component parts are Sign, Degree, Arcminute, and Arcsecond

Syntax

sdDUnpackx(degree)
degree    A numeric degree value.

Return Values

sdDUnpackx returns an XML String value.  The string is of the following format:

"<DMSSign>sign</DMSSign> <Degree>ddd</Degree> <ArcMin>mmm</ArcMin> <ArcSec>sss.s</ArcSec>"

Errors

If the function detects an error in any of it's input parameters then it returns: "-99999999<Error>-99999999</Error>"

Remarks

The sign of the d:m:s value is treated separately because of the "minus zero" problem that is a 'trap for the unwary' with the d:m:s format.  The problem is this: on which value (d, m, or s) should the sign be attached?  When the d:m:s value is greater than or equal to 1 degree then attaching it to the d value is a good idea.  When the d:m:s value is small ie less than 1 degree or less than 1 arcminute attaching the sign to the d value would mean being able to distinguish between plus and minus 0! So the simplest solution is to separate it completely from the numerical values.

The value of individual components of the degree value may be extracted from the returned value using the sdxGetv function.

Example

Solar Declination is -0.56 degrees.  What are it's d:m:s components?:
    sdDUnpackx(-0.56) equals 

"<DMSSign>-1</DMSSign> <Degree>0</Degree><ArcMin>33</ArcMin> <ArcSec>36</ArcSec>"     (i.e. negative 33 arcminutes and 36 arcseconds.)

Individual components may be extracted as numeric values:
    a$ = sdDUnpackx(-0.56)
    sign = sdxGetv("DMSSign",a$)     ' -1    
    d = sdxGetv("Degree",a$)         ' 0
    m = sdxGetv("ArcMin",a$)         ' 33
    s = sdxGetv("ArcSec",a$)         ' 36 

Solar Hour Angle is 123.34 degrees.  What are it's d:m:s components?:
    sdDUnpackx(123.34) equals 

"<DMSSign>1</DMSSign> <Degree>123</Degree> <ArcMin>20</ArcMin> <ArcSec>24</ArcSec>"     (i.e. 123 degrees, 20 arcminutes and 24 arcseconds.)

Individual components may be extracted as numeric values:
    a$ = sdDUnpackx(123.34)
    sign = sdxGetv("DMSSign",a$)     ' 1   
    d = sdxGetv("Degree",a$)         ' 123
    m = sdxGetv("ArcMin",a$)         ' 20
    s = sdxGetv("ArcSec",a$)         ' 24