Re: odd ut_calendar behavior

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Mon Dec 13 2010 - 16:17:03 MST

Never mind about the old version. I get the same incorrect value
that you did with NCL 5.2.1 on Mac OS 10.6.

mac56:~ 1> ncl
  NCAR Command Language Version 5.2.1
ncl 0> x = 364.5d
ncl 1> x@units = "days since 2005-01-01 12:00:00"
ncl 2> x@calendar = "noleap"
ncl 3> print (""+ut_calendar(x,-3))
(0) 2005123124

--Dave

On 12/13/2010 3:45 PM, Dave Allured wrote:
> Rich,
>
> Okay, this confirms what you expected in the first place, the output
> from print(ut_calendar(inptr->time, -3)) should be 2006010100. The
> final "24" (hours) should never be seen. The function should always
> carry up to the next day, so that hours is always 00 to 23.
>
> This looks like a roundoff problem in the ut_calendar function or
> calendar support routines. There was a previous bug report on a
> problem like this in the UDUNITS support library, but I think that
> was fixed years ago. Are you using a very old version of NCL?
> Beyond that, I should say no more and let NCL support staff take a
> closer look.
>
> --Dave
>
> On 12/13/2010 2:35 PM, Rich Neale wrote:
>> Here it is Dave, thanks!
>>
>> Variable: time
>> Type: double
>> Total Size: 8 bytes
>> 1 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [time | 1]
>> Coordinates:
>> time: [364.5..364.5]
>> Number Of Attributes: 4
>> long_name : time
>> units : days since 2005-01-01 12:00:00
>> calendar : noleap
>> bounds : time_bnds
>> (0) 364.5
>>
>>
>> On 12/13/2010 02:33 PM, Dave Allured wrote:
>>> Rich,
>>>
>>> To simplify diagnosis, please show the full output from this command:
>>>
>>> print(inptr->time)
>>>
>>> --Dave
>>>
>>> On 12/13/2010 2:06 PM, Rich Neale wrote:
>>>> Hi, I am getting strange behavior from ut_calendar when I run the
>>>> following on cgd systems for those interested). I am trying to
>>>> test that
>>>> the date of a CAM file is January 2006.
>>>>
>>>> inptr =
>>>> addfile("/project/convection/juliob/CAMruns/twdLL05/twdLL05.cam2.h1.2006-01-01-00000.nc","r")
>>>>
>>>> print(ut_calendar(inptr->time, -3))
>>>>
>>>> *Result
>>>>
>>>> Variable: unnamed (return)
>>>> Type: integer
>>>> Total Size: 4 bytes
>>>> 1 values
>>>> Number of Dimensions: 1
>>>> Dimensions and sizes: [1]
>>>> Coordinates:
>>>> Number Of Attributes: 1
>>>> calendar : noleap
>>>> (0) 2005123124
>>>>
>>>>
>>>>
>>>> I would expect this to be 2006010100
>>>> Any idea why this is 24 at the end and not 00?
>>>> Below is an ncdump -h on the file.
>>>> The time units are a little odd
>>>> time:units = "days since 2005-01-01 12:00:00" ;
>>>>
>>>> And I am wondering if ut_calendar is having difficulty with the '12'
>>>>
>>>> Thanks!!
>>>> Rich
>>>>
>>>> *********************************************
>>>>
>>>> netcdf twdLL05.cam2.h1.2006-01-01-00000 {
>>>> dimensions:
>>>> lat = 96 ;
>>>> lon = 144 ;
>>>> slat = 95 ;
>>>> slon = 144 ;
>>>> lev = 30 ;
>>>> ilev = 31 ;
>>>> isccp_prs = 7 ;
>>>> isccp_tau = 7 ;
>>>> isccp_prstau = 49 ;
>>>> time = UNLIMITED ; // (1 currently)
>>>> tbnd = 2 ;
>>>> chars = 8 ;
>>>> variables:
>>>> double P0 ;
>>>> P0:long_name = "reference pressure" ;
>>>> P0:units = "Pa" ;
>>>> double lat(lat) ;
>>>> lat:long_name = "latitude" ;
>>>> lat:units = "degrees_north" ;
>>>> double lon(lon) ;
>>>> lon:long_name = "longitude" ;
>>>> lon:units = "degrees_east" ;
>>>> double slat(slat) ;
>>>> slat:long_name = "staggered latitude" ;
>>>> slat:units = "degrees_north" ;
>>>> double slon(slon) ;
>>>> slon:long_name = "staggered longitude" ;
>>>> slon:units = "degrees_east" ;
>>>> double w_stag(slat) ;
>>>> w_stag:long_name = "staggered latitude weights" ;
>>>> double lev(lev) ;
>>>> lev:long_name = "hybrid level at midpoints (1000*(A+B))" ;
>>>> lev:units = "level" ;
>>>> lev:positive = "down" ;
>>>> lev:standard_name =
>>>> "atmosphere_hybrid_sigma_pressure_coordinate" ;
>>>> lev:formula_terms = "a: hyam b: hybm p0: P0 ps: PS" ;
>>>> double ilev(ilev) ;
>>>> ilev:long_name = "hybrid level at interfaces
>>>> (1000*(A+B))" ;
>>>> ilev:units = "level" ;
>>>> ilev:positive = "down" ;
>>>> ilev:standard_name =
>>>> "atmosphere_hybrid_sigma_pressure_coordinate" ;
>>>> ilev:formula_terms = "a: hyai b: hybi p0: P0 ps: PS" ;
>>>> double isccp_prs(isccp_prs) ;
>>>> isccp_prs:long_name = "Mean ISCCP pressure" ;
>>>> isccp_prs:units = "mb" ;
>>>> isccp_prs:isccp_prs_bnds = 0., 180., 310., 440., 560.,
>>>> 680., 800., 1000. ;
>>>> double isccp_tau(isccp_tau) ;
>>>> isccp_tau:long_name = "Mean ISCCP optical depth" ;
>>>> isccp_tau:units = "unitless" ;
>>>> isccp_tau:isccp_tau_bnds = 0., 0.3, 1.3, 3.6, 9.4, 23.,
>>>> 60., 379. ;
>>>> double isccp_prstau(isccp_prstau) ;
>>>> isccp_prstau:long_name = "Mean pressure (mb).mean
>>>> optical depth (unitless)/1000" ;
>>>> isccp_prstau:units = "mixed" ;
>>>> double time(time) ;
>>>> time:long_name = "time" ;
>>>> time:units = "days since 2005-01-01 12:00:00" ;
>>>> time:calendar = "noleap" ;
>>>> time:bounds = "time_bnds" ;
>>>> double time_bnds(time, tbnd) ;
>>>> time_bnds:long_name = "time interval endpoints" ;
>>>> char date_written(time, chars) ;
>>>> char time_written(time, chars) ;
>>>> int ntrm ;
>>>> ntrm:long_name = "spectral truncation parameter M" ;
>>>> int ntrn ;
>>>> ntrn:long_name = "spectral truncation parameter N" ;
>>>> int ntrk ;
>>>> ntrk:long_name = "spectral truncation parameter K" ;
>>>> int ndbase ;
>>>> ndbase:long_name = "base day" ;
>>>> int nsbase ;
>>>> nsbase:long_name = "seconds of base day" ;
>>>> int nbdate ;
>>>> nbdate:long_name = "base date (YYYYMMDD)" ;
>>>> int nbsec ;
>>>> nbsec:long_name = "seconds of base date" ;
>>>> int mdt ;
>>>> mdt:long_name = "timestep" ;
>>>> mdt:units = "s" ;
>>>> int nlon(lat) ;
>>>> nlon:long_name = "number of longitudes" ;
>>>> int wnummax(lat) ;
>>>> wnummax:long_name = "cutoff Fourier wavenumber" ;
>>>> double hyai(ilev) ;
>>>> hyai:long_name = "hybrid A coefficient at layer
>>>> interfaces" ;
>>>> double hybi(ilev) ;
>>>> hybi:long_name = "hybrid B coefficient at layer
>>>> interfaces" ;
>>>> double hyam(lev) ;
>>>> hyam:long_name = "hybrid A coefficient at layer
>>>> midpoints" ;
>>>> double hybm(lev) ;
>>>> hybm:long_name = "hybrid B coefficient at layer
>>>> midpoints" ;
>>>> double gw(lat) ;
>>>> gw:long_name = "gauss weights" ;
>>>> int ndcur(time) ;
>>>> ndcur:long_name = "current day (from base day)" ;
>>>> int nscur(time) ;
>>>> nscur:long_name = "current seconds of current day" ;
>>>> int date(time) ;
>>>> date:long_name = "current date (YYYYMMDD)" ;
>>>> double co2vmr(time) ;
>>>> co2vmr:long_name = "co2 volume mixing ratio" ;
>>>> double ch4vmr(time) ;
>>>> ch4vmr:long_name = "ch4 volume mixing ratio" ;
>>>> double n2ovmr(time) ;
>>>> n2ovmr:long_name = "n2o volume mixing ratio" ;
>>>> double f11vmr(time) ;
>>>> f11vmr:long_name = "f11 volume mixing ratio" ;
>>>> double f12vmr(time) ;
>>>> f12vmr:long_name = "f12 volume mixing ratio" ;
>>>> double sol_tsi(time) ;
>>>> sol_tsi:long_name = "total solar irradiance" ;
>>>> sol_tsi:units = "W/m2" ;
>>>> int datesec(time) ;
>>>> datesec:long_name = "current seconds of current date" ;
>>>> int nsteph(time) ;
>>>> nsteph:long_name = "current timestep" ;
>>>> float OMEGA(time, lev, lat, lon) ;
>>>> OMEGA:units = "Pa/s" ;
>>>> OMEGA:long_name = "Vertical velocity (pressure)" ;
>>>> float PBLH(time, lat, lon) ;
>>>> PBLH:units = "m" ;
>>>> PBLH:long_name = "PBL height" ;
>>>> float PRECC(time, lat, lon) ;
>>>> PRECC:units = "m/s" ;
>>>> PRECC:long_name = "Convective precipitation rate (liq +
>>>> ice)" ;
>>>> float PRECL(time, lat, lon) ;
>>>> PRECL:units = "m/s" ;
>>>> PRECL:long_name = "Large-scale (stable) precipitation
>>>> rate (liq + ice)" ;
>>>> float PRECSH(time, lat, lon) ;
>>>> PRECSH:units = "m/s" ;
>>>> PRECSH:long_name = "Shallow Convection precipitation
>>>> rate" ;
>>>> float PS(time, lat, lon) ;
>>>> PS:units = "Pa" ;
>>>> PS:long_name = "Surface pressure" ;
>>>> float Q(time, lev, lat, lon) ;
>>>> Q:units = "kg/kg" ;
>>>> Q:long_name = "Specific humidity" ;
>>>> float T(time, lev, lat, lon) ;
>>>> T:units = "K" ;
>>>> T:long_name = "Temperature" ;
>>>> float U(time, lev, lat, lon) ;
>>>> U:units = "m/s" ;
>>>> U:long_name = "Zonal wind" ;
>>>> float V(time, lev, lat, lon) ;
>>>> V:units = "m/s" ;
>>>> V:long_name = "Meridional wind" ;
>>>>
>>>> // global attributes:
>>>> :Conventions = "CF-1.0" ;
>>>> :source = "CAM" ;
>>>> :case = "twdLL05" ;
>>>> :title = "atm case twdLL" ;
>>>> :logname = "juliob" ;
>>>> :host = "be1005en.ucar.ed" ;
>>>> :Version = "$Name$" ;
>>>> :revision_Id = "$Id$" ;
>>>> :initial_file =
>>>> "/fs/cgd/csm/inputdata/atm/cam/inic/fv/cami-mam3_0000-01-01_1.9x2.5_L30_c090306.nc"
>>>>
>>>> ;
>>>> :topography_file =
>>>> "/fs/cgd/csm/inputdata/atm/cam/topo/USGS-gtopo30_1.9x2.5_remap_c050602.nc"
>>>> ;
>>> _______________________________________________
>>> 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
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Dec 13 16:17:11 2010

This archive was generated by hypermail 2.1.8 : Wed Dec 22 2010 - 16:10:23 MST