Skip to content

Namelist Refactor#218

Closed
jjuyeonkim wants to merge 6 commits into
NOAA-GFDL:developfrom
jjuyeonkim:20250908_namelist_2
Closed

Namelist Refactor#218
jjuyeonkim wants to merge 6 commits into
NOAA-GFDL:developfrom
jjuyeonkim:20250908_namelist_2

Conversation

@jjuyeonkim

@jjuyeonkim jjuyeonkim commented Sep 8, 2025

Copy link
Copy Markdown
Collaborator

Description
This is the first of multiple PRs to refactor the NDSL's Namelistand NamelistDefaults so that submodules have more ownership over configuration parameters and corresponding default values.

  • Thendsl.Namelist class has been modified in the following ways:
    1. It now inherits from f90nml.Namelist. This allows for the preservation for the group information coming from Fortran-based namelist (*.nml) files. We expect that this will be useful when initializing dycore and physics config objects that have the same member variable name but different values.
    2. The flat namelist's member variables have been gutted. They have been moved to their respective submodules, by way of the config files. (Related PRs are forthcoming.)
    3. There is a new method namelist_groups_to_flatish_dict that will allow for target group names to be pulled out and returned in a flat-ish dict form. This will facilitate the creation of submodule config files based on certain groups of the ndsl.Namelist.
  • ndsl/stencils/testing/conftest.py has been modified so that the Namelist is instantiated directly from f90nml.read rather than using a 'from_f90nml' function call.
  • Much of the NamelistDefaults members have been moved to PyFV3's DynamicalCoreConfig and PyShield's PhysicsConfig. (Related PRs are forthcoming.)
  • Github workflow tests are temporarily modified to run from jjuyeonkim's pace and submodule forks. These will be reverted back to their original state once this issue (NDSL should provide a framweork for physics namelists instead of specifying the namlist members and default values for specific physics models #64) has been resolved.

Fixes: #64 (partial refactor)

How Has This Been Tested?
PyFV3 and PySHiELD translate tests run as expected compared to develop. Pace unit tests also pass as expected.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • New check tests, if applicable, are included

Simplifying Namelist + inheriting from f90nml.Namelist
Modifying workflow tests until namelist refactor is completed
@jjuyeonkim jjuyeonkim mentioned this pull request Sep 9, 2025
8 tasks
@fmalatino fmalatino requested review from FlorianDeconinck, bensonr, fmalatino, oelbert and romanc and removed request for FlorianDeconinck and romanc September 12, 2025 16:13
@fmalatino

Copy link
Copy Markdown
Contributor

General question (maybe should be raised to status of issue if need be): do we want to enforce a format for producing namelist files?

@romanc

romanc commented Sep 15, 2025

Copy link
Copy Markdown
Collaborator

General question: what's the status of this PR? Are the review requests indicating that this is ready for show or is it more of a first round of feedback? In any case, we are happy to have a look and provide feedback.

@jjuyeonkim

Copy link
Copy Markdown
Collaborator Author

General question: what's the status of this PR? Are the review requests indicating that this is ready for show or is it more of a first round of feedback? In any case, we are happy to have a look and provide feedback.

I'd very much like a first round of feedback.

The pace unit tests, pyFV3 translate tests and pySHiELD translate tests pass locally for me, but I've been unsuccessful so far in getting the CI workflows modified to pass here. That's why it's still in draft status.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NDSL should provide a framweork for physics namelists instead of specifying the namlist members and default values for specific physics models

3 participants