Subsetting Data Sets Using NCO Utilities

Subsetting Data Sets Using NCO Utilities

Postby yiboj » Mon Apr 04, 2016 10:32 am

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: http://nco.sourceforge.net/


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 in.nc (input netCDF file) and write it to out.nc (output netCDF file):

ncea -d lat,-30.0,30.0 -d lon,-180.0,-100.0 in.nc out.nc

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.
yiboj
 
Posts: 130
Joined: Mon Mar 30, 2015 11:22 am

Return to Data Access and Services