Skip to content

Instantly share code, notes, and snippets.

@chrisb13
Created January 28, 2017 03:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisb13/d18a950a4f38e5b0d1b87fbe56ff36ca to your computer and use it in GitHub Desktop.
Save chrisb13/d18a950a4f38e5b0d1b87fbe56ff36ca to your computer and use it in GitHub Desktop.
List of handy one-liners for NCO and CDO
snippet cdo
###########################################################################
# CDO #
###########################################################################
#extract a time
cdo seltimestep,1,2,5 cordex24_CURLFX-FLUXFCE_3h_20040101_20041231_grid_U_2D.nc test.nc
#do simple arithmatic
cdo expr,'sum=qsr+qns-qt' cordex24_CURLFX-FLUXFCE_3h_19980101_19981231_grid_T_2D.nc ofile.nc
#change a variable name
cdo chname,time_average_3h,time_counter sum.nc sum2.nc
#add two files together
cdo enssum ERAI_high_500/cordex24_CURLFX-FLUXFCE_3h_19970101_19971231_grid_U_2D.nc ERAI_low_500/cordex24_CURLFX-FLUXFCE_3h_19970101_19971231_grid_U_2D.nc sum.nc
endsnippet
snippet nco
###########################################################################
# NCO #
###########################################################################
#extract a variable
ncks -v SST in.nc out.nc
endsnippet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment