This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
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