Project

General

Profile

CDO expr

Added by Graham Rye over 10 years ago

I have a grib file with 10m u- and v-components of wind, with one value per day for a month. I would like to use the expr function to calculate wind speed but am getting an error;

cdo expr,'ws=sqrt(10U*10U+10V*10V)' wind.grib out.grib
syntax error

cdo expr (Abort): No output variable found!

I am using CDOv1.5.6.1 but have also tried v1.6.2rc2 and get the same error.

Digging around in the source code also showed that there are aexpr / aexprf commands which look like they should append to the input file but that gives;

cdo aexpr,'ws=sqrt(10U*10U+10V*10V)' wind.grib

Error (cdo aexpr) : Too few streams specified! Operator needs 1 input and 1 output streams.

Any help would be much appreciated.

Thanks,

Graham


Replies (2)

RE: CDO expr - Added by Uwe Schulzweida over 10 years ago

Variables have to start with an alphabetic character. You have to change the names if the variables start with a number:

cdo expr,'ws=sqrt(U10*U10+V10*V10)' -chname,10U,U10,10V,V10 wind.grib out.grib

RE: CDO expr - Added by Graham Rye over 10 years ago

Thanks for the reply. Unfortunately that didn't work either. However, using;

cdo showname wind.grib

I discovered that although wgrib was reporting the variable names as 10U and 10V, cdo returns var165 and var166. Substituting these variables names into the expr command worked.

Thanks for your help,

Graham

    (1-2/2)