Skip to content

Conversation

enssow
Copy link
Contributor

@enssow enssow commented Sep 25, 2025

Description

Can run directly from the terminal:
uv run export --run-id uwbvdtge --stream ERA5 --output-dir /p/home/jusers/owens1/jureca/WeatherGen/test_output1 --format netcdf --type prediction target -- fsteps 2 1 --samples 1
or use the file directly with:
uv run ./packages/evaluate/src/weathergen/evaluate/export_inference.py --run-id uwbvdtge --stream ERA5 --output-dir /p/home/jusers/owens1/jureca/WeatherGen/test_output1 --format netcdf --type prediction target

  • more CLI args can be found in the file export_inference.py

Issue Number

Closes #571

Checklist before asking for review

  • I have performed a self-review of my code
  • My changes comply with basic sanity checks:
    • I have fixed formatting issues with ./scripts/actions.sh lint
    • I have run unit tests with ./scripts/actions.sh unit-test
    • I have documented my code and I have updated the docstrings.
    • I have added unit tests, if relevant
  • I have tried my changes with data and code:
    • I have run the integration tests with ./scripts/actions.sh integration-test
    • I tried to do this test but it failed - I suspect there are more recent changes to the code base that are not reflected in my branch that may solve this
    • (bigger changes) I have run a full training and I have written in the comment the run_id(s): launch-slurm.py --time 60
    • (bigger changes and experiments) I have shared a hegdedoc in the github issue with all the configurations and runs for this experiments
  • I have informed and aligned with people impacted by my change:
    • for config changes: the MatterMost channels and/or a design doc
    • for changes of dependencies: the MatterMost software development channel
    • I have posted the PR and summary to the relevant channel

@enssow enssow marked this pull request as draft September 25, 2025 13:12
@@ -0,0 +1,363 @@
## EXAMPLE USAGE:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will add this as a sepearte issue to be sorted after merging this one :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it is small enough and it is part of the basic ergonomics:

#!/usr/bin/env -S uv run
# /// script
# dependencies = [
#   "weathergen-evaluate",
#   "weathergen-common",
# ]
# [tool.uv.sources]
# weathergen-evaluate = { path = "../../../../../packages/evaluate" }
# ///

The script also needs to be executable: chmod +x zarr_nc.py

Let me know if you have any issues

Also: this script will eventually become the export entry point. How about calling it export_evaluation.py

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ended up calling it export_inference.py , it only worked if I took logging outside of main though so might have to discuss this

Copy link
Collaborator

@iluise iluise left a comment

Choose a reason for hiding this comment

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

Hi Sorcha,

Thanks for the script! I tested it on ATOS and it seems to work for me as well. I added a couple of comments. Happy to discuss them by chat if you want

@enssow
Copy link
Contributor Author

enssow commented Sep 29, 2025

Thank you for testing! Will push the edits later today :)

@iluise
Copy link
Collaborator

iluise commented Oct 6, 2025

Hi Sorcha, is this ready for review or still needs editing?

@enssow
Copy link
Contributor Author

enssow commented Oct 6, 2025

Hi Ilaria, I've just moved the filepaths so it doesn't conflict with #693 , I will quickly check I wanted to see what you did with your quaver preprocessing before the review :)

@enssow enssow marked this pull request as ready for review October 7, 2025 10:52
Copy link
Collaborator

@tjhunter tjhunter left a comment

Choose a reason for hiding this comment

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

@enssow I have not reviewed the logic but high level comments, happy to talk about it

from weathergen.common.io import ZarrIO

_logger = logging.getLogger(__name__)
_logger.setLevel(logging.INFO)
Copy link
Collaborator

Choose a reason for hiding this comment

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

move all the logger logic to main. No side effects at imports

@@ -0,0 +1,363 @@
## EXAMPLE USAGE:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it is small enough and it is part of the basic ergonomics:

#!/usr/bin/env -S uv run
# /// script
# dependencies = [
#   "weathergen-evaluate",
#   "weathergen-common",
# ]
# [tool.uv.sources]
# weathergen-evaluate = { path = "../../../../../packages/evaluate" }
# ///

The script also needs to be executable: chmod +x zarr_nc.py

Let me know if you have any issues

Also: this script will eventually become the export entry point. How about calling it export_evaluation.py

# check config loaded correctly
assert config["variables"]["q"] is not None

FSTEP_HOURS = np.timedelta64(6, "h")
Copy link
Collaborator

Choose a reason for hiding this comment

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

for a future PR: this should be retrieved from the run config

Copy link
Collaborator

Choose a reason for hiding this comment

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

But there's some care required with len_hrs and the potentially temporal resolution of datasets (i.e. substeps in a window).

@iluise iluise merged commit 17ba0a5 into ecmwf:develop Oct 14, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

NetCDF conversion

4 participants