Version 4.5.1 of the netCDF Operators (NCO) has been released. NCO is an Open Source package that consists of a dozen standalone, command-line programs that take netCDF files as input, then operate (e.g., derive new data, average, print, hyperslab, manipulate metadata) and output the results to screen or files in text, binary, or netCDF formats.
The NCO project is coordinated by Professor Charlie Zender of the Department of Earth System Science, University of California, Irvine. More information about the project, along with binary and source downloads, are available on the SourceForge project page.
From the release message:
This release improves regridding features, ncra weighting, and ncatted flexibility, and contains a raft of minor fixes and tunings. Notably, most implementation-specific dimension/variable names involved in regridding can be specified at the command line, and the regridder understands mapfiles generated by TempestRemap. ncra can now weight records by a 1-D record variable in the file. And ncatted supports regular expressions in both the variable name AND the attribute name (simultaneously, too).
New Features
-
Regrid global datasets with TempestRemap mapfiles (in addition to
ESMF and SCRIP, which were already supported). Tempest mapfiles
use slightly different conventions than the other two, and this
release accounts for those differences. This capability makes
NCO's regridder a drop-in replacement for the Tempest program
ApplyOfflineMap with global (source and destination) maps.
The two produce the same results, modulo metadata.
Please give it a try and send us feedback!
# Regrid entire file, same output format as input: ncks --map=map.nc in.nc out.nc # Deflated netCDF4 output, threading, selected variables: ncks -4 -L 1 -t 8 -v FS.?,T --map=map.nc in.nc out.nc
http://nco.sf.net/nco.html#regrid -
ncatted
now supports regular expressions in both the variable name AND the attribute name (simultaneously, too). Previously,ncatted
accepted regular expressions only in the variable name. The new functionality simplifies sculpting metadata topiary from files with baroque metadata annotations, since whole groups of attributes may now be added/modified/deleted with a single command. For example, delete all attributes whose names end in "_iso19115" from all variables whose names contain "H2O".
ncatted -a '.?_iso19115$','^H2O*',d,, in.nc
http://nco.sf.net/nco.html#ncatted -
Add
mibs/mabs/mebs
methods and operators toncap2
. These are the absolute-value analogues ofmin/max/mean
, so that, e.g.,mibs() returns the minimum absolute-value of the operand.
tpt_max=temperature.max(); tpt_max=max(temperature); tpt_mabs=temperature.mabs(); tpt_mabs=mabs(temperature);
http://nco.sf.net/nco.html#mibs
http://nco.sf.net/nco.html#ppc
http://nco.sf.net/nco.html#ncap2 -
Prevent operators from repeating existing cell_methods attribute.
Previously NCO would append new operations, e.g., "time: mean" to
the existing cell_methods attribute, if any. Now it first checks
to see whether that method has been applied and, if so, declines
to write a duplicate operation.
http://nco.sf.net/nco.html#cll_mth
Additional details are available in the ChangeLog.