GNU Astronomy Utilities


Next: , Previous: , Up: Gnuastro library   [Contents][Index]


10.3.28 Unit conversion library (units.h)

Datasets can contain values in various formats or units. The functions in this section are defined to facilitate the easy conversion between them and are declared in units.h. If there are certain conversions that are useful for your work, please get in touch.

Function:
int
gal_units_extract_decimal (char *convert, const char *delimiter, double *args, size_t n)

Parse the input convert string with a certain delimiter (for example 01:23:45, where the delimiter is ":") as multiple numbers (for example 1,23,45) and write them as an array in the space that args is pointing to. The expected number of values in the string is specified by the n argument (3 in the example above).

If the function succeeds, it will return 1, otherwise it will return 0 and the values may not be fully written into args. If the number of values parsed in the string is different from n, this function will fail.

Function:
double
gal_units_ra_to_degree (char *convert)

Convert the input Right Ascension (RA) string (in the format of HH:MM:SS) to degrees (a single floating point number).

Function:
double
gal_units_dec_to_degree (char *convert)

Convert the input Declination (Dec) string (in the format of DD:MM:SS) to degrees (a single floating point number).

Function:
char *
gal_units_degree_to_ra (double decimal)

Convert the input Right Ascension (RA) degree (a single floating point number) to old/standard notation (in the format of HH:MM:SS).

Function:
char *
gal_units_degree_to_dec (double decimal)

Convert the input Declination (RA) degree (a single floating point number) to old/standard notation (in the format of HH:MM:SS).


Next: , Previous: , Up: Gnuastro library   [Contents][Index]