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.
>To: address@hidden >From: address@hidden >Subject: Re: 20050223: netcdf to ascii >Organization: ORST >Keywords: 200502232324.j1NNOAv2008915, short Hi Nilesh, > I am writing a fortran program to convert netcdf data to ASCII. > my netcdf description for olr > short olr(time, lat, lon) ; > olr:long_name = "Daily OLR" ; > olr:valid_range = 0.f, 500.f ; > olr:actual_range = 64.75f, 344.5f ; > olr:units = "W/m^2" ; > olr:add_offset = 327.65f ; > olr:scale_factor = 0.01f ; > olr:missing_value = 32766s ; > olr:var_desc = "Outgoing Longwave Radiation" ; > olr:precision = 2s ; > olr:dataset = "NOAA Interpolated OLR" ; > olr:level_desc = "Other" ; > olr:statistic = "Mean" ; > olr:parent_stat = "Individual Obs" ; > > So I should read the olr values as integer (is that right). What > does the short mean? And also what does the precision = 2s > mean. Because when i read i get -ve values for the olr, but the > valid range is 0.0 - 500.0. You can either read the olr values as integer, as real, or as double. The netCDF library converts numeric values to the type you request. "short" is the netCDF external (on disk) type for signed 16-bit integers. I'm not sure what "precision = 2s" means, maybe 2 significant digits? Although the valid rnage is 0.0 to 500.0, you have to transform the packed values using the add_offset and scale_factor to get the actual values as floating point numbers, using the formula unpacked_value = add_offset + ((packed_value) * scale_factor) So, for example, an olr value read in as 1000, would actually unpack to the value 327.65 + 1000. * 0.01 or 337.65, which to 2 significant figures would be 340. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu/staff/russ