Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support intermediate expr variables #551

Open
goord opened this issue Nov 22, 2019 · 1 comment
Open

Support intermediate expr variables #551

goord opened this issue Nov 22, 2019 · 1 comment
Assignees

Comments

@goord
Copy link
Collaborator

goord commented Nov 22, 2019

Many soil-related expressions are much more readable if we would support intermediate variables, e.g. mrsow

(var39 * 0.07 + var40 * 0.21 + var41 * 0.72 + var42 * 1.89 - th_wilt) / (th_sat - th_wilt)

where

th_wilt = (var43==1)*0.059+(var43==2)*0.151+(var43==3)*0.133+(var43==4)*0.279+(var43==5)*0.335+(var43==6)*0.267+(var43==7)*0.171)

and

th_sat = ((var43==1)*0.403+(var43==2)*0.439+(var43==3)*0.430+(var43==4)*0.520+(var43==5)*0.614+(var43==6)*0.766+(var43==7)*0.472)

Given the length of the above expressions, it would be really convenient to be able to write in the ifspar.json

"expr" : "(var39 * 0.07 + var40 * 0.21 + var41 * 0.72 + var42 * 1.89 - th_wilt) / (th_sat - th_wilt); th_wilt = ... ; th_sat = ..."

which should by ece2cmor3 be translated to the cdo command

cdo -expr,"var46 = (var39 * 0.07 + var40 * 0.21 + var41 * 0.72 + var42 * 1.89 - th_wilt) / (th_sat - th_wilt)" -aexpr,"th_wilt=..." -aexpr,"th_sat=..."
@goord goord self-assigned this Nov 22, 2019
@klauswyser
Copy link
Collaborator

Very good suggestion! Hope you can make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants