NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Peter Several NCO functions can do the classic float->short (packing) and short->float (unpacking) conversions, with the scale_factor and add_offset calculated from the min and max data values (or the expected data range): http://nco.sourceforge.net/nco.html#Packed-data Specifically, ncap2 has pack() and unpack() functions: http://nco.sourceforge.net/nco.html#Methods-and-functions In my experience packing/unpacking is fine in many cases, but can be problematic with variables that have a wide dynamic range, covering several orders of magnitude, such as specific humidity, tracer and chemical species concentration, etc, as the important/relevant detail may be squeezed into a few or a single compressed value. In these cases, a possible workaround would be to apply a logarithm function beforehand (for positive variables), and store the short_variable=packed(ln(float_variable)),but also remember to apply an exponential when unpacking float_variable=exp(unpack(short_variable)).
NcView (with --minmax all) shows the minimum and maximum values of each variable, but other tools such as NCL can be used for that as well. I hope this helps, Gus Correa On 01/18/2018 12:23 PM, Pete Pokrandt wrote:
NetCDFers,Got the following question from one of our scientists (Mike Notaro, mnotaro@xxxxxxxx, cc'd). Any ideas?Does anyone know of an efficient (hopefully command line) method to convert an entire netcdf file (and all of its float variables) to short integers? Thanks, Pete <http://www.weather.com/tv/shows/wx-geeks/video/the-incredible-shrinking-cold-pool>-- Pete Pokrandt - Systems Programmer UW-Madison Dept of Atmospheric and Oceanic Sciences 608-262-3086 - poker@xxxxxxxxxxxx _______________________________________________ NOTE: All exchanges posted to Unidata maintained email lists are recorded in the Unidata inquiry tracking system and made publicly available through the web. Users who post to any of the lists we maintain are reminded to remove any personal information that they do not want to be made public. netcdfgroup mailing list netcdfgroup@xxxxxxxxxxxxxxxx For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/
netcdfgroup
archives: