NCKS

Ncks - or nc kitchen sink - is probably the most useful of the NCO operators. You can use it to extract a variable from a file, or to extract multiple variables, or to get variables at certain times or geographical areas. It's especially helpful for when you are moving files from NCAR to CCR. You can extract just the variables you want, making the file sizes much smaller and more manageable.

EXAMPLE:

Extract a single variable from a netCDF file:ncks -v PRECTMM,PSLEVMB,CLOUD GEN2AGCM-CONB-MONE0509.nc GEN2AGCM-CONB-SEAE0509.3vars.nc

EXAMPLE:

Extract a single variable from a netCDF file for the month of June from a mone file.

Note: NCO counts from zero. To count from one, use the -F flag in any operation.ncks -d time,5 -v PRECTMM GEN2AGCM-CONB-MONE0509.nc GEN2AGCM-CONB-MONE0509.prectmm.may.nc

You would get the same result using the following:ncks -F -d time,6 -v PRECTMM GEN2AGCM-CONB-MONE0509.nc GEN2AGCM-CONB-MONE0509.prectmm.may.nc