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 #86554 is a reply to message #86486] Tue, 19 November 2013 02:36 Go to previous messageGo to previous message
atmospheric physics is currently offline  atmospheric physics
Messages: 121
Registered: June 2010
Senior Member
Just a small syntax error ... (Comma is missing between hour and min)

jultime = JulDay(mon,day,year,hour, min,sec) - JulDay(1,1,1970,0,0,0)

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?

Thanks in advance



On Wednesday, November 13, 2013 4:44:01 PM UTC+1, David Fanning wrote:
> Madhavan Bomidi writes:
>
>
>
>> I have date & UTC time in tow columns as [YYYYMMDD HRMISE], where YYYY - Year, MM - Month, DD - day, HR - Hours, MI - Minutes, SE - Seconds. Now, I wanted to convert to the "time" variable according to NetCDF convention. I mean to say that I wanted to convert my date & UTC time values to "time" in seconds since 1970-01-01 00:00:00 (in UTC). Can anyone help me how I can use SYSTIME function available in IDL?
>
>
>
> I wouldn't use the SYSTIME function. I would use the JULDAY function. I
>
> would read the two columns of data as a single string array. Then, I
>
> would do something like this (using a scalar string as an example, but
>
> this will work for a string array, too):
>
>
>
> str = '20131113 083122'
>
> year = Fix(StrMid(str,0,4))
>
> mon = Fix(StrMid(str,4,2))
>
> day = Fix(StrMid(str,6,2))
>
> hour = Fix(StrMid(str,9,2))
>
> min = Fix(StrMid(str,11,2))
>
> sec = Fix(StrMid(str,13,2))
>
> jultime = JulDay(mon,day,year,hour min,sec) - JulDay(1,1,1970,0,0,0)
>
> ncdfTime = jultime * 24 * 60 * 60
>
> print, ncdfTime
>
>
>
> 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: Thu Oct 09 19:31:34 PDT 2025

Total time taken to generate the page: 0.00779 seconds