Skip to content

Conversation

@JackKelly
Copy link
Contributor

@JackKelly JackKelly commented Jul 21, 2025

This PR implements live-updating DWD's ICON-EU NWP directly from DWD.

A subsequent PR will implement back-filling from OCF's ICON-EU archive on Hugging Face.

Related issues:

Related external links

Task list

I'll mark this PR as "ready for review" when all these tasks are done

  • Register ICON-EU in src/reformatters/__main__.py
  • template_config.py
  • Check the NWP params in template_config.py against the ICON docs. Copy-and-paste the description of each variable from the PDF into template_config.py. Link to the PDF from the code.
  • Check if surface albedo is exactly the same at a given time of day, every forecast
  • template_config_test.py

For a subsequent PR:

  • region_job.py
  • region_job_test.py
  • dynamical_dataset.py
  • dynamical_dataset_test.py

@aldenks
Copy link
Member

aldenks commented Jul 23, 2025

@JackKelly I have a slight preference to review in more incremental PRs (e.g. one for the template config + tests, one for region job, one for dynamical dataset). So given that, this looks like it's ready for a review? I'll give it a first pass this afternoon

@JackKelly
Copy link
Contributor Author

Hey. I like small PRs too! Please hold fire on reviewing. There are some issues with the NWP variable names that I'd like to fix first, if that's ok.

…files are currently just the output from the initialize-new-integration tool. These files will be added to a subsequent PR once I've modified them.
@JackKelly JackKelly marked this pull request as ready for review July 24, 2025 13:25
@JackKelly
Copy link
Contributor Author

OK, I think this is ready for review! I've removed the files that I haven't yet updated. Although I've just noticed that the code quality check is failing...

Copy link
Member

@aldenks aldenks left a comment

Choose a reason for hiding this comment

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

Awesome! Just a few tiny tweaks but this is basically good to go.

Don't worry too much about the units and short/long names right now. We need to do a detail sweep and get fully aligned to cf conventions and we can do that before we release this.

