Project

General

Profile

CDO creates non-integer time

Added by Charles Manson about 12 years ago

Hi,

I have netcdf files that represent annual average temperature.
This is 1 value per file.
So 140 years = 140 annual average files.
I cat them to 1 file, representing 1 ensemble (140 years).
The problem is that the time dimension becomes a float.
GrADS needs the time dimension to be integer, and in fact the first two timesteps in the file are integer, i.e t=1 and then t=2.
For the third timestep I get something like t=3.0345.

Have I compiled wrongly?
What creates this problem?


Replies (6)

RE: CDO creates non-integer time - Added by Charles Manson about 12 years ago

Does anyone have an idea?
Or is there a way to rectify this?

RE: CDO creates non-integer time - Added by Ralf Mueller about 12 years ago

Could you provide some example files? Which CDO version do you use? Please post the output of

cdo -V
Please note the recommendations for getting help on CDO here.

RE: CDO creates non-integer time - Added by Charles Manson about 12 years ago

Hi Ralf,

Sorry about that.
I've attached sample files including the config.log of my CDO compile (zip file).
The netcdf files are 9 year individual annual averages and the result of "cat".
I've also attached the source of the 9 annual average files, which is basically individual files with 12 monthly averages (tar file).

cdo -V gives:

Climate Data Operators version 1.5.3 (http://code.zmaw.de/projects/cdo)
Compiler: gcc -std=gnu99 -g -O2 -pthread
 version: gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)
    with: PTHREADS Z
Compiled: by mogesh on toshiogeorge.csir.co.za (x86_64-unknown-linux-gnu) Jan 23 2012 11:47:55
     CDI library version : 1.5.3 of Jan 23 2012 11:47:51
 CGRIBEX library version : 1.5.1 of Aug 29 2011 20:30:27
  netCDF library version : "3.6.3" of Jan  7 2012 19:23:06 $
 SERVICE library version : 1.3.0 of Jan 23 2012 11:47:42
   EXTRA library version : 1.3.0 of Jan 23 2012 11:47:39
     IEG library version : 1.3.0 of Jan 23 2012 11:47:41
    FILE library version : 1.7.1 of Jan 23 2012 11:47:40

Individual files display fine.
It's only after the "cat" command do I get trouble, i.e in GrADS.

ga-> sdfopen ccam_cluva_mpi.1960s.tscrn.nc
Scanning self-describing file:  ccam_cluva_mpi.1960s.tscrn.nc
SDF file ccam_cluva_mpi.1960s.tscrn.nc is open as file 1
LON set to -20 60
LAT set to -20 20
LEV set to 0 0
Time values set: 1961:12:31:12 1961:12:31:12
E set to 1 1
ga-> q file
File 1 :
  Descriptor: ccam_cluva_mpi.1960s.tscrn.nc
  Binary: ccam_cluva_mpi.1960s.tscrn.nc
  Type = Gridded
  Xsize = 161  Ysize = 81  Zsize = 1  Tsize = 9  Esize = 1
  Number of Variables = 1
     tscrn  0  t,y,x  Screen temperature
ga-> set t 1 9
Time values set: 1961:12:31:12 1970:8:31:12
ga-> d tscrn
Contouring: 288 to 306 interval 2
Contouring: 288 to 306 interval 2
Data Request Error: Invalid grid coordinates
  World coordinates convert to non-integer  grid coordinates
    Variable = tscrn  Dimension = 3
  Error ocurred at column 1
DISPLAY error:  Invalid expression
  Expression = tscrn
ga->

What's strange is that I use "cat" to join other averages (e.g. monthly and daily) and I don't get this issue.

RE: CDO creates non-integer time - Added by Ralf Mueller about 12 years ago

Hi Charles!

  • in all of your files the dimension time is of type double (analyzed with ncdump):
    double time(time) ;
                    time:standard_name = "time" ;
                    time:units = "minutes since 1961-01-01 00:00:00" ;
                    time:calendar = "standard" ;
    time = 524880, 1050480, 1576080, 2103120, 2628720, 3154320, 3679920, 
        4206960, 4732560 ;
    
  • I created the 1960s file myself with cdo-1.5.4 and the result is the same as your 60s file
  • I could create an image with grads:
    Grid Analysis and Display System (GrADS) Version 2.0.a9
    Copyright (c) 1988-2010 by Brian Doty and the
    Institute for Global Environment and Society (IGES)
    GrADS comes with ABSOLUTELY NO WARRANTY
    See file COPYRIGHT for more information
    
    Config: v2.0.a9 little-endian readline printim grib2 netcdf hdf4-sds hdf5 opendap-grids,stn athena geotiff shapefile
    Issue 'q config' command for more detailed configuration information
    Landscape mode? ('n' for portrait):  y
    GX Package Initialization: Size = 11 8.5 
    ga-> sdfopen ccam_cluva_mpi.1960s.tscrn.nc
    Scanning self-describing file:  ccam_cluva_mpi.1960s.tscrn.nc
    SDF file ccam_cluva_mpi.1960s.tscrn.nc is open as file 1
    LON set to -20 60 
    LAT set to -20 20 
    LEV set to 0 0 
    Time values set: 1961:12:31:12 1961:12:31:12 
    E set to 1 1 
    ga-> q file
    File 1 : 
      Descriptor: ccam_cluva_mpi.1960s.tscrn.nc
      Binary: ccam_cluva_mpi.1960s.tscrn.nc
      Type = Gridded
      Xsize = 161  Ysize = 81  Zsize = 1  Tsize = 9  Esize = 1
      Number of Variables = 1
         tscrn  0  t,y,x  Screen temperature
    ga-> set gxout shaded
    ga-> d tscrn
    Contouring: 288 to 306 interval 2 
    ga-> printim test.gif gif x480 y640 white
    ga-> quit
    

My conclusion is, that cdo does not seem to have a problem, but grads. You might try a newer version.

test.gif (19.3 KB) test.gif

RE: CDO creates non-integer time - Added by Charles Manson about 12 years ago

Hi Ralf,

Thanks for having a look.
Before you do "d tscrn", could you also "set t 1 9" and then try?
That way GrADS will try and display each timestep.
I get the error at the 3rd entry.

I'll also try on various versions of GrADS and see what happens.
I don't think time being a double is a good thing though.

RE: CDO creates non-integer time - Added by Ralf Mueller about 12 years ago

ga-> sdfopen ccam_cluva_mpi.1960s.tscrn.nc
Scanning self-describing file:  ccam_cluva_mpi.1960s.tscrn.nc
SDF file ccam_cluva_mpi.1960s.tscrn.nc is open as file 1
LON set to -20 60 
LAT set to -20 20 
LEV set to 0 0 
Time values set: 1961:12:31:12 1961:12:31:12 
E set to 1 1 
ga-> set t 1 9
Time values set: 1961:12:31:12 1970:8:31:12 
ga-> d tscrn
Contouring: 288 to 306 interval 2 
Contouring: 288 to 306 interval 2 
Data Request Error: Invalid grid coordinates
  World coordinates convert to non-integer  grid coordinates
    Variable = tscrn  Dimension = 3 
  Error ocurred at column 1
DISPLAY error:  Invalid expression 
  Expression = tscrn
    (1-6/6)