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

Home » Public Forums » archive » scopes
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: scopes [message #85952 is a reply to message #85951] Fri, 20 September 2013 14:44 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
spluque@gmail.com writes:

>
> Hi,
>
> Using the following script to convert calendar date to day of year (test.pro):
>
> FUNCTION calendar2doy, year, month, day
> jd=julday(month, day, year)
> caldat, jd, Null, Null, year
> doy=string(jd - julday(12, 31, year - 1), format='(i03)')
> RETURN, doy
> END
>
> PRO TEST
> year=2011
> mon=10
> day=15
> DOY=calendar2doy(year, mon, day)
> RETURN
> END
>
>
> I expected the variable year in the TEST procedure to remain as defined (the long integer 2011), but this is what I see after calling the call to calendar2doy with a breakpoint at the RETURN line:
>
> IDL> .run "test.pro"
> % Compiled module: CALENDAR2DOY.
> % Compiled module: TEST.
> IDL> breakpoint,'test.pro',14
> IDL> test
> % Compiled module: JULDAY.
> % Compiled module: CALDAT.
> % Breakpoint at: TEST 14 test.pro
> IDL> print, year
> 2012
>
> What am I missing?

Ah, yes, I've seen this before. It's weird. :-)

The problem comes about in the way you are calling CalDat:

caldat, jd, Null, Null, year

You are using the same variable for the day and month. This causes
CalDat great confusion! If you use different variables, you will get
what you expect.

caldat, jd, Null1, Null2, year

It must be something about variables getting updated in a particular
sequence or something. I don't understand exactly what is happening, but
I remember struggling for hours with exactly this thing one time. ;-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to speed up KRIG2D by 30x
Next Topic: cgContour and NaN values

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

Current Time: Fri Oct 10 10:37:34 PDT 2025

Total time taken to generate the page: 2.07861 seconds