Ways to perform specific tasks using the tools described below.
Replacing Values In-Place in a NetCDF File
Download the ncclamp package from:
and then compile after modifying the location of your NetCDF3 include and library directories in the Makefile.
For example, you can change nan to -9999. in a file via:
ncclamp test.nc u nan -9999. eq
where test.nc is the file, u is the variable, nan is the variable value to be replaced, -9999. is the variable value which will replace it, and eq indicates that the replacement will only be performed if the variable is exactly equal to nan.
Changing a Variable Attribute Value to Another Value
We used the NCO program ncatted to change a variable attribute, e.g.
ncatted -a long_name,T,o,c,temperature in.nc
where the value of the long_name attribute for variable T in file in.nc is changed from its present value to temperature using the overwrite (o) and character value (c) arguments.
Changing a Variable Attribute Name to Another Name
This is a two-step process using the NCO program ncatted. First, you remove the old attribute using:
ncatted -O -a _FillValue,zlev,d,f," " test.nc
Then you insert a new attribute in its place via:
ncatted -O -a missing_value,zlev,c,f,"-9999." test.nc
where the old attribute name _FillValue is swapped out for the new attribute name missing_value for the variable zlev, with the first statement deleting (d) a floating point (f) variable, and the second statement creating (c) that same floating point variable with the value -9999..
NetCDF File Creation
These packages allow you to create NetCDF files.
A Python interface to the netCDF version 4 library that allows files to be written and read.
NetCDF File Manipulation
These packages allow you to modify, combine, extract from, etc. existing NetCDF files.
Climate Data Operators (CDO)
CDO is a large tool set for working on climate and NWP model data. NetCDF 3/4, GRIB 1/2 including SZIP and JPEG compression, EXTRA, SERVICE and IEG are supported as IO-formats. Apart from that CDO can be used to analyse any kind gridded data not related to climate science.
All available as package libcdo here.
Fimex is a the File Interpolation, Manipulation and EXtraction library for gridded geospatial data, written in C/C++. It converts between different, extensible dataformats (currently netcdf, NcML, grib1/2 and felt). It enables you to change the projection and interpolation of scalar and vector grids. It makes it possible to subset the gridded data and to extract only parts of the files.
netcdf-3 >= 3.6
grib API > 1.4
libxml2 >= 2.5.0
boost >= 1.32
proj-4 >= 4.4.9
udunits 1.12.x or >= 2.1x
NetCDF Operators (NCO)
The netCDF Operators (NCO) comprise 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. NCO aids manipulation and analysis of gridded scientific data. The shell-command style of NCO allows users to manipulate and analyze files interactively, or with simple scripts that avoid some overhead (and power) of higher level programming environments.
Requirements described here. Read this section before attempting to compile from source.
NetCDF File Viewing
These packages allow you to graphically view the contents of NetCDF files.
Ncview is a visual browser for netCDF format files. Typically you would use ncview to get a quick and easy, push-button look at your netCDF files. You can view simple movies of the data, view along various dimensions, take a look at the actual data values, change color maps, invert the data, etc.