![]() |
SuperNOVAS v1.3
The NOVAS C library, made better
|
Functions | |
double | novas_dms_degrees (const char *restrict dms) |
double | novas_epoch (const char *restrict system) |
double | novas_hms_hours (const char *restrict hms) |
double | novas_parse_degrees (const char *restrict str, char **restrict tail) |
double | novas_parse_dms (const char *restrict dms, char **restrict tail) |
double | novas_parse_hms (const char *restrict hms, char **restrict tail) |
double | novas_parse_hours (const char *restrict str, char **restrict tail) |
double | novas_str_degrees (const char *restrict str) |
double | novas_str_hours (const char *restrict str) |
Various functions to parse string values for SuperNOVAS.
double novas_dms_degrees | ( | const char *restrict | dms | ) |
Returns the decimal degrees for a DMS string specification. The degree, (arc)minute, and (arc)second components may be separated by spaces, tabs, colons :
, or a combination thereof. Additionally, the degree and minutes may be separated by the letter d
, and the minutes and seconds may be separated by m
or a single quote ‘’‘. The seconds may be followed by 's’ or double quote "
. Finally, the last component may additionally be followed by a standalone upper-case letter 'N', 'E', 'S', or 'W' signifying a compass direction.
For example, all of the lines below are valid specifications:
-179:59:59.999 -179d 59m 59.999s -179 59' 59.999 179:59:59.999S 179 59 59.999 W 179_59_59.999__S
At least the leading two components (degrees and arcminutes) are required. If the arcseconds are ommitted, they will be assumed zero, i.e. 179:59
is the same as 179:59:00.000
.
NOTES:
errno
: it should be zero (0) if all non-whitespace characters have been parsed from the input string, or else EINVAL
if the parsed value used only the leading part of the string. dms | String specifying degrees, minutes, and seconds, which correspond to an angle. Angles in any range are permitted, but the minutes and seconds must be >=0 and <60. |
References novas_parse_dms().
double novas_epoch | ( | const char *restrict | system | ) |
Returns the Julian day corresponding to an astronomical coordinate epoch.
system | Coordinate system, e.g. "ICRS", "B1950.0", "J2000.0", "FK4", "FK5", "1950", "2000", or "HIP". In general, any Besselian or Julian year epoch can be used by year (e.g. "B1933.193" or "J2022.033"), or else the fixed values listed. If 'B' or 'J' is ommitted in front of the epoch year, then Besselian epochs are assumed prior to 1984.0. |
References NOVAS_JD_B1950, NOVAS_JD_HIP, NOVAS_JD_J2000, NOVAS_SYSTEM_FK4, NOVAS_SYSTEM_FK5, NOVAS_SYSTEM_HIP, and NOVAS_SYSTEM_ICRS.
double novas_hms_hours | ( | const char *restrict | hms | ) |
Returns the decimal hours for a HMS string specification. The hour, minute, and second components may be separated by spaces, tabs, colons :
, or a combination thereof. Additionally, the hours and minutes may be separated by the letter h
, and the minutes and seconds may be separated by m
or a single quote ‘’‘. The seconds may be followed by 's’ or double quote "
.
For example, all of the lines below specify the same time:
23:59:59.999 23h 59m 59.999s 23h59'59.999 23 59 59.999 23 59 23h
At least the leading two components (hours and minutes) are required. If the seconds are ommitted, they will be assumed zero, i.e. 23:59
is the same as 23:59:00.000
.
NOTES:
errno
: it should be zero (0) if all non-whitespace characters have been parsed from the input string, or else EINVAL
if the parsed value used only the leading part of the string. hms | String specifying hours, minutes, and seconds, which correspond to a time between 0 and 24 h. Time in any range is permitted, but the minutes and seconds must be >=0 and <60. |
References novas_parse_hms().
double novas_parse_degrees | ( | const char *restrict | str, |
char **restrict | tail | ||
) |
Parses an angle in degrees from a string that contains either a decimal degrees or else a broken-down DMS representation.
The decimal representation may be followed by a unit designator: "d", "dg", "deg", "degree", or "degrees", which will be parsed case-insensitively also, if present.
Both DMS and decimal values may end with a compass direction: N
, E
, S
, or W
.
A few examples of angles that may be parsed:
-179:59:59.999 -179d 59m 59.999s 179 59 59.999 S 179 59 S -179.99999d -179.99999 179.99999W 179.99999 deg S
str | The input string that specified an angle either as decimal degrees or as a broken down DMS speficication. The decimal value may be followed by the letter d immediately. And both the decimal and DMS representation may be ended with a compass direction marker, N , E , S , or W . See more in novas_parse_dms() on acceptable DMS specifications. | |
[out] | tail | (optional) If not NULL it will be set to the next character in the string after the parsed angle. |
trailing E compass, handled below
Punctuation after first character
References novas_debug(), NOVAS_DEBUG_OFF, novas_get_debug_mode(), and novas_parse_dms().
double novas_parse_dms | ( | const char *restrict | dms, |
char **restrict | tail | ||
) |
Parses the decimal degrees for a DMS string specification. The degree, (arc)minute, and (arc)second components may be separated by spaces, tabs, colons :
, underscore _
, or a combination thereof. Additionally, the degree and minutes may be separated by the letter d
, and the minutes and seconds may be separated by m
or a single quote ‘’‘. The seconds may be followed by 's’ or a double quote "
. Finally, the last component may additionally be followed by a standalone upper-case letter 'N', 'E', 'S', or 'W' signifying a compass direction.
For example, all of the lines below are valid specifications:
-179:59:59.999 -179d 59m 59.999s -179 59' 59.999 179:59:59.999S 179:59:59.999 W 179_59_59.999__S 179 59 S
At least the leading two components (degrees and arcminutes) are required. If the arcseconds are ommitted, they will be assumed zero, i.e. 179:59
is the same as 179:59:00.000
.
dms | String specifying degrees, minutes, and seconds, which correspond to an angle. Angles in any range are permitted, but the minutes and seconds must be >=0 and <60. | |
[out] | tail | (optional) If not NULL it will be set to the next character in the string after the parsed time. |
double novas_parse_hms | ( | const char *restrict | hms, |
char **restrict | tail | ||
) |
Parses the decimal hours for a HMS string specification. The hour, minute, and second components may be separated by spaces, tabs, colons :
, underscore _
, or a combination thereof. Additionally, the hours and minutes may be separated by the letter h
, and the minutes and seconds may be separated by m
or a single quote ‘’‘. The seconds may be followed by 's’ or double quote "
.
For example, all of the lines below are valid specifications:
23:59:59.999 23h 59m 59.999 23h59'59.999 23 59 59.999 23 59
At least the leading two components (hours and minutes) are required. If the seconds are ommitted, they will be assumed zero, i.e. 23:59
is the same as 23:59:00.000
.
hms | String specifying hours, minutes, and seconds, which correspond to a time between 0 and 24 h. Time in any range is permitted, but the minutes and seconds must be >=0 and <60. | |
[out] | tail | (optional) If not NULL it will be set to the next character in the string after the parsed time. |
double novas_parse_hours | ( | const char *restrict | str, |
char **restrict | tail | ||
) |
Parses a time or time-like angle from a string that contains either a decimal hours or else a broken-down HMS representation.
The decimal representation may be followed by a unit designator: "h", "hr", "hrs", "hour", or "hours", which will be parsed case-insensitively also, if present.
A few examples of angles that may be parsed:
23:59:59.999 23h 59m 59.999s 23h59'59.999 23 59 59.999 23.999999h 23.999999 hours 23.999999
str | The input string that specified an angle either as decimal hours or as a broken down HMS speficication. The decimal value may be immediately followed by a letter 'h'. See more in novas_parse_hms() on acceptable HMS input specifications. | |
[out] | tail | (optional) If not NULL it will be set to the next character in the string after the parsed angle. |
References novas_debug(), NOVAS_DEBUG_OFF, novas_get_debug_mode(), and novas_parse_hms().
double novas_str_degrees | ( | const char *restrict | str | ) |
Returns an angle parsed from a string that contains either a decimal degrees or else a broken-down DMS representation. See novas_parse_degrees()
to see what string representations may be used.
To see if the string was fully parsed when returning a valid (non-NAN) value, you can check errno
: it should be zero (0) if all non-whitespace and punctuation characters have been parsed from the input string, or else EINVAL
if the parsed value used only the leading part of the string.
str | The input string that specified an angle either as decimal degrees or as a broken down DMS speficication. The decimal value may be immediately followed by a letter 'd'. See more in novas_parse_degrees() on acceptable input specifications. |
References novas_parse_degrees().
double novas_str_hours | ( | const char *restrict | str | ) |
Returns a time or time-like angleparsed from a string that contains either a decimal hours or else a broken-down HMS representation. See novas_parse_hours()
to see what string representations may be used.
To check if the string was fully parsed when returning a valid (non-NAN) value you can check errno
: it should be zero (0) if all non-whitespace and punctuation characters have been parsed from the input string, or else EINVAL
if the parsed value used only the leading part of the string.
str | The input string that specified an angle either as decimal hours or as a broken down HMS speficication. The decimal value may be immediately followed by a letter 'h'. See more in novas_parse_hours() on acceptable input specifications. |
References novas_parse_hours().