This HTML automatically generated with rman for NEMO
Table of Contents

Name

tabdms - Convert from/to sexagesimal HMS/DMS tables

Synopsis

tabdms [parameter=value]

Description

tabdms replaces selected column(s) from a table to or from their sexagesimal HMS/DMS equivalent.

Currently the output HMS/DMS format is fixed to %06.3f

HMS is normally on a 0..24 h system, but conversion is done to/from a 0..360 system (as in fits headers). If this not required, pick the DMS version instead.

The .DMS and .HMS formation option referred to is where the digits before are copied "as is". They could represent days in a DDD:HH:MM:SS.S type notation.

Parameters

The following parameters are recognized in order; they may be given in any order if the keyword is also given. Use --help to confirm this man page is up to date.
in=
input file name, an ascii table. No Default.
out=
output file name, an ascii table. No Default.
todms=
list of columns (1..) to convert to dms. Negative columns should be used if the format is to be interpreted as fractional ".DMS" instead of the default "D:M:S". The D in DMS is normally assumed to be modulo 360. Default: none.
tohms=
list of columns (1..) to convert to hms. Negative columns should be used if the format is to be interpreted as fractional ".HMS" instead of the default "H:M:S". The H in HMS is normally assumed to be modulo 24. Default: none.
fromdms=
A list of columns (1..) to convert from dms to degrees. If center= is given a HMS/DMS or DMS/DMS needs to be picked. [none]
fromhms=
A list of columns (1..) to convert from hms to degrees, which includes a factor of 15. [none]
separator=
separator between output D M and S.S. [Default: :]
format=
Output format statement used for columns converted by fromhms= and fromdms= [Default: %g]
scale=
Scaling factor applied to degrees when converted by fromhms= and fromdms=. If you want seconds, use 3600 here. For radians, use pi/180. Careful in using this, each of fromdms= and fromhms= columns will get this factor applies. If center= is given, this is the scale factor applied,e.g. use 3600 if arcsec are required. [Default: 1]
center=
If given, the angular X,Y differences of two selected colums with this acenter is computed. If sexadecimal notation is used, it is assumed to be an RA,DEC, else the center is assumed to be in degrees.

Examples

To convert a D.MS to D:M:S
   echo 12.34 | tabdms - - todms=1
   12:20:24.000
      
and to convert a D:M:S string to D.MS:
    echo 12:34:56.789 | tabdms - - fromdms=1 format=%.10f
    12.5824413889
    

The following example prints out the 4 possible ways to convert the number "12.51" to DMS or HMS:

% echo 90.25 90.25 90.25 90.25 90.25 | tabdms - - todms=1,-2 tohms=3,-4
90:15:00.000 90:90:00:00.000 06:00:60.000 90:06:00:00.000 90.25 
Column 1 in D.MS, 2 as .DMS, 3 as H.MS, 4 as .HMS and 5 is the original column copied.
echo 12:00:00 12:00:00 | tabdms - - fromhms=1 fromdms=2
180 12

Caveats

There are still a number of input format errors not caught, plus due to rounding one may see
   echo  90.1 | tabdms - -  todms=1
   90:05:60.000 

The sexagesimal notation has many forms. Apart from the H:M:S we don’t support others yet. Here are some examples :

FITS DATE_OBS   2021-12-29T15:51:19.004800615       date -u +%Y-%m-%dT%H:%M:%S.%N
NED             00h07m15.84s, +27d42m29.1s       
CASA            12:22:55.212, +15.49.15.500
SIMBAD gives the following guidelines to allowed coordinate input:
 20 54 05.689 +37 01 17.38
 10:12:45.3-45:17:50
 15h17m-11d10m
 15h17+89d15
 275d11m15.6954s+17d59m59.876s
 12.34567h-17.87654d
 350.123456d-17.33333d <=> 350.123456 -17.33333

Limitations

The code is compiled with a maximum number of columns, MAXCOL, typically 256.

See Also

tabmath(1NEMO) , nemoinp(1NEMO) , nemoinpx(3NEMO) , atox(3NEMO)

Files

src/kernel/tab/tabdms.c source code

Author

Peter

Teuben

Update History


24-Jan-00    V0.4 doc written    PJT
25-sep-13    V0.8 added fromdms=    PJT
17-jul-20    clarifications    PJT
30-dec-21    V0.9 use new atox() and fix numerous conversion errors    PJT


Table of Contents