CMEPS icon indicating copy to clipboard operation
CMEPS copied to clipboard

Problem with OCN2WAV_SMAPNAME and WAV2OCN_SMAPNAME in cmeps1.0.19 and following for F compsets if you update cmeps after case created

Open ekluzek opened this issue 1 year ago • 12 comments

I found this in a CAM checkout of cam6_4_032 with CMEPS updated to cmeps1.0.20 which is what's being used in cesm3_0_alpha03d. I updated the other submodules to the cesm3_0_alpha03d submodules so everything should be consistent.

The test SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s_waccm_ma_mam4 fails at preview_namelist time in the namelist build of the cmeps namelist as follows, because it's expecting that OCN2WAV_SMAPNAME and WAV2OCN_SMAPNAME will be an XML variable in the case -- and it's not provided for a compset with SWAV.

So I'd expect this to fail with any compset with SWAV. Since, we aren't seeing this problem in cesm3_0_alpha03d testing -- I'm not sure why this shows up here.

  Calling /glade/derecho/scratch/erik/cam6_4_032/cime/CIME/non_py/src/components/stub_comps_nuopc/sesp/cime_config/buildnml
  2024-10-01 15:25:39 cpl 
Create namelist for component drv
   Calling /glade/derecho/scratch/erik/cam6_4_032/components/cmeps/cime_config/buildnml
