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

Home » Public Forums » archive » Bug in IDL's TIMEGEN function
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Bug in IDL's TIMEGEN function [message #55585] Fri, 24 August 2007 13:11
Dave Wuertz is currently offline  Dave Wuertz
Messages: 6
Registered: August 2007
Junior Member
Folks,

I found a bug in IDL's TIMEGEN function. It really nailed me good, as I
was using the (erroneous) results from TIMEGEN to compute direct-access
locations within database files.

First off, I'm running IDL v6.4 on a 32-bit Linux-Intel box.

TIMEGEN returns an incorrect sequence of julian dates when STEP_SIZE=-1,
and UNITS="Months" when crossing year boundaries as demonstrated in
the simple example below. Note the results *should* be monotonically
decreasing.

IDL> MyTimes = TIMEGEN( units="Months", step_size=-1,
start=julday(1,15,2007), final=julday(10,15,2006))
IDL> print, MyTimes - MyTimes(0)
0.0000000 -396.00000 -61.000000 -92.000000

This way gives the same erroneous result:

MyTimes = TIMEGEN(4, units="Months", step_size=-1, start=julday(1,15,2007))

However, if you go forward in time (i.e., with a positive step_size),
the function crosses the year boundary correctly:

IDL> MyTimes = TIMEGEN(units="Months", step_size=1,
final=julday(1,15,2007), start=julday(10,15,2006))
IDL> print, MyTimes - MyTimes(0)
0.0000000 31.000000 61.000000 92.000000

In the last example I swapped the dates for "start" and "final" and made
the step_size positive.

The dangerous thing is that the function returns a valid date, usually
withing a year or two of the correct date, so some programs (like mine)
can hum along just fine all the while subtly screwing things up!

I have filled out an "Incident" report at ittvis.com, but have not
gotten a response yet.


-Dave Wuertz
[Message index]
 
Read Message
Previous Topic: Syntax Error Confusion
Next Topic: Re: How to avoid the FOR loop when using TM_TEST?

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

Current Time: Fri Oct 10 09:03:19 PDT 2025

Total time taken to generate the page: 1.52179 seconds