Project

General

Profile

Raising a variable field to the power of another variable field

Added by Sofia Ferdini almost 3 years ago

Hi everyone,

I want to raise a variable field in one file to the power of another variable field in a different file.
I have not found a fitting CDO to do this, so I tried merging the two files and then doing

expr,'var=var1^var2;' infile_containing_var1_and_var2 outfile_containing_new_var

The problem is that the two variables are not the same and they have different timesteps, too. Var1 is monthly data over 30 years and var2 is yearly values over 30 years. So merging the two files produces something whacky with timesteps missing.

Is there a CDO that lets me do arithmetic with two files containing different variables and different no of timesteps (like the YEARARITH operators, where for each time step in file1 the corresping time step of the same year in file2 is used) but for exponentiation?
Or is there any way I can merge the two files and then do it using the expr operator?

Many thanks in advance

Sofia