Re: time conversion

From: shinn wong <shinnshinnwong_at_nyahnyahspammersnyahnyah>
Date: Mon Jul 18 2011 - 01:58:17 MDT

Dear all,
I still cannot figure out what´s wrong with my dataset that will lead to
missing value after using ut_calendar. The dataset I used is
mldinfo_varDT.nc downloaded from http://mixedlayer.ucsd.edu/. Could anyone
help me with that? Thanks in advance for any help and suggestion.
Shinn

2011/7/15 Dennis Shea <shea@ucar.edu>

> Prior to using cd_calendar you should use a print
>
> print(time)
>
> date = ut_calendar(time,0)
>
> It is possible that time does not contain some valis values
>
>
>
> On 07/15/2011 10:33 AM, shinn wong wrote:
>
>> Dear Dennis,
>> Thank you for your help. I am using version 5.5.1. But when I used date
>> = ut_calendar(time,0), missing value was returned. The dataset is too
>> large to be sent. I would be much appreciated for any help and suggestion.
>> Shinn
>>
>> 2011/7/11 Dennis Shea <shea@ucar.edu <mailto:shea@ucar.edu>>
>>
>>
>> I don't use Matlab but maybe ...
>>
>> time = (/730848.5, 730848.9/)
>> time@units = "days since Jan-1-0000 00:00:00"
>>
>> date = cd_calendar(time,0) ; year,month,day,hour,minute,sec
>> print(date)
>>
>> Due to the way 'cd_calendar' defines the initial day, you may
>> need to subtract 1 day
>>
>> So ...
>>
>> time = (/730848.5, 730848.9/) - 1 ; ?? adjust for different start
>> day
>> date = cd_calendar(time,0)
>> print(date)
>>
>> =====
>> The inverse is true also
>>
>> t = cd_inv_calendar(2001,5,19,0,0,**__0,units,0) - 1 ; Matlab
>> datenum
>> print(t)
>> ========
>> cd_calendar is in v6.0.0
>>
>> if you have an older version of NCL use
>>
>> date = ut_calendar(time,0)
>>
>> BUT in ut_calendar year 0 is treated like year 1 ...
>> so test to get the correct day
>>
>> # Year 0 is not treated as year 1, like it is with the ut_calendar
>> and ut_inv_calendar functions.
>>
>> =======
>>
>>
>> http://www.ncl.ucar.edu/__**Document/Functions/Built-in/__**
>> cd_calendar.shtml<http://www.ncl.ucar.edu/__Document/Functions/Built-in/__cd_calendar.shtml>
>> <http://www.ncl.ucar.edu/**Document/Functions/Built-in/**
>> cd_calendar.shtml<http://www.ncl.ucar.edu/Document/Functions/Built-in/cd_calendar.shtml>
>> >
>>
>> http://www.ncl.ucar.edu/__**Document/Functions/Built-in/__**
>> cd_inv_calendar.shtml<http://www.ncl.ucar.edu/__Document/Functions/Built-in/__cd_inv_calendar.shtml>
>> <http://www.ncl.ucar.edu/**Document/Functions/Built-in/**
>> cd_inv_calendar.shtml<http://www.ncl.ucar.edu/Document/Functions/Built-in/cd_inv_calendar.shtml>
>> >
>>
>> Good luck
>>
>>
>> On 7/10/11 9:55 PM, shinn wong wrote:
>>
>> Dear all,
>> I've got a netcdf file with time in the MATLAB datenum format (eg.
>> 730848.5, 730848.9, etc). How can I convert it into a
>> UT-referenced date
>> using ncl? Thanks in advance for any help and suggestions.
>> Regards,
>> Shinn
>>
>>
>>
>
> --
> ==============================**========================
> Dennis J. Shea tel: 303-497-1361 |
> P.O. Box 3000 fax: 303-497-1333 |
> Climate Analysis Section |
> Climate & Global Dynamics Div. |
> National Center for Atmospheric Research |
> Boulder, CO 80307 |
> USA email: shea 'at' ucar.edu |
> ==============================**========================
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jul 18 01:58:36 2011

This archive was generated by hypermail 2.1.8 : Mon Jul 18 2011 - 15:57:57 MDT