Project

General

Profile

Selection of multiple variables from multiple netcdf files

Added by saurabh rathore over 3 years ago

Dear All,
G'day

I am having multiple .nc files 1.nc 2.nc 3.nc etc. with variables (T1, S1), (T2, S2), (T3, S3) in 1.nc, 2.nc and 3.nc respectively. I want to select T1, T2, and T3 variables only from all these .nc files so how to do it?

I am using CDO version 1.9.8.

Cheers, Saurabh


Replies (1)

RE: Selection of multiple variables from multiple netcdf files - Added by Karin Meier-Fleischer over 3 years ago

Hi Saurabh,

you can use the apply operator with selname to retrieve the variables and write them to one output file.

For example (CDO version 1.9.9) the files in1.nc, in2.nc, in3.nc (don't name it 1.nc, 2.nc, etc.) are stored in the same directory

cdo -cat -apply,-selname,T1,T2,T3 [ in*.nc ] outfile.nc

-Karin

    (1-1/1)