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

Home » Public Forums » archive » Re: 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
Re: Bug in IDL's TIMEGEN function [message #55583] Fri, 24 August 2007 15:19 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Hi Dave,

Good catch! This is indeed a bug. I've just fixed the code for the
next IDL release.

If you want, you can patch your copy of timegen. Go to your $IDL_DIR/
lib/timegen.pro.
Around line 400, replace the following bad lines:
monthArray = (monthArray MOD 12) + 1
IF (step_size LT 0) THEN monthArray = (monthArray + 12) MOD 12
With the following good lines:
if (step_size ge 0) then begin
monthArray = (monthArray mod 12) + 1
endif else begin
monthArray = (((monthArray mod 12) + 12) mod 12) + 1
endelse

Using this version, I get the following results:
IDL> MyTimes = TIMEGEN( units="Months", step_size=-1, $
IDL> start=julday(1,15,2007), final=julday(10,15,2006))
IDL> print, MyTimes - MyTimes(0)
0.00000000 -31.000000 -61.000000 -92.000000

Hope this didn't cause you too many problems.
Cheers,

Chris Torrence
ITT Visual Information Solutions
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Natural size of explicitly-sized widget
Next Topic: Weighted histogram

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

Current Time: Fri Oct 10 09:43:35 PDT 2025

Total time taken to generate the page: 0.40262 seconds