Version 2 (modified by nicolasmartin, 3 years ago) (diff)

Data utilities with netcdf

You can find here an example of bash script to manipulate netcdf files (in this example forcing core2 files).

(In this example we extract coordinates and put them in file and then we apply ncpdq to choosen variable).

This is necessary because "npdq" command change all variables, but in this case we don't want to have glamt, gphit, time "short" type.

# remove useless variable from file
ncks -O -x -v 

# exctracting coordinates variables from file, put in output file (
ncks -v glamt,gphit,time

# exctracting variables from file
ncks -O -C -v V_10_MOD

# compress all variables of file,
# now variables of are "short" type
# (add offset and scale factor)
ncpdq -O -C -P all_xst 

# append file to file to have initial file
# with variable V_10_MOD "short" type and coordinates variables unchanged
ncks -A