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 #86486 is a reply to message #86485] Wed, 13 November 2013 07:44 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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: Fri Nov 28 23:16:24 PST 2025

Total time taken to generate the page: 0.00225 seconds