简体   繁体   中英

How to multiply variables of a netcdf file with different constants using NCO or CDO?

I have a.netCDF file containing different variables (val1, val2, val3). The names of the variables are indicated, in fact, they are completely different from each other. I want to multiply the variables with different constants such as:

val1*c1 
val2*c2 
val3*c3

How I could do that with NCO or CDO ?

In NCO as decribed here :

ncap2 -s 'val1*=c1;val2*=c2;val3*=c3' in.nc out.nc

In cdo you can use expr in a similar way to nco on each variable.

cdo expr,'val1=val1*c1;val2=val2*c2;val3=val3*c3' in.nc out.nc 

see section 2.7.1 of the cdo manual 1.9.9 for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM