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

Home » Public Forums » archive » Time conversion for .nc file
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: Time conversion for .nc file [message #86560 is a reply to message #86559] Tue, 19 November 2013 07:11 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
alx writes:

>
> Le mardi 19 novembre 2013 15:11:03 UTC+1, David Fanning a écrit :
>> Madhavan Bomidi writes:
>>
>>
>>
>>> How can we obtain the exact month, day, year, hour, min, sec from the ncdfTime created above? I tried to use the CALDAT but it is giving some crazy numbers for each of them. I am asking this because in order to plot the variables as a function of time, the jultime is more difficult to say about which day it corresponds to. Do you have any better suggestion?
>>
>>
>>
>> No other suggestions. CalDat works great. You just have to do the
>>
>> reverse of what you have done previously. Convert seconds to Julian
>>
>> days, add Julday(1,1,1970,0,0,0) to that result, and put that through
>>
>> the CalDat function. I've never known it to go wrong. :-)
>>
>>
>>
>> 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.")
>
>
> For novice IDL users as well as experienced ones, may I add that:
>
> 1) "calendar format" is quite useful because it works in same way in both directions and can be used with arrays, i.e.
>
> IDL> reads, DATE, JD, format=FMT
> IDL> DATES = string(JD, format=FMT)
>
> where JD is array of doubles, DATES is array of date strings, and FMT is some calendar format.
>
> 2) axis plotting where time is expressed in Julian days is pretty easy to do by using XTICKUNITS keyword (this is true both in DG and NG !):
>
> IDL> plot, jd, data, XTICKUNITS='year' ;automatic labeling in years
> IDL> plot, jd, data, XTICKUNITS=['minute','hour'] ;double labeling in hours and minutes.
> etc...
> The axis can be further customized by using MINOR and XTICKINTERVAL keywords.

Sounds like it might be worth learning what the "calendar" format is all
about. ;-)

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
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL refuse to acknowledge anything but integers...
Next Topic: Derivatives

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

Current Time: Fri Oct 10 19:18:58 PDT 2025

Total time taken to generate the page: 1.52228 seconds