Namelist default for variable ocn2wav_smapname refers to unknown XML variable OCN2WAV_SMAPNAME.
Traceback (most recent call last):
  File "/glade/derecho/scratch/erik/cam6_4_032/cime/scripts/SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s_waccm_ma_mam4.20241001_150352_n6ytq4/./preview_namelists", line 67, in <module>
    _main_func(__doc__)
  File "/glade/derecho/scratch/erik/cam6_4_032/cime/scripts/SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s_waccm_ma_mam4.20241001_150352_n6ytq4/./preview_namelists", line 63, in _main_func
    case.create_namelists(component=args.component)
  File "/glade/derecho/scratch/erik/cam6_4_032/cime/CIME/case/preview_namelists.py", line 90, in create_namelists
    import_and_run_sub_or_cmd(
  File "/glade/derecho/scratch/erik/cam6_4_032/cime/CIME/utils.py", line 671, in import_and_run_sub_or_cmd
    raise e1 from None
  File "/glade/derecho/scratch/erik/cam6_4_032/cime/CIME/utils.py", line 667, in import_and_run_sub_or_cmd
    run_sub_or_cmd(
  File "/glade/derecho/scratch/erik/cam6_4_032/cime/CIME/utils.py", line 712, in run_sub_or_cmd
    getattr(mod, subname)(*subargs)
  File "/glade/derecho/scratch/erik/cam6_4_032/components/cmeps/cime_config/buildnml", line 694, in buildnml
    _create_drv_namelists(case, infile, confdir, nmlgen, files)
  File "/glade/derecho/scratch/erik/cam6_4_032/components/cmeps/cime_config/buildnml", line 148, in _create_drv_namelists
    nmlgen.init_defaults(infile, config, skip_default_for_groups=["modelio"])
  File "/glade/derecho/scratch/erik/cam6_4_032/cime/CIME/nmlgen.py", line 168, in init_defaults
    self.add_default(self._definition.get(entry, "id"))
  File "/glade/derecho/scratch/erik/cam6_4_032/cime/CIME/nmlgen.py", line 706, in add_default
    default = self.get_default(name, allow_none=True)
  File "/glade/derecho/scratch/erik/cam6_4_032/cime/CIME/nmlgen.py", line 383, in get_default
    default[i] = self.quote_string(scalar)
  File "/glade/derecho/scratch/erik/cam6_4_032/cime/CIME/nmlgen.py", line 217, in quote_string
    if string == "" or (string[0] not in ('"', "'") or string[0] != string[-1]):
TypeError: 'NoneType' object is not subscriptable

ekluzek avatar Oct 01 '24 21:10 ekluzek

@billsacks @jedwards4b @fischer-ncar the following change I've tried gets preview_namelists to run. Does this look like the correct change to bring in?

diff --git a/cime_config/namelist_definition_drv.xml b/cime_config/namelist_definition_drv.xml
index 80a59931..35822544 100644
--- a/cime_config/namelist_definition_drv.xml
+++ b/cime_config/namelist_definition_drv.xml
@@ -2308,8 +2308,9 @@
       ocn to wav state mapping file for states
     </desc>
     <values>
+      <value>unset</value>
       <value samegrid_ocn_wav="true">idmap</value>
-      <value>$OCN2WAV_SMAPNAME</value>
+      <value samegrid_ocn_wav="false">$OCN2WAV_SMAPNAME</value>
     </values>
   </entry>
 
@@ -2322,8 +2323,9 @@
       wav to ocn state mapping file for states
     </desc>
     <values>
+      <value>unset</value>
       <value samegrid_ocn_wav="true">idmap</value>
-      <value>$WAV2OCN_SMAPNAME</value>
+      <value samegrid_ocn_wav="false">$WAV2OCN_SMAPNAME</value>
     </values>

ekluzek avatar Oct 01 '24 21:10 ekluzek

I just verified that this does NOT occur in cesm3_0_alpha03d. So must be a problem just in a CAM checkout? @cacraigucar

ekluzek avatar Oct 01 '24 22:10 ekluzek

Is it possible that this is related to https://github.com/ESCOMP/CMEPS/pull/498, which came in with cmeps1.0.19?

billsacks avatar Oct 01 '24 22:10 billsacks

Yes I believe that the cam cmeps tag needs to be updated to the latest cmeps. (currently cmeps1.0.20)

jedwards4b avatar Oct 01 '24 22:10 jedwards4b

@jedwards4b no @billsacks is right, in the cam checkout it fails as above using both cmeps1.0.20 and cmeps1.0.19 -- but works using cmeps1.0.18.

I still don't know why it works in cesm3_0_alpha03d though and fails in the cam checkout.

Thoughts on the proposed fix above?

ekluzek avatar Oct 01 '24 22:10 ekluzek

@ekluzek can you clarify: when you say it works in alpha03d, do you mean out-of-the-box alpha03d or alpha03d with cmeps updated? It looks like alpha03d uses cmeps1.0.16.

billsacks avatar Oct 01 '24 23:10 billsacks

@billsacks oh you are right. I thought I saw that alpha03d was using cmeps1.0.20, but you are right it's using cmeps1.0.16. And when I update it to cmeps1.0.19 -- it starts failing again as above. So yes this is a problem with the last two cmeps tags.

ekluzek avatar Oct 02 '24 04:10 ekluzek

@brian-eaton is updating our externals to match alpha03d, so we'll probably sidestep the problem for now (unless folks suggest he update to cmeps1.0.20.

cacraigucar avatar Oct 02 '24 15:10 cacraigucar

Actually, on a closer reading, I don't think CAM wants to update to cmeps1.0.20, until this problem is fixed. I would suggest that @brian-eaton update to the CMEPS used in alpha03d (cmeps1.0.16) until this problem is solved.

cacraigucar avatar Oct 02 '24 15:10 cacraigucar

I found the problem and will correct in the next cmeps tag.

jedwards4b avatar Oct 02 '24 15:10 jedwards4b

@ekluzek I don't see how you could have produced this error unless you created the case first then updated cmeps before running case.build - is this what happened? If not can you provide instructions to reproduce this issue?

jedwards4b avatar Oct 02 '24 15:10 jedwards4b

@jedwards4b yep -- you are right. I created the case to work on one problem and then wanted to check it in the latest cmeps and this came up. I didn't hardly realize that is what I had done.

But, I just verified that if I create the case with the updated cmeps in place -- I don't run into this. So thanks for pointing that out.

ekluzek avatar Oct 02 '24 15:10 ekluzek