JULDAY trivia [message #24332] |
Tue, 27 March 2001 11:45  |
K. Bowman
Messages: 330 Registered: May 2000
|
Senior Member |
|
|
I've been updating some of my own date and time routines and found
myself perusing the JULDAY man page. As an example, the man page gives
Julian day numbers bracketing the period when the changeover from the
Julian to Gregorian calendar was carried out:
PRINT, JULDAY(10,4,1582), JULDAY(10,5,1582), JULDAY(10,15,1582)
2299160 2299161 2299161
If I understand correctly, October 5-14 of 1582 never existed. JULDAY,
howver, gives the following:
IDL> FOR day = 4, 16 DO PRINT, day, JULDAY(10, day, 1582)
4 2299160
5 2299161
6 2299162
7 2299163
8 2299164
9 2299165
10 2299166
11 2299167
12 2299168
13 2299169
14 2299170
15 2299161
16 2299162
Not that I'm ever likely to ask for the Julian day of 5 October 1582,
but shouldn't JULDAY choke here, as it does if you use year = 0?
IDL> PRINT, JULDAY(1,1,0)
% JULDAY: There is no year zero.
% Error occurred at: JULDAY 87
/flow0/local/rsi/idl_5.3/lib/julday.pro
Especially since CALDAT will not invert JULDAY during this period:
IDL> CALDAT, JULDAY(10, 10, 1582), month, day, year
% Compiled module: CALDAT.
IDL> PRINT, month, day, year
10 20 1582
Ken
|
|
|
Re: Julday [message #31309 is a reply to message #24332] |
Sun, 23 June 2002 23:37  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Wolfgang Koppe wrote:
>
> Dear members,
>
> I would like to convert ASCII data-sets with the Julday function. I
> haven�t got a lot of experience with IDL. I can convert 1 date like
> this:
> PRINT, JULDAY (2000,11,6,12,35,12)
> -->1784427.0,
> but I want to convert a whole ASCII file with dates.
> Do I have to write a whole programm?
> Is it possible to use programm VIP (visual IDL programming)?
>
> Thanks a lot.
>
> Wolfgang
Dear Wolfgang
idl is an array orientated language.
Most functions are programmed to use arrays too.
The following example show vectors of data
all with the same length defining two dates.
If you take a look into the online help of julday
Result is of type double-precision if Hour, Minute, or Second is
specified, otherwise Result is of type long integer. If all arguments
are scalar, the function returns a scalar. If all arguments are arrays,
the function matches up the corresponding elements of the arrays,
returning an array with the same dimensions as the smallest array
year=[2000,2001]
month=[11,2]
day=[6,4]
hour=[12,10]
min=[35,10]
sec=[12,10]
print,julday(year,month,day,hour,min,sec)
1784427.0 1783718.9
regards
Reimar
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
============================================================ =======
|
|
|