leap year Jennifer, Brian please note.

Matthias Munnich munnich at ATMOS.UCLA.EDU
Tue Feb 6 15:27:15 EST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hallo Karin,

you are struck by a time conversion bug for monthly increments.   I
usually use mid-month for monthly averaged data.  If this is OK with
you, you can circumvent this bug by using a descriptor file and xdfopen.
- -----------8<---------
dset /pf/k/k204045/data/CLM/CLM_C20_1_D3_ms_RAIN_CON_49-60.nc
tdef 12 linear 15JAN1964 1mo
- ----------->8---------
If the data point has to be at  near the end of  month  use
- -----------8<---------
dset /pf/k/k204045/data/CLM/CLM_C20_1_D3_ms_RAIN_CON_49-60.nc
tdef 12 linear 28JAN1964 1mo
- ----------->8---------


** Jennifer, Brian **

I was able to reproduce this bug.  Any file with
- -----------8<---------
tdef 12 linear NNjan1964 1mo
- ----------->8---------
with NN>29 gives me this error.    It has nothing to do with leap
years  even
tdef 12 linear 29jan1963 1mo
give the same behavior:

ga-> set t 1
Time values set: 1963:1:29:0 1963:1:29:0
ga-> set t 2
Time values set: 1963:3:1:0 1963:3:1:0
ga-> q dim
Default file number is: 1
X is varying   Lon = 299.252 to 420.754   X = 1.00001 to 109
Y is varying   Lat = 9.533 to 80.185   Y = 1 to 64
Z is fixed     Lev = 0  Z = 1
T is fixed     Time = 00Z01MAR1963  T = 3
ga-> set t 3
Time values set: 1963:3:29:0 1963:3:29:0
ga-> q dim
Default file number is: 1
X is varying   Lon = 299.252 to 420.754   X = 1.00001 to 109
Y is varying   Lat = 9.533 to 80.185   Y = 1 to 64
Z is fixed     Lev = 0  Z = 1
T is fixed     Time = 00Z29MAR1963  T = 3
ga-> q config
Config: v1.9b4 32-bit little-endian readline sdf/xdf netcdf lats printim


 Note that this is not just labeling.   Data at t=2 cannot be accessed
at all. Instead  data at t=3 are silently displayed.  This is bad!

... Matt

PS: Karin, ich war erstaunt Dich wieder auf der Gradsusr-liste zu
finden. Ich hatte gedacht, Du hast beim DRKZ aufgehoert.  Gruesse nach HH!

