Skip to content

Update tutorial to use ERA5 data and jupyter notebooks - #269

Merged
sjavis merged 12 commits into
mainfrom
tutorial-era5
Oct 12, 2026
Merged

sjavis merged 12 commits into
mainfrom
tutorial-era5

Conversation

@sjavis

@sjavis sjavis commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

I've updated the tutorial to use both ERA5 data and jupyter notebooks.

As with the old scripts, the notebooks can be run manually from the tutorial/ directory, but the outputs are also included in the documentation using nbsphinx (and nbsphinx_link to link to the the notebooks as they are outside the documentation folder). I added a tutorial group for the dependencies for running the notebooks - jupyter, matplotlib, cartopy.

The ERA5 data uses a single week of data (1950-09-01 to 1950-09-07) which includes about 4 active TCs. This takes much less time to download and preprocess (several minutes). I added tutorial/fetch_data.py to retrieve the data. It can do this in two ways:

  • Download from CDS. This needs an account and API key.
  • (default) Download from this github release I made.

To use the ERA5 data I also made some other changes:

  • New preprocessing functions for the ERA5 data (these aren't strictly necessary here but they are helpful and will be needed down the line for batching):
    • calculate_norm_xy / calculate_wind_speed to get the wind speed from components.
    • multiply_field to multiply by a scalar - needed to convert geopotential to geopotential height or orography.
    • set_time_units to update the "days since YYYY-MM-DD" units as TSTORMS can't use negative time values.
    • squeeze_field to remove size-1 arrays as this needs to be done for some of the ERA5 data.
    • flip_axis to flip a coordinate direction. ERA5 latitude is decreasing but TSTORMS needs increasing.
    • set_netcdf_variable_name renamed to set_netcdf_info and made more general to add additional netcdf metadata.
    • The output file writing now specifies the netcdf4 backend. This is because in the latest version of cf-python the new default backend writes output that isn't compatible with netcdf-fortran (for TSTORMS).
  • Fix a bug by changing the trajectories in Tempest Extremes to use the calendar from the input files rather than the more restricted calendar used in TempestExtremes itself.
  • Fix the calendars in TSTORMS itself (Add compatibility with more CF calendar types TSTORMS#5).
  • Update the TSTORMS input file guidance to describe newly discovered requirements.

This partially addresses #224.

@sjavis sjavis self-assigned this Sep 25, 2026
@sjavis sjavis changed the title Update tutorial to use ERA5 data Update tutorial to use ERA5 data and jupyter notebooks Sep 28, 2026

@surbhigoel77 surbhigoel77 left a comment

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.

LGTM

@sjavis
sjavis merged commit 5779c02 into main Oct 12, 2026
7 checks passed
@sjavis
sjavis deleted the tutorial-era5 branch October 12, 2026 09:09
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