sexagesimal
Rob Seaman
seaman at noao.edu
Sat Sep 16 17:48:33 PDT 2006
> We define a Sexg to be a representation of an angle.
Or a time, of course. Time-of-day can be interpreted as an angle,
too, but that isn't the typical case.
> The number of "hours or degrees" is the integer hds. It includes a
> conversion factor from hds to degrees. There is a converter
> degreesPerHds which is 15 or 1 for hours or degrees. A Sexg is
> equivalent to a data structure:
> struct Sexg {
> int hds;
> int minutes;
> float seconds;
> float degreesPerHds;
> }
I suppose, but surely this won't be part of any IVOA recommendation?
Like I said, to IRAF a sexagesimal number is just another floating
point representation:
cl> = -47:30:01.234 # note no quotes - this is not a string!
-47.500342777778
cl> printf ("%13.3h\n", -47.500342777778)
-47:30:01.234
Why complicate things?
> The sky position object is then
> struct skyPosition {
> Sexg longitude; // will be shifted to be >=0 and <360
> Sexg latitude; // illegal if <-90 or >90
> }
You're starting to reinvent STC...
> That is why I propose to very liberal by allowing anything
> separated by "non-digit" characters. Writers have freedom and
> reading is easy.
Readers should be forgiving. Writers should be strict.
> We can allow the minutes to be float, but ask IRAF to add seconds:
> hh:mm.mmm:00.
Sure, whatever you want:
cl> printf ("%10.3m:00\n", -47.500342777778)
-47:30.021:00
> There could be a translation in the XML to add the :00.
XSLT can do the formatting, or Perl or whatever, but it still seems
to me that we're overthinking the problem. The fact that there are
any number of sexagesimal formats in use is, I suppose, a reflection
of how long they have been in use. Sexagesimal notation predates
Arabic numerals, the place value system and the number zero. In any
event, the fact is that astronomers and their journals and legacy
software support a wide variety of such formats. What that suggests
is the need for toolkits, libraries, and translators to support the
various options.
Just for one more IRAF example - printf also has options for
converting from degrees to hours, etc., by dividing out the 15
implicitly:
cl> printf ("%H\n", -47.500342777778)
-3:10:00.1
cl> printf ("%M\n", -47.500342777778)
-3:10.0
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ivoa.net/pipermail/dm/attachments/20060916/3b26db86/attachment-0001.html>
More information about the dm
mailing list