Re: Possible off-by-one error in "ut_string"

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Mar 26 2014 - 10:08:10 MDT

Hi Gary, Have the user use 'cd_calendar'

ut_string is a deprecated function:
 
https://www.ncl.ucar.edu/Document/Functions/User_contributed/ut_string.shtml
====
It has been replaced by cd_string
 
https://www.ncl.ucar.edu/Document/Functions/User_contributed/cd_string.shtml
===
f = addfile("tos_day_CCSM4_historical_r1i1p1_19700101-19891231.nc","r")
time = f->time

---
Variable: time
Type: double
Total Size: 58400 bytes
             7300 values
Number of Dimensions: 1
Dimensions and sizes:	[time | 7300]
Coordinates:
             time: [719050.5..726349.5]
Number Of Attributes: 6
   bounds :	time_bnds
   units :	days since 0000-01-01 00:00:00
   calendar :	noleap     <============
   axis :	T
   long_name :	time
   standard_name :	time
---
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"
print(cd_string(time(0:30),""))
---
Variable: unnamed (return)
Type: string
Total Size: 248 bytes
             31 values
Number of Dimensions: 1
Dimensions and sizes:   [31]
Coordinates:
Number Of Attributes: 1
   _FillValue :  missing
(0)     1200 UTC 1 Jan 1970
(1)     1200 UTC 2 Jan 1970
(2)     1200 UTC 3 Jan 1970
(3)     1200 UTC 4 Jan 1970
(4)     1200 UTC 5 Jan 1970
(5)     1200 UTC 6 Jan 1970
[SNIP]
On 3/26/14, 9:34 AM, Gary Strand wrote:
>
> A user of CCSM4 CMIP5 data was concerned because the timestamp part of the name of the file didn't match what "ut_string" printed for the ending date of the file. I thought he had a bad file, but I verified that "ut_string" returns an incorrect value.
>
> The cause may be that "time has 'units = "days since 0000-01-01"', which is required by the CMIP5 data specification.
>
> NCL version: 6.1.2
> hardware   : yellowstone
>
> test file  : /glade/scratch/strandwg/NCL/tos_day_CCSM4_historical_r1i1p1_19700101-19891231.nc
>
> For example:
>
> ncl 0> f = addfile("tos_day_CCSM4_historical_r1i1p1_19700101-19891231.nc","r")
> ncl 1> time = f->time
> ncl 2> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/ut_string.ncl"
> ncl 3> print(ut_string(time(0:30),""))
>
> Variable: unnamed (return)
> Type: string
> Total Size: 248 bytes
>              31 values
> Number of Dimensions: 1
> Dimensions and sizes:   [31]
> Coordinates:
> Number Of Attributes: 1
>    _FillValue :  missing
> (0)     1200 UTC 1 Jan 1971
> (1)     1200 UTC 2 Jan 1971
> (2)     1200 UTC 3 Jan 1971
> (3)     1200 UTC 4 Jan 1971
> (4)     1200 UTC 5 Jan 1971
> (5)     1200 UTC 6 Jan 1971
> (6)     1200 UTC 7 Jan 1971
> (7)     1200 UTC 8 Jan 1971
> (8)     1200 UTC 9 Jan 1971
> (9)     1200 UTC 10 Jan 1971
>
> In fact, the data (as noted in the filename) begin at 1200 UTC on 01 Jan 1970.
>
> Thanks!
>
> Gary Strand
> strandwg@ucar.edu
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Mar 26 10:08:29 2014

This archive was generated by hypermail 2.1.8 : Mon Mar 31 2014 - 11:47:09 MDT