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.
Andrew, > From: "Andrew MacPherson" <address@hidden> > Subject: ncdump > Organization: ? > Keywords: 200006211430.e5LEUtT08671 netCDF In the above message, you wrote: > I was wondering if there was a way to extract (from binary form to a text > representation) specific 'pieces' of data from a dataset . I know we can > use 'ncdump' to extract data values for specified variables. But what if we > only wanted a subset of all the data from a specific variable. > > For example, if our entire dataset was the following: > > netcdf foo { > dimensions: > lat = 10; > variables: > float lat(lat); > float rh(lat); > data: > lat = 0, 10, 20, 30, 40, 50, 60, 70, 80, 90; > rh = .5, .4, .6, .7, .6, .3, .2, .4, .5, .5; > } > > And this dataset was put into binary form using 'ncgen'. > Now I want to look at the text representation of the data for > the variable 'rh' but only between 'lat' values of 20 to 60. Can this be > done through the netCDF interfaces?? Or do I have to analyze the physical > format of a netCDF file to dig this data out?? There's no way to easily do what you want using the library and utilities that come with the netCDF package. You could, however, use one of the third-party software systems to extract the data of interest into a new netCDF file, and then use the "ncdump" utility to print that file. Information on third-party, netCDF-based software packages (many of which are free) can be found at http://www.unidata.ucar.edu/packages/netcdf/software.html Regards, Steve Emmerson <http://www.unidata.ucar.edu>