re the mypy failure in the pipeline

  • i think you need to create empty dwd/__init__.py and dwd/icon_eu/__init__.py files. I should update the init script to create those
  • if you install pre-commit (instructions it will check for you as you commit. you can also run uv run mypy locally.

),
),
DwdIconEuDataVar(
name="convective_available_potential_energy",
Copy link
Member

Choose a reason for hiding this comment

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

is this entire atmosphere?

Suggested change
name="convective_available_potential_energy",
name="convective_available_potential_energy_atmosphere",

Copy link
Contributor Author

@JackKelly JackKelly Jul 28, 2025

Choose a reason for hiding this comment

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

Surprisingly, the ICON-EU GRIBs and the ICON-EU manual claim that GRIB_typeOfLevel is set to surface for the cape variable. Although I agree that entire atmosphere would make more sense!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, if it's OK, I'd propose that I don't change convective_available_potential_energy to convective_available_potential_energy_atmosphere (because the ICON-EU manual claims that convective_available_potential_energy is a surface variable). Unless I've misunderstood?!

Copy link
Member

Choose a reason for hiding this comment

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

lets leave as is for now and come back with a later metadata polish and align to CF Conventions. Same for the other possible naming + unit questions in our metadata.

@JackKelly
Copy link
Contributor Author

JackKelly commented Jul 28, 2025

re the mypy failure in the pipeline

  • i think you need to create empty dwd/__init__.py and dwd/icon_eu/__init__.py files. I should update the init script to create those

So... this mypy error has been an interesting rabbit hole to go down!

I committed the missing Python files that initialize-new-integration had created, but I had deliberately not committed yet because I was gonna add those in a subsequent PR. This is why the mypy error wasn't appearing on my local machine.

And, as you suggested, I created __init__.py files in all the relevant directories under test/.

These fixed the mypy error.

But then I got an import error in pytest, which I think is caused by a bug in pytest 8.3.4. After upgrading pytest and creating the __init__.py files, the bug has gone away 🙂

And update comment about chunk sizes
@JackKelly JackKelly changed the title Update ICON-EU from DWD ICON-EU step 1: Implement template_config.py Jul 28, 2025
@JackKelly
Copy link
Contributor Author

OK, I think this PR is ready to merge 🙂. mypy and pytest pass on my local machine. I think CI should pass once PR #192 is merged. Please shout if you have any other tweaks you'd like me to make! The only two suggestions I haven't committed are to append _atmosphere to the end of total_cloud_cover and convective_available_potential_energy. I haven't committed these suggestions because the ICON-EU manual says those two variable are surface-level. But please shout if you'd like me to append _atmosphere anyway!

"pre-commit>=3.8.0",
"pyqt6>=6.7.1",
"pytest>=8.3.4",
"pytest>=8.4.1",
Copy link
Contributor Author

@JackKelly JackKelly Aug 4, 2025

Choose a reason for hiding this comment

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

Please see this comment for more info on why I updated pytest: #184 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't modified this file yet. This is just the output of initialize-new-integration. I'll modify this file in a subsequent PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't modified this file yet. This is just the output of initialize-new-integration. I'll modify this file in a subsequent PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't modified this file yet. This is just the output of initialize-new-integration. I'll modify this file in a subsequent PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't modified this file yet. This is just the output of initialize-new-integration. I'll modify this file in a subsequent PR.

[[package]]
name = "pytest"
version = "8.3.4"
version = "8.4.1"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See this comment for more info on why I updated pytest: #184 (comment)

@aldenks
Copy link
Member

aldenks commented Aug 5, 2025

awesome! will give this a final review and merge this evening

@aldenks aldenks self-requested a review August 5, 2025 17:39
Copy link
Member

@aldenks aldenks left a comment

Choose a reason for hiding this comment

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

Beauty! Merging. I have a larger TODO around aligning with CF Conventions and we can do that after we have things running.

im going to make one follow up commit correcting the chunk size comment (edit: done here #195)

dataset_version="0.1.0",
name="DWD ICON-EU Forecast",
description="High-resolution weather forecasts for Europe from the ICON-EU model operated by Deutscher Wetterdienst (DWD).",
attribution="DWD ICON-EU data processed by dynamical.org from DWD.",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
attribution="DWD ICON-EU data processed by dynamical.org from DWD.",
attribution="DWD ICON-EU data processed by dynamical.org.",

@property
def data_vars(self) -> Sequence[DwdIconEuDataVar]:
"""Define metadata and encoding for each data variable."""
var_chunks: dict[Dim, int] = {
Copy link
Member

Choose a reason for hiding this comment

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

doh, i think i had my math wrong, it's # of elements * 4 bytes for a float32: 1x93×219×153×4bytes ~= 12.5MB uncompressed and then I've found compressing down to 20% of uncompressed size is a reasonable expectation (we can often go a bit lower, sometimes much lower for very compressible variables) so 1×93×219×153×4bytes×0.2 ~= 2.5MB compressed.

),
),
DwdIconEuDataVar(
name="convective_available_potential_energy",
Copy link
Member

Choose a reason for hiding this comment

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

lets leave as is for now and come back with a later metadata polish and align to CF Conventions. Same for the other possible naming + unit questions in our metadata.

),
),
DwdIconEuDataVar(
name="soil_water_runoff",
Copy link
Member

Choose a reason for hiding this comment

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

I'm not yet sold on including the soil and surface runoff and snow cover/water equivalent variables (they are usually not great from atmospheric models) but we can decide the exact vars later, no change needed now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool... TBH, I only included the water runoff variables because I thought that Upstream might use those variables! (I don't know anything about modelling rivers!) So, if you don't need them, then let's not include the water runoff variables (but, like you say, we can tweak the variables list later).

@aldenks aldenks merged commit 1510de7 into dynamical-org:main Aug 7, 2025
2 checks passed
@JackKelly JackKelly deleted the update-icon-eu-from-dwd branch August 7, 2025 15:34
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