trouble reading netcdf file with pack_nbits=12

Don Hooper hoop at COLORADO.EDU
Tue Mar 27 18:22:42 EDT 2007


Jim,

What the heck version of NetCDF supports that stuff anyway?

-Hoop
> From owner-gradsusr at LIST.CINECA.IT  Tue Mar 27 16:16:00 2007
>
> Greetings all:
>
> I have a netcdf file containing model output that I wish to read using
> GrADS.  The output from ncdump is included below.  Since the (x,y)
> coordinates are irregular I need to use a GrADS control file.  With such
> a control file, the file gets opened, but the displayed values are not
> correct (salinity range should be about 30 to 38).  I suspect the
> problem is with the packed bits at 12.  Can anyone confirm this, or
> better yet, suggest a solution?  Thanks in advance,
>
> Jim
>
> -----------------------------------------------------------------------------------------------------------------
> ncdump:
> netcdf ncom1 {
> dimensions:
>         X_Index = 291 ;
>         Y_Index = 196 ;
>         level = 40 ;
> variables:
>         float X_Index(X_Index) ;
>                 X_Index:long_name = "X_Index" ;
>                 X_Index:units = "none" ;
>                 X_Index:FORTRAN_format = "i5" ;
>         float Y_Index(Y_Index) ;
>                 Y_Index:long_name = "Y_Index" ;
>                 Y_Index:units = "none" ;
>                 Y_Index:FORTRAN_format = "i5" ;
>         float level(level) ;
>                 level:long_name = "level" ;
>                 level:units = "none" ;
>                 level:FORTRAN_format = "i5" ;
>         float Salinity(level, Y_Index, X_Index) ;
>                 Salinity:_FillValue = -1.e+34f ;
>                 Salinity:missing_value = -1.e+34f ;
>                 Salinity:valid_range = 33.01075f, 35.41651f ;
>                 Salinity:long_name = "Salinity" ;
>                 Salinity:units = "PSU" ;
>                 Salinity:FORTRAN_format = "e13.6" ;
>                 Salinity:coordinate_system =
> "index_space_for_irregular_grid" ;
>                 Salinity:dtgymd = 20070320 ;
>                 Salinity:dtghms = 0 ;
>                 Salinity:pack_nbits = 12 ;
>                 Salinity:pack_valid_range = 4.960597e-43f, 41.5623f ;
>                 Salinity:pack_min = 0.3415304f, 0.3402182f, 0.3386948f,
> 0.3370589f, 0.3353713f, 0.3336847f, 0.3320321f, 0.3304273f, 0.3288694f,
> 0.3273478f, 0.3258449f, 0.3243393f, 0.3228098f, 0.3212448f, 0.3196575f,
> 0.3181004f, 0.3166694f, 0.3154577f, 0.3146982f, 11.44224f, 12.32387f,
> 12.78005f, 13.60599f, 13.59866f, 21.76299f, 21.88346f, 21.98833f,
> 22.0575f, 22.13341f, 22.20853f, 22.28337f, 22.32251f, 22.32767f,
> 22.3273f, 22.32697f, 34.07007f, 34.07137f, 4.960597e-43f, 34.47794f,
> 4.960597e-43f ;
>                 Salinity:pack_max = 41.5623f, 41.56229f, 41.56228f,
> 41.56227f, 41.56226f, 41.56224f, 41.56224f, 41.56224f, 41.56223f,
> 41.56222f, 41.56221f, 41.56221f, 41.56221f, 41.56221f, 41.56221f,
> 41.56221f, 41.56221f, 41.56221f, 41.56222f, 40.43718f, 40.50313f,
> 40.52974f, 40.55785f, 40.60667f, 40.62259f, 40.63385f, 40.66891f,
> 40.66811f, 40.74745f, 40.66326f, 40.62242f, 40.61849f, 40.61818f,
> 40.61217f, 40.58677f, 38.77753f, 38.75911f, 38.82295f, 38.82051f,
> 35.00489f ;
>                 Salinity:pack_FillValue = -1.e+34f ;
>                 Salinity:last_program_run = "regrid_gen from MODAS2" ;
>                 Salinity:date_of_last_change = "Thu Mar 22 18:55:21 2007" ;
> }
> -----------------------------------------------------------------------------------------------------------------
> sample control file:
> ncom1.ctl
> lii 33% cat ncom1.ctl
> DSET ^ncom1.nc
> DTYPE netcdf
> UNDEF -1.0e+34 missing_value
> *UNPACK scale_factor add_offset
> UNPACK 12 pack_nbits
> TITLE NCOM
> XDEF 291 levels 169.614, ... (edited for this email)...., 220.59
> YDEF 196 levels 9.796, ... (edited for this email)....,  40.335
> ZDEF 40 levels -0.5, -1.594905, -2.897632, -4.44763, -6.291831,
> -8.48608, -11.09682,
> -14.2031, -17.89898, -22.29637, -27.52843, -33.75358, -41.16032,
> -49.97294, -60.45827,
> -72.93381, -87.77733, -105.4383, -126.4515, -151.4531, -181.2003,
> -216.5939, -258.7054,
> -308.8101, -368.4251, -439.3557, -523.7495, -624.162, -743.6338,
> -885.7824, -1054.912,
> -1256.144, -1495.572, -1780.446, -2119.391, -2522.671, -3002.498,
> -3573.4, -4252.665, -5060.868
> TDEF 1 linear 20mar2007 1dy
> VARS 1
> Salinity=>salt 40 t,z,y,x Salinity
> ENDVARS
> -----------------------------------------------------------------------------------------------------------------
> my grads info:
>
> Config: v1.9b4 32-bit little-endian readline sdf/xdf netcdf dods
> dods-stn lats printim
>
> Grid Analysis and Display System (GrADS) Version 1.9b4
> Copyright (c) 1988-2005 by Brian Doty and IGES
> Center for Ocean-Land-Atmosphere Studies (COLA)
> Institute for Global Environment and Society (IGES)
> This program is distributed WITHOUT ANY WARRANTY
> See file COPYRIGHT for more information.
>
> Built Mon May 23 13:17:11 EDT 2005 for i686-pc-linux-gnu
>
> This version of GrADS has been configured with the following options:
>
>    o This is a 32-bit LITTLE ENDIAN machine version.
>    o Command line editing (readline) ENABLED.
>    o CIRES/CDC (http://www.cdc.noaa.gov) SDF/XDF interface ENABLED.
>      Use sdfopen/xdfopen to read NetCDF files.
>    o DTYPE netcdf is ENABLED; DTYPE hdfsds is DISABLED.
>    o OPeNDAP (a.k.a. DODS) gridded data interface ENABLED.
> (http://opendap.org)
>      This version is configured to access gridded data on OPeNDAP servers
>      via the sdfopen or xdfopen commands, or using DTYPE netcdf.
>    o OPeNDAP (a.k.a. DODS) station data interface (gadods) ENABLED.
>      This version is configured to access station data on OPeNDAP servers
>      via the open command.
>    o PCMDI (http://www-pcmdi.llnl.gov) LATS interface ENABLED.
>      This version is configured to write GRIB and NetCDF files.
>    o DAO (http://dao.gsfc.nasa.gov) Athena Widget GUI DISABLED.
>    o NRL/DAO/PCMDI XA or ImageMagick Image Output DISABLED.
>    o printim command for direct png/gif output ENABLED.
>      (via the GD Library -- http://www.boutell.com/gd)
>
> For additional information please consult http://grads.iges.org/grads/



More information about the gradsusr mailing list