Project

General

Profile

Error with cdo mul

Added by david moreno over 1 year ago

Hi all,

I have 32 files, all with the same dimensions (lat,lon,time) and with the following names:

inlev_000001.nc
inlev_000002.nc
inlev_000003.nc
inlev_000004.nc
inlev_000005.nc
inlev_000006.nc
inlev_000007.nc
inlev_000008.nc
inlev_000009.nc
inlev_000010.nc
inlev_000011.nc
inlev_000012.nc
inlev_000013.nc
inlev_000014.nc
inlev_000015.nc
inlev_000016.nc
inlev_000017.nc
inlev_000018.nc
inlev_000019.nc
inlev_000020.nc
inlev_000021.nc
inlev_000022.nc
inlev_000023.nc
inlev_000024.nc
inlev_000025.nc
inlev_000026.nc
inlev_000027.nc
inlev_000028.nc
inlev_000029.nc
inlev_000030.nc
inlev_000031.nc
inlev_000032.nc

I'm trying to multiply all of them with cdo mul, but I'm having the following error:

cdo mul inlev_0000* out.nc

cdo (Abort): Unprocessed Input, could not process all Operators/Files

Any help please?


Replies (1)

RE: Error with cdo mul - Added by Ralf Mueller over 1 year ago

hi!

the operator mul only takes 2 input arguments. you have to create a for loop to generate the proper commandline. maybe like this

lastfile="inlev_000032.nc" 
cmd="cdo " 
for file on inlev_*.nc; do
  [[ "${lastfile}" = "${file}" ]] && break
  cmd="${cmd} -mul ${file}" 
done
${cmd} ${lastfile}.nc output.nc
    (1-1/1)