Skip to content

Add :era5_land dataset support and unwrap zip-wrapped CDS responses - #9

Merged
aklocker42 merged 2 commits into
mainfrom
akl/era5-land
Aug 1, 2026
Merged

Add :era5_land dataset support and unwrap zip-wrapped CDS responses#9
aklocker42 merged 2 commits into
mainfrom
akl/era5-land

Conversation

@aklocker42

Copy link
Copy Markdown
Collaborator

Summary

  • resolve_dataset(dataset, pressure_levels) maps a new dataset keyword
    (:era5, the default, or :era5_land) to the right CDS product id and
    product_type, wired into hourly(), monthly(), and yearly().
    reanalysis-era5-land takes no product_type key at all, unlike the
    single-levels/pressure-levels products.
  • download_cds_file now detects and unwraps zip-wrapped CDS responses.
    reanalysis-era5-land was observed in practice to sometimes return a zip
    archive even when format=netcdf is explicitly requested; previously the
    raw zip bytes were written straight to the output path, so any netCDF
    reader downstream would fail on it. The fix checks the response for the
    zip magic bytes and, if present, extracts the single member in place.

Motivation

Found while adding ERA5-Land support to NumericalEarth.jl
(NumericalEarth/NumericalEarth.jl#490): a live download of a full year of
hourly reanalysis-era5-land data succeeded at every CDS-side step but
failed downstream because one monthly chunk came back as a zip. This fixes
it at the source so any caller of retrieve/download_cds_file — not just
that one downstream extension — gets the requested format regardless of
what the gateway actually sends.

Testing

New offline unit tests in test/runtests.jl: resolve_dataset for both
datasets and the pressure-levels/land-with-pressure-levels error case, and
unwrap_zip_response!/is_zip_file against a synthetic zip fixture and a
plain (non-zip) file that should be left untouched.

🤖 Generated with Claude Code

aklocker42 and others added 2 commits August 1, 2026 17:26
resolve_dataset() maps dataset=:era5/:era5_land to the right CDS product id
and product_type (ERA5-Land's reanalysis-era5-land takes no product_type
key), wired into hourly()/monthly()/yearly().

Some CDS datasets (reanalysis-era5-land observed in practice) wrap their
netcdf output in a zip archive even when format=netcdf is requested.
download_cds_file now detects the zip magic bytes and unwraps in place, so
callers always get the requested format regardless of what the gateway
actually sends.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Fixes the Documenter missing_docs check, which flagged the new docstring
as not included in any @docs block.
@aklocker42
aklocker42 merged commit 2782e7b into main Aug 1, 2026
7 checks passed
@aklocker42 aklocker42 mentioned this pull request Aug 1, 2026
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.

1 participant