[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #PUQ-138555]: netcdf nf_get_var_type suspicious behaviour



Hi Mogesh,

> I'm running netcdf-4.0 on Ubuntu Hardy.
> I compiled with Intel Fortran 10.0.
> 
> I wasn't really sure how to search for something like this through the
> support archives.
> 
> I'm currently trying to read data from a netcdf file and am getting
> strange behavior from the nf_get_var_type function.
> 
> I have for example a variable called "zs", which refers to a model surface
> height in meters.  I know this variable's dimensions, how many dimensions
> there are and variable type.  Using nf_inq_var I see the dimensions
> check out as correct.  However I see the variable data type as "short or
> int2". Which is strange, I expected real or "float".  I try reading the
> data into an array (of the correct dimensions) and print out the array.
> I get large numbers, definitely not correct.

Check the attributes of zs, using the ncdump utility.  If it includes attributes

  zs:scale_factor = ...
  zs:add_offset = ...

then that indicates that the values of zs are "packed" to save space.  
Documentation 
of the conventions for packing netCDF data is in the Users Guide here:

  http://www.unidata.ucar.edu/netcdf/docs/netcdf.html#Attribute-Conventions

and also in this section of the netCDF "Best Practices" document:

  
http://www.unidata.ucar.edu/netcdf/docs/BestPractices.html#Packed%20Data%20Values

--Russ


Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: PUQ-138555
Department: Support netCDF
Priority: Normal
Status: Closed