Page 1 of 1

Subsetting Data Sets Using NCO Utilities

PostPosted: Mon Apr 04, 2016 10:32 am
by yiboj
The NCO (netCDF Operators) utilities are a set of powerful command line tools for manipulating and analyzing netCDF (including HDF5) files. They can be used to subset, aggregate and modify data and metadata stored in netCDF. If the NCO utilities are not installed on your computer they can be found here:

Most PO.DAAC Level 4 datasets are global. One may wish to subset data files if only interested in regional areas such as the Eastern Equatorial Pacific. The following NCO example can be used to extract the data from (input netCDF file) and write it to (output netCDF file):

ncea -d lat,-30.0,30.0 -d lon,-180.0,-100.0

Make sure to use decimal points for the coordinate bounds or else you may get unexpected results. Also you may want to check your lat/long bounds before repeating this process for other datasets; not all datasets use the same bounds. The bound information can be found in the coordinate information in the netCDF file under the lat(latitude) and lon(longitude) variables. Both variables often have attributes valid_min and valid_max. Alternatively in the global metadata one may find attributes geospatial_lat_min, geospatial_lat_max, geospatial_lon_min, geospatial_lon_max.