NetCDF operators (NCO) version 5.3.0
Version 5.3.0 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:
Version 5.3.0 significantly improves the unpacking of ELM/CLM/CTSM history and restart datasets, and seems complete in this regard. ncrcat has more friendly behavior when appending, and ncclimo now outputs more metrics (such as valid area per gridcell) when in regional statistics mode. This release many be skipped if these changes do not interest you.
New Features
Once again,
ncksleveled-up how it unpacks ELM/CLM history/restart files. New features include automatic writing of fractional landunit and fractional column variablesfrc_landunitandfrc_column, respectivly.frc_landunitis equivalent to the variablePCT_LANDUNITsometimes placed in history files, but is expressed as a decimal fraction (not a percent) and is derived from restart files. The landunit dimension offrc_landunitis of size ten: Index zero contains the sum (should be 1.0) of standard landunit types/indexes 1-9 soil, crop, ..., urban medium density).frc_columnis a bespoke version of the same, only for column (not landunit) types. For datasets with Multiple Elevation Classes (MECs): index = 0 is soil column, index = 1 is MEC == 1, indexes 2..10 are remaining MEC columns, index 11 is sub-total of MEC columns, index = 12 is deep lake column, index = 13 is wetland column, and index = 14 is grand total of natural columns. For non-MEC datasets, index = 0 is soil column, index = 1 is glaciated column, index = 2 is deep lake column, index = 3 is wetland column, and index = 4 is grand total of natural columns.ncks --s1d --hrz=history.nc restart.nc s1d_r05.nc # Restart file ncks -m -v frc.? s1d_r05.nc netcdf s1d_r05 { dimensions: column = 15 ; landunit = 10 ; lat = 360 ; lon = 720 ; variables: float frc_column(column,lat,lon) ; float frc_landunit(landunit,lat,lon) ; }https://nco.sf.net/nco.html#s1d
https://nco.sf.net/nco.html#unpack_sparsenckscan now grid snow-related variables into a top-down (ocean-like) vertical grid that many think is more intuitive. By default ELM/CLM/CTSM store the negative of the number of active snow layers in the variable SNLSNO. Restart files for these models store the active snow layer butted-up against the lowest layers in the level dimension (so that they are continguous with soil layers to simplify hydrologic calculations). This makes snow variables in restart files hard to visualize. By default S1D now uses SNLSNO, if present, to unpack snow variables in a first layer downwards order, increasing with depth. Inactive layers at the bottom (i.e., where they reside physically). The resulting snow variables appear like ocean state variables over uneven bathymetry, with missing value underneath. We call this 'snow-ocean' ordering to contrast it with the on-disk storage order of snow variables.
https://nco.sf.net/nco.html#s1d
https://nco.sf.net/nco.html#snw_ocn
https://nco.sf.net/nco.html#snw_rdr
https://nco.sf.net/nco.html#no_snw_ocnncksS1D now accepts the '--rgr lut_out=$lut_out' option to specify which column type(s) to place in each gridcell in the output file. The argumentlut_outis the standard landunit type of the column, with (thus far) two additional values that will output area-weighted averages of multiple landunit types:lut_out Output will be value of column(s) in this Landunit 1 Vegetated or bare soil 2 Crop 3 Landice (plain, no MEC) 4 Landice multiple elevation classes 5 Deep lake 6 Wetland 7 Urban tall building district 8 Urban high density 9 Urban medium density 10 Area-weighted average of all landunit types except MEC glaciers 13 Area-weighted average of soil+(non-MEC) glacier
For example,
ncks --s1d --rgr lut_out=1 --hrz=hst.nc rst.nc s1d.nc # Output Soil LUT ncks --s1d --rgr lut_out=13 --hrz=hst.nc rst.nc s1d.nc # Avg Soil+Glacier
https://nco.sf.net/nco.html#s1d
https://nco.sf.net/nco.html#lut_outncremapalways warns when it regrids land model files that contain a 'landfrac' variable and SGS renormalization is not requested. This is because ELM/CLM/CTSM use 'landfrac' for sub-gridscale fraction, and ignoring that causes errors along coastlines. EAMxx also archives that same 'landfrac' but every EAMxx variable is valid throughout every gridcell so renormalization would be superfluous at best. Nowncremapno longer emits the 'landfrac' WARNING for EAMxx files.
https://nco.sf.net/nco.html#eamxxAs of NCO version 5.3.0 (December, 2025)
ncclimoautomatically outputs additional metrics with global statistics. The output files containing the global timeseries also contain the variablevalid_area_per_gridcell. This field is equivalent to the product of the area variable and the sgs_frc variable (if any). Thus for ELM/CLM/CTSM, this field equals area times landfrac, while for EAM/CAM this variable simply equals area. The output files also contain the area and sgs_frc variables separately. The presence of these variables in output allows downstream processors (e.g., zppy) to generate additional masks and weights for rescaling the statistics. For example, these fields can be used to rescale global sums into any units desired.ncclimo -P elm --split --rgn_stt=sum -c v3.LR.piControl -s 460 -e 461 \ --drc_in=drc_in --drc_out=drc_outhttps://nco.sf.net/nco.html#glb_stt
https://nco.sf.net/nco.html#rgn_stt
Additional details are available in the ChangeLog.
Add new comment