Re: caldat strange behavior CALDAT, JulianDay, NULL, NULL, GetYear [message #84010] |
Wed, 24 April 2013 13:56 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Edward Hyer writes:
> IDL> print,qqtjd,format='(C())'
> ;Mon Sep 24 21:00:00 2012
> IDL> qq=temporary(null) & qq=0; undefine NULL
> IDL> caldat,qqtjd,null,null,tyyyy;get year from TJD
> IDL> print,percentiles(tyyyy)
> ; 2014 2014 2014 2014 2014
> IDL> print,percentiles(null)
> ; 1 1 1 1 1
> IDL> caldat,qqtjd,mnull,dnull,tyyyy;get year from TJD
> IDL> print,percentiles(tyyyy)
> ; 2012 2012 2012 2012 2012
> IDL> print,percentiles(mnull)
> ; 9 9 9 9 9
> IDL> print,percentiles(dnull)
> ; 24 24 24 24 24
>
> Basically, if you give the argument NULL to both the Month and Day in CALDAT, things go very wrong. I am pretty confident this is new behavior.
I don't find it particularly hard to believe there are unintended
consequences in passing the same variable by reference into the program
as two different parameters. But, maybe I've spent longer scratching my
head and wondering what the HELL is a matter with my programs than you
have.
It does appear to be a change in behavior, at least I get different
results in IDL 7.
I would say, "Don't do it." If it doesn't confuse the program, it will
certainly confuse the person who has to read the program and sort it out
when you retire. :-)
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.")
|
|
|