Re: time conversion

From: shinn wong <shinnshinnwong_at_nyahnyahspammersnyahnyah>
Date: Fri Jul 15 2011 - 10:33:34 MDT

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>

> 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_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
>>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jul 15 10:33:42 2011

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