Project

General

Profile

about multiplying some range value in netcdf file by some constant numbers using cdo software

Added by yared demeke over 4 years ago

Dear all!

I have one variable in netcdf file format so, I want to multiply some value above mean by constant number (Constant number 1) and also multiplying some value below mean by another constant number (Constant number 2) using Cdo software. My question is, how to make this? Any ideas please?
for example I want to multiply data value < 0.7 by 1.8 and the data value > 3.7 by 4.5

Yare


Replies (4)

RE: about multiplying some range value in netcdf file by some constant numbers using cdo software - Added by Ralf Mueller over 4 years ago

hi yared!

you could use the expr operators like this

cdo -f nc  -expr,'topo=(topo<0)?topo*100000.0:((topo>0)?topo*999:topo)' -topo tt.nc
Here is use topo for input (and variable name)

hth
ralf

RE: about multiplying some range value in netcdf file by some constant numbers using cdo software - Added by Ralf Mueller over 4 years ago

or with your number:

cdo -f nc  -expr,'topo=(topo<0.7)?topo*1.8:((topo>3.7)?topo*4.5:topo)' -topo tt.nc

RE: about multiplying some range value in netcdf file by some constant numbers using cdo software - Added by yared demeke over 4 years ago

Ralf Mueller wrote:

or with your number:
[...]

Dear Ralf
Thank you for your immediate respond!
But I need addition support based on this

My data is surface minimum air temperature tmin.nc and variable name is tmin_adj so, according to this information:-

cdo -f nc -expr,'topo=( tmin_adj<0.7)? tmin_adj*1.8:(( tmin_adj>3.7)? tmin_adj*4.5: tmin_adj)' tmin.nc tminoutput.nc

Is this expr true? Please help me. I tried this but cdo says

At line:1 char:18
+ ./cdo -f nc -expr,'topo=(tmax_adj<0.7)?tmax_adj*3.8:((tmax_adj>3.7)?t ...
+ ~
Missing argument in parameter list.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingArgument

    (1-4/4)