comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Problems with JULDAY and CALDAT
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Problems with JULDAY and CALDAT [message #14831] Wed, 07 April 1999 00:00 Go to previous message
John J. Boia is currently offline  John J. Boia
Messages: 5
Registered: November 1997
Junior Member
I've been developing a set of time conversion functions
(primarily using Modified Julian Date) and I have discovered
some problems with the IDL-provided routines CALDAT and JULDAY.

JULDAY seems to return Julian date values with an offset
of 0.5 from the accepted definition, when hours, minutes,
and seconds are passed in as arguments Integer julian
day numbers correspond to 12:00 noon UT.

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. (It also
mishandles preceding leap years, but those are before the
the Gregorian calendar took effect in 1582 and it becomes
increasingly difficult to make sense of those dates anyway.)
Instead of Feb 29, (Year), it returns Feb 31, (Year+1).

The problems are easy enough to work around, if you know
what the problems are. I have attached a small sample
procedure to demonstrate what I've found. Does anyone
know of other problems, or a better pair of routines,
or a plan to update these two?

John Boia


PRO TIMETEST

FORWARD_FUNCTION JULDAY

B = julday( 1,1,1970,0,0,0 ) - 0.5D
PRINT, B, FORMAT="(' Jan 1 1970 0h UT --> JD ',F15.3//)"

FOR I = 2299160L, 2307639L DO BEGIN
CALDAT, I, MON, DAY, YR
JD = JULDAY( MON, DAY, YR )
IF I NE JD THEN BEGIN
FOR J = I-2, I+2 DO BEGIN
CALDAT, J, MON, DAY, YR
PRINT, J, MON, DAY, YR, FORMAT="(' JD =',I8,6x,'Cal:',3I5)"
ENDFOR
PRINT
ENDIF
ENDFOR

END


--
John J. Boia | Email: jboia@iasdev1.gsfc.nasa.gov
Programmer/Analyst | Web: http://iasdev1.gsfc.nasa.gov/~jboia/
Computer Sciences Corp. | Phone: 301.794.2357
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: modified bessell functions
Next Topic: CDF question

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 19:53:33 PDT 2025

Total time taken to generate the page: 1.27941 seconds