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

Allow unset default values for namelist variables #350

Open
jimmielin opened this issue Jan 13, 2025 · 0 comments
Open

Allow unset default values for namelist variables #350

jimmielin opened this issue Jan 13, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@jimmielin
Copy link
Member

jimmielin commented Jan 13, 2025

What is the feature/what would you like to discuss?

Currently there's incomplete infrastructure for namelist variables to have an "unset" default, i.e., if the namelist definition file (scheme_namelist.xml) does not provide a <values> option.

Already available

create_readnl_files.py generates namelist read code and correctly sets the following when namelist entries are missing:

  • int: unset_int
  • logical: .false.
  • real: -HUGE(1.0_kind) or -HUGE(1.0)
  • character: unset_str
    so the generated readnl code is complete.

What needs to be changed

@nusbaume wrote:

Is there a reason we aren't wanting a values XML tag at all as opposed to just providing a blank value entry and then just modifying the CAM-SIMA code to properly handle the "missing" value? So basically something like this:

<values>
  <value></value>  <!--default "missing" value -->
</values>

It seems like this will trigger errors in paramgen.py in CIME and atm_in_paramgen.py in SIMA, so some work is needed for this to work as well.

Alternatively,

  1. CIME's entry_id_pg.xsd needs to be changed to allow <values> to be optional, by changing <xs:element ref="values"/> to <xs:element ref="values" minOccurs='0'/>
  2. atm_in_paramgen.py should be changed to handle <values> being not present. Right now it just reads
val = self._data[nml_group][var]["values"]

could be changed to handle missing <value> through something like

if "values" in self._data[nml_group][var]:
  #Extract variable value(s):
  val = self._data[nml_group][var]["values"] #.strip()

Is there anyone in particular you want to be part of this conversation?

@peverwhee @nusbaume

Will this change (regression test) answers?

No

Will you be implementing this enhancement yourself?

Any Software Engineer can do this

@jimmielin jimmielin added the enhancement New feature or request label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant