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

Home » Public Forums » archive » Re: julday() and fractional days
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: julday() and fractional days [message #56448] Wed, 31 October 2007 09:16 Go to next message
Bob[3] is currently offline  Bob[3]
Messages: 60
Registered: December 2006
Member
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?
Re: julday() and fractional days [message #56450 is a reply to message #56448] Wed, 31 October 2007 08:49 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Ed Hyer <ejhyer@gmail.com> writes:
> 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.

I mostly use my own simple Julian day routine just to avoid all these
annoying surprises.

But in your case it would *almost* be easy enough to work around it
with something like,

IDL> print,julday(12,31,2005,0,0,0) + .2
2453735.7

or programmatically,

IDL> print,julday(month,floor(day),year,0,0,0) + (day-floor(day))

But the annoyance is in taking the time to discover these quirks, and
to remember them.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: julday() and fractional days [message #56461 is a reply to message #56450] Tue, 30 October 2007 19:20 Go to previous messageGo to next message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
On Oct 30, 8:02 pm, Ed Hyer <ejh...@gmail.com> wrote:
> 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.

Hi Ed,

Would this work for you?

IDL> print,eh_julday(12,31,2005,0,0,0)
2453735.5
IDL> print,eh_julday(12,31.2,2005,0,0,0)
2453735.7

***BEGIN
FUNCTION EH_JULDAY, mon, day, year, hour, min, sec

case N_PARAMS() of
6: j = JULDAY(mon, day, year, hour, min,sec)
3: j = JULDAY(mon, day, year)
ELSE: MESSAGE, '3 or 6 arguments required'
endcase

return, j + (day - FLOOR (day))
end
***END


Ben
Re: julday() and fractional days [message #56629 is a reply to message #56448] Thu, 01 November 2007 07:39 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Bob Crawford <Snowman42@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: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDLBridge - SetVar?
Next Topic: Re: read_tiff only looks in current working directory?

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

Current Time: Thu Oct 09 23:15:09 PDT 2025

Total time taken to generate the page: 0.16201 seconds