[gradsusr] Problem with date line crossing data in netcdf files

Frank Sonntag f.sonntag at metocean.co.nz
Tue Feb 15 22:59:22 EST 2011


Hello,

We've come across a problem when working with netcdf data from the Ocean 
Forecast System. The grid spans the date line with longitudes from 250 to 20 
degrees. The netcdf file is created by wgrib2.
Printing out the longitude of the second (or later) point past the date line 
gives the following error:

ga-> set x 2200
LON set to 4.92 4.92
ga-> d lon
Data Request Error: Invalid grid coordinates
  World coordinates convert to non-integer  grid coordinates
    Variable = lon  Dimension = 0
  Error ocurred at column 1
DISPLAY error:  Invalid expression
  Expression = lon


However the first point past the date line works:
ga-> set x 2102
LON set to 0.02 0.02
ga-> d lon
Printing Grid -- 1 Values -- Undef = -9.99e+08
0.02



I have noticed that when handling netcdf files grads tests whether a dimension 
is linear or in levels by comparing the differences between the element 1 and 
2 and 2 and 3 which in this case would yield a positive result.
OTOH the longitudes generated by wgrib2 are not strictly linear, as the 
following excerpt shows:
359.57, 359.62, 359.67, 359.72,
    359.77, 359.82, 359.87, 359.92, 359.97, 0.0200000000000387,
    0.07000000000005, 0.120000000000005, 0.170000000000016,
    0.220000000000027, 0.270000000000039, 0.32000000000005,
    0.370000000000005, 0.420000000000016, 0.470000000000027,
    0.520000000000039, 0.57000000000005, 0.620000000000005,
    0.670000000000016, 0.720000000000027, 0.770000000000039,
    0.82000000000005, 0.870000000000005, 0.920000000000016,
    0.970000000000027, 1.02000000000004, 1.07000000000005, 1.12,
    1.17000000000002, 1.22000000000003, 1.27000000000004, 1.32000000000005,
    1.37, 1.42000000000002, 1.47000000000003, 1.52000000000004,
    1.57000000000005, 1.62, 1.67000000000002, 1.72000000000003,
    1.77000000000004, 1.82000000000005, 1.87, 1.92000000000002,
    1.97000000000003, 2.02000000000004, 2.07000000000005, 2.12,
    2.17000000000002, 2.22000000000003, 2.27000000000004, 2.32000000000005,
    2.37, 2.42000000000002, 2.47000000000003, 2.52000000000004,
    2.57000000000005, 2.62, 2.67000000000002, 2.72000000000003,
    2.77000000000004, 2.82000000000005, 2.87, 2.92000000000002,


I am not sure if this is a bug in grads or expected behaviour but would be 
grateful for any opinions on this or workarounds.

I can provide a (800kb) test data file on request.

Cheers,
Frank

Environment:
GNU/Linux

Config: v2.0.a8 little-endian readline printim grib2 netcdf hdf4-sds hdf5 
opendap-grids,stn geotiff shapefile
Grid Analysis and Display System (GrADS) Version 2.0.a8
Copyright (c) 1988-2010 by Brian Doty and the
Institute for Global Environment and Society (IGES)
This program is distributed WITHOUT ANY WARRANTY
See file COPYRIGHT for more information.

Built Fri Mar 26 10:24:10 EDT 2010 for x86_64-unknown-linux-gnu

This version of GrADS has been configured with the following options:
  o Built on a LITTLE ENDIAN machine
  o Athena Widget GUI DISABLED
  o Command line editing ENABLED
      http://tiswww.case.edu/php/chet/readline/rltop.html
  o printim command for image output ENABLED
      http://www.zlib.net
      http://www.libpng.org/pub/png/libpng.html
      http://www.libgd.org/Main_Page
  o GRIB2 interface ENABLED
      http://www.ijg.org
      http://www.ece.uvic.ca/~mdadams/jasper
      http://www.nco.ncep.noaa.gov/pmb/codes/GRIB2
      g2clib-1.1.8
  o NetCDF interface ENABLED
      http://www.unidata.ucar.edu/software/netcdf
      netcdf 4.1.1-rc2 of Mar 23 2010 09:31:58 $
  o OPeNDAP gridded data interface ENABLED
  o OPeNDAP station data interface ENABLED
      http://iges.org/grads/gadoc/supplibs.html
      libgadap 2.0
  o HDF4 and HDF5 interfaces ENABLED
      http://hdfgroup.org
      HDF 4.2r3
      HDF5 1.8.4
  o GeoTIFF and KML output ENABLED
      http://www.libtiff.org
      http://geotiff.osgeo.org
  o Shapefile interface ENABLED
      http://shapelib.maptools.org



More information about the gradsusr mailing list