Karin Meier-Fleischer wrote:
> Hallo Matthias,
>
> schoen von Dir zu hoeren.
>
>
> Here is my problem with the leap year:
>
> the data file contains 12 monthly time steps (from 23:59Z31JAN1964 to
> 23:59Z31DEC1964)
>
>     -1 :       Date  Time Code  Level    Size    Miss :
Minimum        Mean     Maximum
>      1 : 1964-01-31 23:59  -1       0   42126       0 :
0.0000      25.063      557.66
>      2 : 1964-02-29 23:59  -1       0   42126       0 :
0.0000      25.040      1086.3
>      3 : 1964-03-31 23:59  -1       0   42126       0 :
0.0000      20.098      539.31
>      4 : 1964-04-30 23:59  -1       0   42126       0 :
0.0000      20.345      265.12
>      5 : 1964-05-31 23:59  -1       0   42126       0 :
0.0000      22.864      315.59
>      6 : 1964-06-30 23:59  -1       0   42126       0 :
0.0000      29.650      388.09
>      7 : 1964-07-31 23:59  -1       0   42126       0 :
0.0000      27.702      287.31
>      8 : 1964-08-31 23:59  -1       0   42126       0 :
0.0000      26.029      243.57
>      9 : 1964-09-30 23:59  -1       0   42126       0 :
0.0000      22.945      355.16
>     10 : 1964-10-31 23:59  -1       0   42126       0 :
0.0000      24.714      359.15
>     11 : 1964-11-30 23:59  -1       0   42126       0 :
0.0000      21.487      424.59
>     12 : 1964-12-31 23:59  -1       0   42126       0 :
0.0000      17.004      294.62
> cdo info: Processed 1 variable 12 timesteps. ( 0.02s )
>
>
> The GrADS script leap_year.gs has the following output:
> -------------------------------------------------------
>
> Scanning self-describing file:
> /pf/k/k204045/data/CLM/CLM_C20_1_D3_ms_RAIN_CON_49-60.nc
> Found 1 data variables in SDF file.
> Found displayable variable rain_con with 0 levels in SDF file.
> dset /pf/k/k204045/data/CLM/CLM_C20_1_D3_ms_RAIN_CON_49-60.nc
> title CLM simulation of the 20th century climate with anthropogenic
> forcing (C20_1) for the SGA project (CLM_C20_1)
> undef 9.96921e+36
> xdef 238 linear -10.6 0.200001
> ydef 177 linear 34.6 0.200001
> zdef 1 linear 0 0
> tdef 12 linear 23:59Z31JAN1964 1mo
> vars 1
> rain_con 0 -999 convective rainfall
>
> -- t=1 --
> Default file number is: 1
> X is varying   Lon = -10.6 to 36.8002   X = 1 to 238
> Y is varying   Lat = 34.6 to 69.8001   Y = 1 to 177
> Z is fixed     Lev = 0  Z = 1
> T is fixed     Time = 23:59Z31JAN1964  T = 1
>
> -- t=2 --
> Default file number is: 1
> X is varying   Lon = -10.6 to 36.8002   X = 1 to 238
> Y is varying   Lat = 34.6 to 69.8001   Y = 1 to 177
> Z is fixed     Lev = 0  Z = 1
> T is fixed     Time = 23:59Z02MAR1964  T = 3
>
> -- t=3 --
> Default file number is: 1
> X is varying   Lon = -10.6 to 36.8002   X = 1 to 238
> Y is varying   Lat = 34.6 to 69.8001   Y = 1 to 177
> Z is fixed     Lev = 0  Z = 1
> T is fixed     Time = 23:59Z31MAR1964  T = 3
>
> -- t=12 --
> Default file number is: 1
> X is varying   Lon = -10.6 to 36.8002   X = 1 to 238
> Y is varying   Lat = 34.6 to 69.8001   Y = 1 to 177
> Z is fixed     Lev = 0  Z = 1
> T is fixed     Time = 23:59Z31DEC1964  T = 12
>
> -- time=23:59Z29FEB1964 --
> Default file number is: 1
> X is varying   Lon = -10.6 to 36.8002   X = 1 to 238
> Y is varying   Lat = 34.6 to 69.8001   Y = 1 to 177
> Z is fixed     Lev = 0  Z = 1
> T is fixed     Time = 23:59Z02MAR1964  T = 3
>
> -- t=1-12 --
> Default file number is: 1
> X is varying   Lon = -10.6 to 36.8002   X = 1 to 238
> Y is varying   Lat = 34.6 to 69.8001   Y = 1 to 177
> Z is fixed     Lev = 0  Z = 1
> T is varying   Time = 23:59Z31JAN1964 to 23:59Z31DEC1964  T = 1 to 12
> --------------------------------------------------------------------------
>
> The plot shows a wrong value for february (it ist the same as march):
> instead of value 1086.3 it plots 539.31.
>
> Any idea what is going wrong?
>
> Thanks in advance,
> Karin
> ---------------------------------\\---------------------------------------
> Karin Meier-Fleischer             \\ Max-Planck-Institut fuer Meteorologie
> Phone: +49-40-41173-431            \\   Abteilung Modelle & Daten
> FAX:   +49-40-41173-476             \\    Bundesstr. 53
> Email: karin.meier-fleischer at zmaw.de \\   D-20146 Hamburg
> http://www.mad.zmaw.de/               \\  Germany
> ---------------------------------------\\---------------------------------
>
> On Mon, 5 Feb 2007, Matthias Munnich wrote:
>
> Hi Karin,
>
> without a look at the descriptor file and a complete log of an example
> session
> it's hard to figure out what exactly is going on.  Can you use "set t"
> to set time
> to 29Feb?
>
> ... Matt
>
>
> Karin Meier-Fleischer wrote:
> >>> Hi,
> >>>
> >>> I've got a data file containing a leap year (1964). If I try to
> set the
> >>> time to 23:59Z29Feb1964 GrADS always
> >>> changes the time to 23:59Z02MAR1964.
> >>>
> >>> How could I prevent this?
> >>>
> >>> Thanks, Karin
> >>>
> ---------------------------------\\---------------------------------------
> >>>
> >>> Karin Meier-Fleischer             \\ Max-Planck-Institut fuer
> >>> Meteorologie
> >>> Phone: +49-40-41173-431            \\   Abteilung Modelle & Daten
> >>> FAX:   +49-40-41173-476             \\    Bundesstr. 53
> >>> Email: karin.meier-fleischer at zmaw.de \\   D-20146 Hamburg
> >>> http://www.mad.zmaw.de/               \\  Germany
> >>>
> ---------------------------------------\\---------------------------------
> >>>
>
>
>>

> -------------------------

> function LeapYear(args)

> _DATA='/pf/k/k204045/data/CLM/CLM_C20_1_D3_ms_RAIN_CON_49-60.nc'

> 'sdfopen '_DATA

> 'q ctlinfo'; say result

> say '-- t=1 --'
> 'set t 1'
> 'q dims'; say result

> say '-- t=2 --'
> 'set t 2'
> 'q dims'; say result

> say '-- t=3 --'
> 'set t 3'
> 'q dims'; say result

> say '-- t=12 --'
> 'set t 12'
> 'q dims'; say result

> say '-- time=23:59Z29FEB1964 --'
> 'set time 23:59Z29FEB1964'
> 'q dims'; say result

> say '-- t=1-12 --'
> 'set t 1 12'
> 'q dims'; say result

> 'set x 1'
> 'set y 1'
> 'd tloop(rain_con)'

> 'printim leap_year.gif gif white'

> return

> -------------------------



- --
- --------------------------------
Matthias Munnich
Univ. of California, Los Angeles
Dept. of Atmos. and Oceanic Sc. and
Inst. of Geophysics and Planetary Physics
3845 Slichter Hall
Los Angeles, CA 90095-1567
Phone: +1-310-794 5899
Fax: +1-310-206 3051
Email: munnich at atmos.ucla.edu
- --------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFyOSiidaDTh/cfhYRAnnMAJ9oAJH5MRGLPxXzoqDQenf2uGnuCQCgoyt0
TCKiIWgHYErksY5mVUsipnw=
=xai3
-----END PGP SIGNATURE-----



More information about the gradsusr mailing list