esm-tools / esm_tools

Simple Infrastructure for Earth System Simulations
https://esm-tools.github.io/
GNU General Public License v2.0
25 stars 12 forks source link

Variables in nested choose blocks cannot be changed from runscript #501

Open seb-wahl opened 2 years ago

seb-wahl commented 2 years ago

Describe the bug Variables in nested choose blocks in e.g. component yamls cannot be changed directly in the runscript. Example I'd like to change the variable global_tag in nemo.yaml (with the relevant parts extracted). nemo.yaml:

global_tag: ""
choose_lresume:
        true:
                nn_msh: 0
                choose_general.run_number:
                        1:
                                global_tag: "_global"

runscript:

nemo:
   global_tag: "_funny_new_tag"

the variable nn_msh: 0 can be changed from the runscript while global_tag does not work To Reproduce Steps to reproduce the behavior: Use runscripts/foci/foci-restart-scenario_run.yaml and try to set global_tag: "_funny_new_tag"

Expected behavior In the final namelist or finished config we should see global_tag: "_funny_new_tag" and not global_tag: "_global". A workaround is to use

choose_lresume:
     true:
       choose_general.run_number:
          1:
             global_tag: "_funny_new_tag"

in the runscript yaml. System (please complete the following information):

seb-wahl commented 2 years ago

You are both right and wrong, Miguel: if I use global_tag: "this_is_funny" it works as expected. If I try to set global_tag: "" it does not. So it looks like the parser does not like to set the default value (which is "") for global_tag. However it works if I use

choose_lresume:
     true:
       choose_general.run_number:
          1:
             global_tag: ""
mandresm commented 2 years ago

I am not going to have time to look at this before my holiday, so I have unassigned from myself, in case @denizural can take over. I think he was also involve in a similar issue not so long ago.

JanStreffing commented 2 years ago

This issue has no one assigned. How high is this on the priority list?

nwieters commented 1 year ago

Hi @seb-wahl, I was able to reproduce the behaviour you described in your last comment (esm_tools, version 6.23.2). As you said, the problem is not to change the value of nested variables, but to set them to "". I recognized that this is true for both nested levels. In your example this means that I couldn't set neither nn_msh nor global_tag to "". Since this issue is rather old, I will label it for now as enhancement. @seb-wahl if you are facing this very often still, please go ahead and label this issue as a bug.