[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with JULDAY and CALDAT



landsman@stars.gsfc.nasa.gov (Wayne Landsman) writes:

>In article <370B879B.41C6@iasdev1.gsfc.nasa.gov>, "John J. Boia" <jboia@iasdev1.gsfc.nasa.gov> writes...

>>CALDAT does not correctly return the month/day/year
>>values for Julian day numbers that correspond to leap days
>>(Feb 29) in the leap years 1584 through 1604.

>John,

>    As a replacement for CALDAT, you might look at DAYCNV.PRO available at 
>http://idlastro.gsfc.nasa.gov/ftp/pro/astro/daycnv.pro. It passes your time
>test for all years except for the peculiar year 1582 itself.

>    (I don't know what the algorithm error in CALDAT is, since it uses a
>different algorithm from DAYCNV.PRO.   But CALDAT does have a most un-IDL like
>programming style, with a special subroutine that only does scalar calculations
>that is called in a loop.  Ugly.)

>Although not directly to your question, you might also look the time utilities
>in IDL written by Bill Thompson at 
>http://sohowww.nascom.nasa.gov/solarsoft/gen/idl/time/


Wayne, thanks for the plug, although I never expected to see that software used
for dates as long ago as 1582.  Since the main thrust is to handle leap seconds
for conversion between TAI and UTC, it really isn't valid (at the one-second
level) for dates earlier than 1972.

There is one important distinction between JULDAY/CALDAT and our respective
software packages.  It appears that the routines JULDAY and CALDAT try to
handle the conversion between Julian dates and Gregorian dates.  Dates starting
with 15 Oct 1582 and onward are assumed to be in the Gregorian Calendar, while
earlier dates are assumed to be in the Julian Calendar.  CALDAT applies the
reverse of this process, converting Julian day numbers greater than or equal to
2299170 into the Gregorian Calendar, and smaller numbers into the Julian
Calendar.  Thus, there's a jump from 4 Oct to 15 Oct 1582.  This isn't
explained in the documentation for either routine.

On the other hand, both DAYCNV and my own software work exclusively in the
Gregorian system.  The extension of the Gregorian Calendar to dates earlier
than 15 Oct 1582 is known as the Proleptic Gregorian Calendar.  In the
Proleptic Gregorian Calendar, the day before 15 Oct 1582 would be 14 Oct 1582,
even though somebody living at the time would have called it 4 Oct 1582.
DAYCNV and its counterpart JDCNV explicitly state that they work in the
Gregorian Calendar system.  Unfortunately, I don't believe I was so precise in
my documentation.  But then, we didn't have a whole lot of satellites up prior
to 1583 (that I know about).  ;^)

William Thompson