Project

General

Profile

Unable to use arithmetic functions with one argument having only one variable

Added by Frederic Laliberte almost 13 years ago

Hi,

I am using ERA-Interim 4x daily data on model levels to create a nc file:
cdo -f nc -t ecmwf -selvar,T,Q,LNSP -mergetime ei.oper.an.ml.regn128sc.198901* temp.nc

Then I would like to multiply T and Q by Q:
cdo mul -selzaxis,hybrid temp.nc -selname,Q temp.nc product.nc

but cdo fails with an error saying that the two inputs should have the same number of variables.

The doc file however suggests that one of the two input files can contain only one field:
"This module performs simple arithmetic of two datasets. The number of fields in ifile1 should be the same as in ifile2. One of the input files can contain only one time step or one field. The fields in ofile inherit the meta data from ifile1 or ifile2."

The two files I am trying to multiply have four time steps, one has two fields and the other has one field. Could it be that the documentation should instead state:
"This module performs simple arithmetic of two datasets. The number of fields in ifile1 should be the same as in ifile2. One of the input files can contain only one time step, in which case it can either contain the same number of fields as in the other file or contain exactly one field. The fields in ofile inherit the meta data from ifile1 or ifile2." ?

Thanks,
Frederic
p.s. I use cdo 1.4.7 on OS X 10.6


Replies (1)

RE: Unable to use arithmetic functions with one argument having only one variable - Added by Uwe Schulzweida almost 13 years ago

Hi Frederic,

"one field" in this context means a horizontal slice of a variable (one level) and only for one time step.
The CDO operator expr is much more powerful for such tasks:

cdo expr,'T=T*Q;Q=Q*Q;' temp.nc  product.nc
By the way we have also a more powerful operator to select variables from multiple inputfiles:
cdo select,name=T,Q,LNSP ei.oper.an.ml.regn128sc.198901* temp.nc
In this example the inputfiles have to be alphanumeric sorted time slices. The documentation of the operator select is still in process.

Best regards,
Uwe

    (1-1/1)