Skip to content

Add ERA5 regional hindcast example#233

Draft
ewquon wants to merge 14 commits into
mainfrom
eq/era5_breeze_land
Draft

Add ERA5 regional hindcast example#233
ewquon wants to merge 14 commits into
mainfrom
eq/era5_breeze_land

Conversation

@ewquon
Copy link
Copy Markdown
Collaborator

@ewquon ewquon commented May 13, 2026

Summary

@glwagner @kaiyuan-cheng

Adds examples/era5_breeze.jl — a building block for a regional modeling example that will eventually couple Breeze (compressible solver, in development) to forthcoming SlabLand and SlabOcean components.

Current scope is data ingest only: download ERA5 reanalysis over an SGP-centered LAM bounding box (HI-SCALE 2016-09-10 case day) and interpolate onto a LatitudeLongitudeGrid sized for ~3 km horizontal cells at the domain center latitude. Tᵥ is computed as a derived field using Breeze.ThermodynamicConstants for the Rᵥ/Rd − 1 coefficient.

Out of scope, to be added as the underlying capabilities come online:

  • Breeze model construction
  • dynamical initialization (DFI / elliptical projection)
  • acoustic substepping
  • open boundary conditions
  • land/ocean coupling
  • terrain

Notes

  • Surface pressure is read onto a 3-D grid with Nz=1 rather than a 2-D (Bounded, Bounded, Flat) grid, sidestepping CliMA/Oceananigans.jl#5473 (Flat↔non-Flat interpolate! errors with a cryptic BoundsError; #5474 will convert that to a clear ArgumentError but does not lift the restriction). Mirrors the pattern in examples/ERA5_hourly_data.jl.
  • This example uses a LatitudeLongitudeGrid. A future variant on a projected Cartesian grid would benefit from the set! projection support proposed in Add map projection support to set! for RectilinearGrid targets #232.

Test plan

  • Run end-to-end against the CDS API on a machine with ~/.cdsapirc configured.

@ewquon ewquon marked this pull request as draft May 13, 2026 19:53
Comment thread examples/era5_breeze.jl Outdated
Comment thread examples/era5_breeze.jl Outdated
Comment on lines +21 to +22
using NumericalEarth.DataWrangling: BoundingBox, Metadatum, download_dataset
using NumericalEarth.DataWrangling.ERA5
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we add the appropriate exports so that these additional outputs are not needed?

also for the example, I recommend avoiding manual calls to download_dataset. I don't want to codify this workflow (we should instead develop the utility on #141). The issue is that people will adopt this style and not realize that it isn't recommended anymore once we have the utility

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The utility in #141 is based on download_dataset, I think you mean #143

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

When the new utility lands, we can revise this example as well as ERA5_hourly_data.jl

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Until then, let's avoid anything special (it will download automatically under the hood) so we don't have to revert it or change the documentation

Comment thread examples/era5_breeze.jl Outdated
using Oceananigans
using Oceananigans.Fields: CenterField, XFaceField, YFaceField
using Breeze
using Breeze.Thermodynamics
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what's this for?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

vapor_gas_constant isn't exported from Breeze.Thermodynamics

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Comment thread examples/era5_breeze.jl Outdated
Comment thread examples/era5_breeze.jl Outdated
set!(T, Metadatum(:temperature; dataset=ds_pl, date=start_date, meta_common...))
set!(qᵛ, Metadatum(:specific_humidity; dataset=ds_pl, date=start_date, meta_common...))
set!(qᶜ, Metadatum(:specific_cloud_liquid_water_content; dataset=ds_pl, date=start_date, meta_common...))
set!(qⁱ, Metadatum(:specific_cloud_ice_water_content; dataset=ds_pl, date=start_date, meta_common...))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we need a MetadataSet object? I can open an issue about this

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is something we've discussed before. That would clean things up here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

on it

Comment thread examples/era5_breeze.jl Outdated
@ewquon ewquon force-pushed the eq/era5_breeze_land branch from 9d673f4 to 5463396 Compare May 13, 2026 20:43
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread src/DataWrangling/DataWrangling.jl Outdated
@ewquon
Copy link
Copy Markdown
Collaborator Author

ewquon commented May 14, 2026

Okay, the model state should be ready for dynamic initialization.
era5_breeze_profiles

A couple of important notes:

  1. As noted in ERA5 pressure-level ingest: per-column geopotential and surface-pressure masking #236, we need to better address geopotential height variability and we should discuss the approach to this. I've prototyped per-column vertical interpolation to unblock the ICs work and to have as a reference when developing the data wrangling improvement.
  2. Because we don't have terrain yet, I'm using the height above ground level to interpolate onto the flat-bottomed Breeze grid. (Otherwise, portions of the Breeze domain would be essentially underground and I imagine this would be problematic for the initialization)

@glwagner
Copy link
Copy Markdown
Member

@ewquon should we add terrain? Terrain following should work for the fully compressible formulation (just not substepping)

@ewquon
Copy link
Copy Markdown
Collaborator Author

ewquon commented May 14, 2026

@ewquon should we add terrain? Terrain following should work for the fully compressible formulation (just not substepping)

Hallelujah! I'm happy to add that in. Anything that gets us closer to reality sooner rather than later is a win in my book.

Comment thread examples/era5_breeze.jl
Comment thread docs/make.jl
Example("Breeze over two oceans", "breeze_over_two_oceans", false),
Example("ERA5 hourly data", "ERA5_hourly_data", true),
Example("ERA5 hourly data retrieval", "ERA5_hourly_data", true),
Example("ERA5 hindcast simulation", "era5_breeze", true),
Copy link
Copy Markdown
Member

@glwagner glwagner May 14, 2026

Choose a reason for hiding this comment

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

Suggested change
Example("ERA5 hindcast simulation", "era5_breeze", true),
Example("Atmosphere hindcast nested in ERA5", "era5_breeze", false),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This will be a heavy case so we shoudln't run every commit (change true to false). Also we should clarify, this is an atmosphere case (eventually atmosphere-land), and probably should also indicate it uses Breeze

@glwagner glwagner added the build all examples add this label to build all the examples in the PR label May 14, 2026
@glwagner
Copy link
Copy Markdown
Member

@ewquon I added the "build all examples" label so that it will build even if the "build always" tag is false.

@glwagner
Copy link
Copy Markdown
Member

@giordano
Copy link
Copy Markdown
Member

I believe

  failed to register layer: write /usr/local/share/julia/artifacts/75ae42466e7dd21641ff521f63cfb456d09433e2/lib/libcudnn_engines_precompiled.so.9: no space left on device
  Warning: Docker pull failed with exit code 1, back off 8.515 seconds before retry.

simply happens when the runner was reused from a previous run from somewhere else in the organisation, but the new build uses a new Docker image than the previous run, and then it fails to pull the second one because the combination of the two images fills the partition.

In summary, it's an offensive, albeit annoying, issue, restarting the job should succeed (unless you rerun in the same situation 😄)

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

Labels

build all examples add this label to build all the examples in the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants