[gradsusr] problem opening netcdf files

Arlindo da Silva dasilva at alum.mit.edu
Fri Dec 16 21:23:47 EST 2011


On Fri, Dec 16, 2011 at 6:42 PM, Lisa Welp-Smith <lwelp at ucsd.edu> wrote:

> Responding to Arlindo and Jim:  Here is the ncdump output.  Below I've
> also copied the sdfopen results.  You might be right about the
> dimensions, but I'm not sure how to deal with that.
>
>
You have 2 different time coordinates in this file: *time* and *mtime*.
GrADS finds *time* first, and disregards the second one (*mtime*).  There
are a couple of ways of dealing with this. The simplest way is to create a
DDF file, say "s85_v3.2_monthly.ddf" containing 2 lines:

DSET  s85_v3.2_monthly.nc
TDEF mtime 324 LINEAR 1jan2001 1mo

In GrADS, you open this file with

ga-> xdfopen s85_v3.2_monthly.ddf

This should give you all the variables indexed by *mtime* (but not *time*
as grads allows only 1 time axis oer file.) Another possibility is to write
a full blown control file, see the User's Guide:
http://grads.iges.org/grads/gadoc/descriptorfile.html

  Good Luck,

     Arlindo




> % ncdump -h s85_v3.2_monthly.nc
> netcdf s85_v3.2_monthly {
> dimensions:
>         nv = 2 ;
>         nchar = 20 ;
>         lon = 72 ;
>         lat = 48 ;
>         time = 9862 ;
>         proc = 8 ;
>         rt = 3 ;
>         spec = 1 ;
>         mtime = 324 ;
> variables:
>         float lon(lon) ;
>                 lon:long_name = "longitude" ;
>                 lon:standard_name = "longitude" ;
>                 lon:units = "degrees_east" ;
>                 lon:point_spacing = "even" ;
>         float lat(lat) ;
>                 lat:long_name = "latitude" ;
>                 lat:standard_name = "latitude" ;
>                 lat:units = "degrees_north" ;
>                 lat:point_spacing = "even" ;
>         int time(time) ;
>                 time:long_name = "time" ;
>                 time:units = "seconds since 2000-01-01" ;
>                 time:bounds = "time_bounds" ;
>         int time_bounds(time, nv) ;
>         int dt(time) ;
>                 dt:units = "seconds" ;
>                 dt:long_name = "time intervals" ;
>         double year(time) ;
>                 year:long_name = "time as fractional year" ;
>         int proc(proc) ;
>         char lproc(proc, nchar) ;
>                 lproc:long_name = "flux components" ;
>         int rt(rt) ;
>         char lrt(rt, nchar) ;
>                 lrt:long_name = "region type" ;
>         int spec(spec) ;
>         char lspec(spec, nchar) ;
>                 lspec:long_name = "tracer species" ;
>         float dxyp(lat, lon) ;
>                 dxyp:long_name = "area per grid cell" ;
>                 dxyp:units = "m2" ;
>                 dxyp:standard_name = "area" ;
>         float area(rt, lat, lon) ;
>                 area:long_name = "land/ocean area per grid cell" ;
>                 area:units = "m2" ;
>         int mtime(mtime) ;
>                 mtime:long_name = "output time" ;
>                 mtime:units = "seconds since 2000-01-01" ;
>         double myear(mtime) ;
>                 myear:long_name = "output time (fractional year)" ;
>         float co2flux_land(mtime, lat, lon) ;
>                 co2flux_land:long_name = "Land-atmosphere co2 flux" ;
>                 co2flux_land:units = "PgC/yr" ;
>                 co2flux_land:cell_methods = "lon: lat: sum" ;
>                 co2flux_land:cell_measures = "area: dxyp" ;
>         float co2flux_ocean(mtime, lat, lon) ;
>                 co2flux_ocean:long_name = "Ocean-atmosphere co2 flux" ;
>                 co2flux_ocean:units = "PgC/yr" ;
>                 co2flux_ocean:cell_methods = "lon: lat: sum" ;
>                 co2flux_ocean:cell_measures = "area: dxyp" ;
>         float co2flux_subt(mtime, lat, lon) ;
>                 co2flux_subt:long_name = "Subtracted co2 flux" ;
>                 co2flux_subt:units = "PgC/yr" ;
>                 co2flux_subt:cell_methods = "lon: lat: sum" ;
>                 co2flux_subt:cell_measures = "area: dxyp" ;
>         float co2flux_excl(mtime, lat, lon) ;
>                 co2flux_excl:long_name = "Spin-up/down co2 flux" ;
>                 co2flux_excl:units = "PgC/yr" ;
>                 co2flux_excl:cell_methods = "lon: lat: sum" ;
>                 co2flux_excl:cell_measures = "area: dxyp" ;
>         float taper(time) ;
>
> // global attributes:
>                 :title = "Jena inversion results" ;
>                 :history = "Inversion code by Christian Roedenbeck" ;
>                 :institution = "MPI Biogeochemistry, Jena" ;
>                 :references =
> "http://www.bgc-jena.mpg.de/~christian.roedenbeck/download-CO2/" ;
>                 :Conventions = "CF-1.1" ;
>                 :species = "co2" ;
>                 :yrfi = 1983 ;
>                 :yrfe = 2009 ;
>                 :dirname =
> "OUTPUTi12.079_1983-2009_fg.co2.S19b_M85j_Std18" ;
>                 :filename = "mu1.0_070_flux_monthly.nc" ;
>                 :c0 = 342.5f ;
>                 :valid_period = "1985-2008 (inclusive)" ;
>                 :yrfi_valid = 1985 ;
>                 :yrfe_valid = 2008 ;
>                 :yrfi_taper = 1985 ;
>                 :yrfe_taper = 2008 ;
> }
>
> ---------------------------------------------------
> ga-> sdfopen s85_v3.2_monthly.nc
> Scanning self-describing file:  s85_v3.2_monthly.nc
> SDF file s85_v3.2_monthly.nc is open as file 1
> LON set to -180 175
> LAT set to -90 90
> LEV set to 0 0
> Time values set: 1983:1:1:0 1983:1:1:0
> E set to 1 1
> ga-> q file
> File 1 : Jena inversion results
>   Descriptor: s85_v3.2_monthly.nc
>   Binary: s85_v3.2_monthly.nc
>   Type = Gridded
>   Xsize = 72  Ysize = 48  Zsize = 1  Tsize = 9862  Esize = 1
>   Number of Variables = 4
>      dt  0  t  time intervals
>      year  0  t  time as fractional year
>      dxyp  0  y,x  area per grid cell
>      taper  0  t  taper
> ga->
>
>
> On 12/16/11 2:19 PM, Lisa Welp-Smith wrote:
> > Hello,
> >
> > I'm trying to open some netcdf files using 'sdfopen', but only a few
> > of the variables contained in the files are actually loaded into
> > grads.  There are no error messages when using 'sdfopen'.  'ncdump'
> > shows that many more variables are in the netcdf files than what I get
> > listed using 'q file'.
> >
> > I'm using:
> > GrADS v2.0.a7.1 little-endian readline printim grib2 netcdf hdf4-sds
> > hdf5 geotiff
> > NetCDF interface enabled
> >   netcdf "3.6.2" of May 2 2008 13:36:26
> >
> > And I'm running it on Ubuntu 11.04.
> >
> > Any ideas what the problem may be?  I was worried it was my 'udunits'
> > library for a while, but think that has been resolved.
> >
> > Lisa
> >
>
>
> --
> Lisa Welp
> Carbon Dioxide Research Group
> Scripps Institution of Oceanography
> 9500 Gilman Dr. Mail Box 0244
> La Jolla, CA  92093-0244
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>



-- 
Arlindo da Silva
dasilva at alum.mit.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20111216/71db604e/attachment-0003.html 


More information about the gradsusr mailing list