Project

General

Profile

Help with pow expression

Added by John Young 16 days ago

I have 2 netcdf files

nc1="day01.nc", variable = pr_bc
nc2="exponent.nc", variable = b1
out="result.nc"

basically I want to be able to do result=nc1^nc2 i.e. pr_bc^b1

how would i do this in cdo, currently running cdo 2.0.5, gdal 3.8.3

to test I did
cdo -O expr,"result=pr_bc^100;" $nc1 $out ........... this worked

then tested
cdo -O expr,"result=pr_br^b1;" $nc1 $nc2 $out ......... this fails

then tested
cdo -O expr,"result=pr_br^$nc2;" $nc1 $out ............. this fails

help would be greatly appreciated


Replies (1)

RE: Help with pow expression - Added by Uwe Schulzweida 3 days ago

The CDO operator expr accepts only one inputfile. So, you have to merge both file:

cdo expr,'result=pr_br^b1' -merge day01.nc exponent.nc  result.nc

    (1-1/1)