[ncl-talk] Error on relative units conversion, string = day as %Y%m%d.%f

Mary Haley haley at ucar.edu
Mon Nov 3 08:35:45 MST 2014


Thomas,

I think you want to parse your array to get the individual years, months,
days, hours, and seconds, and then use cd_inv_calendar to generate an array
of time numeric values with units of something like "hours since 1850-01-01"

See example #2 at:

http://www.ncl.ucar.edu/Document/Functions/Built-in/cd_inv_calendar.shtml

which is similar to your situation.

--Mary


On Fri, Oct 31, 2014 at 9:30 AM, Thomas Tobian <thomastobian at gmail.com>
wrote:

> Hallo,
>
> Anyone know how to solve the problem with my historical model data, 1850
> to 1875:
> '
>       institution : Max-Planck-Institute for Meteorology
>       CDO : Climate Data Operators version 1.5.9 (
> http://code.zmaw.de/projects/cdo)
>    dimensions:
>       lon = 192
>       lat = 96
>       lev = 1
>       time = 9496  // unlimited
>    variables:
>       double lon ( lon )
>          standard_name :        longitude
>          long_name :    longitude
>          units :        degrees_east
>          axis : X
>
>       double lat ( lat )
>          standard_name :        latitude
>          long_name :    latitude
>          units :        degrees_north
>          axis : Y
>
>       double lev ( lev )
>          standard_name :        air_pressure
>          long_name :    pressure
>          units :        Pa
>          positive :     down
>          axis : Z
>
>       double time ( time )
>          standard_name :        time
>          units :        day as %Y%m%d.%f
>          calendar :     proleptic_gregorian
>
>       float var131 ( time, lev, lat, lon )
>          table :        128
>          grid_type :    gaussian
>
> I got errors once I tried to subset the data using NCL as follows:
>
> f1 = addfile ("day_data.1850.to.1875.131.25000.ano.nc","r")
> ymdStrt  = 18500101
> ymdLast = 18751231
> time    = f2->time
>
>
> *ymd     = cd_calendar(time,-2)CDMS error: Error on relative units
> conversion, string = day as %Y%m%d.%f*
>
>
> *CDMS error: Error on time conversion: invalid month = 3664*
> ;======
>
> ncl 9> print(time)
>
>
> Variable: time
> Type: double
> Total Size: 75968 bytes
>             9496 values
> Number of Dimensions: 1
> Dimensions and sizes:   [time | 9496]
> Coordinates:
>             time: [18500101.75..18751231.75]
> Number Of Attributes: 3
>   standard_name :       time
>   units :       day as %Y%m%d.%f
>   calendar :    proleptic_gregorian
> (0)     18500101.75
> (1)     18500102.75
> (2)     18500103.75
> (3)     18500104.75
> (4)     18500105.75
> (5)     18500106.75
> (6)     18500107.75
> (7)     18500108.75
> (8)     18500109.75
> (9)     18500110.75
> (10)    18500111.75
> (11)    18500112.75
> (12)    18500113.75
>
>
> Thank you
> -- Thomas
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141103/c4a81cfc/attachment.html 


More information about the ncl-talk mailing list