Version 4.6.6 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:
4.6.6 contains a potpurri of new features: Output 2D rectangular grids formatted as UGRID meshes. Calendar dates print for bounds and climatology variables. Revamped HPSS/hsi support. The splitter produces cleaner output. The regridder groks more files and masks, and annotates output with more helpful metadata. CDL mode handles compound record variables. JSON output has changed slightly to re-use NcML keywords. ncclimo and ncremap have new extract/exclude options.
EVERYONE WHO USES NCKS TO PRINT DATA PLEASE READ THIS:
We would like to change the default behavior of ncks
printing.
For 20+ years ncks
has, by default, dumped the text representation
of a file in (what we call) "traditional" mode. ncdump
produces a
format called CDL that is more useful than traditional mode for most
NCO users. ncks
has produced CDL since only 2013 and so CDL is not the
default. ncdump
has always printed CDL very cleanly and clearly there
was little point in making CDL the default for ncks
.
Now ncks
CDL mode rivals ncdump
, and is superior in some ways.
In particular, ncks
now prints times as human-readable calendar dates,
the last ncdump
feature I used that ncks
did not have.
We propose to change the default printed output of ncks
to CDL.
Then one would type simply "ncks
" instead of "ncks --cdl
".
A new "--trd
" option would still print traditional output.
Let us know if this bothers or pleases you prior to 4.6.7.
New Features
-
ncremap
andncclimo
support new extract/exclude switches:
--no_cll_msr
: Exclude cell_measures variables
--no_frm_trm
: Exclude formula_terms variables
--no_ntv_tms
: Exclude native-grid timeseries (splitter only)
--no_stg_grd
: Exclude staggered grid coordinates
By default, these variables are always extracted. Use the above switches to exclude them instead, e.g.,ncclimo --no_cll_msr --no_frm_trm --no_ntv_tms --no_stg_grd ...
http://nco.sf.net/nco.html#no_cll_msr
http://nco.sf.net/nco.html#no_frm_trm
http://nco.sf.net/nco.html#no_ntv_tms
http://nco.sf.net/nco.html#no_stg_grd -
ncclimo
's splitter mode no longer requires variable lists. Previously the splitter required a '-v var_lst
' option to know which variables to split into timeseries. Now when the-v
option is omitted the splitter creates timeseries of all variables of rank R ≥ 2. Typically this includes all spatial variables. Variables known to be extensive (like grid properties) are automatically excluded from this list. However, we expect there will be some cases where the splitter creates timeseries from R ≥ 2 variables that are not desirable. We are happy to encode manual exceptions as we receive notice of them.ncclimo -s 1979 -e 1981 -o $drc_out in*.nc
http://nco.sf.net/nco.html#ncclimo -
The regridder now produces UGRID output for 2D rectangular grids.
Invoke
ncremap
in grid inferral mode with "--rgr ugrid=foo.nc
" and voilà, an annoted UGRID file is produced along with the default SCRIP gridfile. The NCO UGRID is more complete than that produced byESMF_Scrip2Unstruct
, but ESMF can create UGRID for much more comlex grids. The NCO regridder can currently only generate UGRID for rectangular 2D input grids, and there are no plans to extend this to curvilinear or unstructured input grids.ncks --rgr nfr=Y --rgr grid=scrip.nc --rgr ugrid=ugrid.nc in.nc out.nc
http://nco.sf.net/nco.html#rgr -
ncks
now prints the units, if any, in comments after CDL values when debugging is enabled withdbg_lvl
≥ 1:$ ncks --cdl -D 1 in.nc lat = -90, 90 ; // units="degrees_north" lon = 0, 90, 180, 270 ; // units="degrees_east" tpt = 273.1, 273.2, ... 274 ; // units="kelvin"
http://nco.sf.net/nco.html#cdl -
ncap2
now implements the CFcell_methods
convention.ncra
,nces
, andncwa
have long implemented this, and now the relevantncap2
methods (avg, min, max, etc.) record the operation type in thecell_methods
attribute.ncap2 -s 'avg=one_dmn_rec_var.avg()' ~/nco/data/in.nc ~/foo.nc
http://nco.sf.net/nco.html#cll_mth -
Since 4.6.5
ncks
has printed the human-legible calendar string corresponding to values with UDUnits date units (time since basetime, e.g., "days since 2000-01-01") and CF calendar attribute, if any. Nowncks
also translates and prints time values associated with CF climatology and bounds variables as human legible dates. As before, enact this with the--calendar
option when printing. Usingdbg_lvl
≥ 1 in CDL mode prints both the value and calendar string (one in comments):$ ncks -D 1 --cdl --cal -v tm_365 ~/nco/data/in.nc tm_365 = "2013-03-01"; // double value: 59 $ ncks -D 1 --cdl -v tm_365 ~/nco/data/in.nc tm_365 = 59; // calendar format: "2013-03-01"
This option is similar to the ncdump -t option. Does this work how you'd like? Let us know.
http://nco.sf.net/nco.html#cal -
ncks
now prints "(no units)
" instead of "(null)
" as the units string for variables with no units. And in CDL modencks
, when invoked with debugging (e.g.,-D 1
) prints the units string in the comment section after the values of a variable.
Additional details are available in the ChangeLog.