julday() and fractional days [message #56465] |
Tue, 30 October 2007 17:02  |
MarioIncandenza
Messages: 231 Registered: February 2005
|
Senior Member |
|
|
OK, if you search c.l.i-p for this you'll find a post from Craig
Markwardt wherein he laments that JULDAY "doesn't handle fractional
days". Someone replies to say yes it does, but I think that person
misunderstood.
IDL> print,julday(12,31,2005,0,0,0)
2453735.5
IDL> print,julday(12,31.2,2005,0,0,0)
2453735.5
I'm really unhappy with IDL right now.
|
|
|
Re: julday() and fractional days [message #56626 is a reply to message #56465] |
Thu, 01 November 2007 09:04  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Conor writes:
> I suppose for the very flexible solution you would hope for julday to
> start with something like:
>
> function julday,mon,day,year,hr,min,sec
>
> min += (sec - floor(sec))/60.0
> hr += (min - floor(min))/60.0
> day += (hr - floor(hr))/24.0
> year += (mon - floor(mon))/12.0
> day += (year - floor(year))*365
>
>
> then you can have the best of both worlds.
Geez, you could write a wrapper that even put the day
and the month in the right place! :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: julday() and fractional days [message #56628 is a reply to message #56465] |
Thu, 01 November 2007 08:25  |
Conor
Messages: 138 Registered: February 2007
|
Senior Member |
|
|
On Nov 1, 10:39 am, Craig Markwardt
<craigm...@REMOVEcow.physics.wisc.edu> wrote:
> Bob Crawford <Snowma...@gmail.com> writes:
>> Perhaps I'm missing something but why would one expect a JULDAY
>> function that is passing hour, minute and second data to also accept
>> fractional days?
>
>> I can understand that if you did: print,julday(12,31.2,2005) one might
>> expect the fractional days to be handled, but not when the smaller
>> time units are explicitedly present.
>
>> What would the correct output of, say,
>> print,julday(12,31.2,2005,6,0,0) be?
>
> I don't know, but because of IDL JULDAY()'s insane behavior, I can
> tell you that it would be different than,
>
> print,julday(12,31.2,2005) + 0.25
>
> Craig
>
> --
> ------------------------------------------------------------ --------------
> Craig B. Markwardt, Ph.D. EMAIL: craigm...@REMOVEcow.physics.wisc.edu
> Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
> ------------------------------------------------------------ --------------
I suppose for the very flexible solution you would hope for julday to
start with something like:
function julday,mon,day,year,hr,min,sec
min += (sec - floor(sec))/60.0
hr += (min - floor(min))/60.0
day += (hr - floor(hr))/24.0
year += (mon - floor(mon))/12.0
day += (year - floor(year))*365
then you can have the best of both worlds.
|
|
|