• Handling netcdf file format

This page contains simple commands that I use to handle NetCDF data in different tools. This page will be updated as I will stumble upon on to new commands:

(1) Bash commands:

See data that nc file contains: ncdump

See only header of the data: ncdump -c (great for if you only want see the file information)

Compress nc data by removing unlimited time dimension and make file smaller: nccopy -u -s -d6

(2) CDO:

Concatenate all nc files in a directory: cdo cat *.nc

Shift Longitude of data from 0:360 to -180:180: cdo sellonlatbox,-180,180,-90,90

Convert grib to nc: cdo -f nc copy file.grb

Merge datasets with the same number of timesteps and different variables in each dataset: cdo merge

Convert variable ts by subtraction from K to C: cdo expr,’var1=ts-273.15;’