Skip to content

Save json namelist during serialization#1254

Open
jcanton wants to merge 10 commits intomainfrom
save_json_nml_serialization
Open

Save json namelist during serialization#1254
jcanton wants to merge 10 commits intomainfrom
save_json_nml_serialization

Conversation

@jcanton
Copy link
Copy Markdown
Contributor

@jcanton jcanton commented May 8, 2026

and bug-fix the run_serialization script with lazy loading

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the serialization workflow to also persist the ICON namelist as JSON during output collection, and adjusts the run_serialization CLI to use lazy imports and updated repository directory settings.

Changes:

  • Add f90nml as a scripts dependency and lock it in uv.lock.
  • Extend copy_ser_data() to convert NAMELIST_ICON_output_atm to JSON and save it alongside copied outputs.
  • Refactor run_serialization.py settings (repo dir fields) and introduce lazy loading for icon4py.model.testing imports.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
uv.lock Locks f90nml and updates the lock revision/markers.
scripts/python/run_serialization.py Adds namelist-to-JSON conversion, lazy imports, and updates settings/path wiring.
pyproject.toml Adds f90nml>=1.5 to the scripts dependency group.
model/testing/src/icon4py/model/testing/definitions.py Adds NAMELIST_ICON_FNAME constant for the ICON output namelist filename.
Comments suppressed due to low confidence (1)

scripts/python/run_serialization.py:76

  • SerializationSettings.defaults() now relies on the module-level definitions being initialized elsewhere (it was previously imported locally). This makes defaults() fragile if it’s ever called without first running the lazy-import bootstrap. Consider importing definitions (and any other required modules) inside defaults() again, or refactor so defaults() doesn’t depend on mutable module globals.
    def defaults(cls) -> SerializationSettings:
        # ======================================
        # START DEFAULT USER CONFIGURATION
        # ======================================
        # We hardcode the settings here for simplicity, but they could be
        # extended to be read from a config file or command-line arguments
        # if needed in the future.

        COMM_SIZES: list[int] = [1, 2, 4]

        EXPERIMENTS = [
            definitions.Experiments.MCH_CH_R04B09,
            definitions.Experiments.JW,
            definitions.Experiments.EXCLAIM_APE,
            definitions.Experiments.GAUSS3D,
            definitions.Experiments.WEISMAN_KLEMP_TORUS,
        ]

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/python/run_serialization.py Outdated
Comment thread scripts/python/run_serialization.py Outdated
Comment thread scripts/python/run_serialization.py
Comment thread scripts/python/run_serialization.py Outdated
jcanton added 5 commits May 8, 2026 13:49
* main:
  Remove `dummy_exchange_with_bound_dim` (#1177)
  py2fgen: all_bindings generate .f90 and .c separately (#1253)
  Update Plottingscripts (#1239)
  Fix default nox sessions (#1243)
  Improve return code handling in py2fgen generated code (#1245)
@jcanton
Copy link
Copy Markdown
Contributor Author

jcanton commented May 8, 2026

cscs-ci run default

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Mandatory Tests

Please make sure you run these tests via comment before you merge!

  • cscs-ci run default
  • cscs-ci run distributed

Optional Tests

To run benchmarks you can use:

  • cscs-ci run benchmark-bencher

To run tests and benchmarks with the DaCe backend you can use:

  • cscs-ci run dace

To run test levels ignored by the default test suite (mostly simple datatest for static fields computations) you can use:

  • cscs-ci run extra

For more detailed information please look at CI in the EXCLAIM universe.

@jcanton
Copy link
Copy Markdown
Contributor Author

jcanton commented May 8, 2026

cscs-ci run distributed

@jcanton jcanton requested a review from msimberg May 8, 2026 15:46
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.

2 participants