Skip to content

Add NASA IMERG Early and Late V07 analysis datasets#636

Open
aldenks wants to merge 2 commits into
mainfrom
nasa-imerg-analysis-v7
Open

Add NASA IMERG Early and Late V07 analysis datasets#636
aldenks wants to merge 2 commits into
mainfrom
nasa-imerg-analysis-v7

Conversation

@aldenks

@aldenks aldenks commented Jun 1, 2026

Copy link
Copy Markdown
Member

Summary

Adds two global half-hourly precipitation analysis datasets from NASA GPM IMERG V07:

  • nasa-imerg-analysis-early-v7
  • nasa-imerg-analysis-late-v7

(IMERG Final is intentionally deferred to V08 — V07 Final stopped 2025-09-30.)

The two runs differ only in their source product/URL and update latency, so they share NasaImergRegionJob and a NasaImergAnalysisTemplateConfig base under src/reformatters/nasa/imerg/, mirroring the NOAA GFS forecast/analysis shared-code layout. A single NasaImergSourceFileCoord carries a run field; thin per-run RegionJob subclasses set it via a ClassVar.

Details

  • Source: GES DISC HTTPS with NASA Earthdata Login (reuses the SMAP earthdata_auth pattern). download_file tries the date-appropriate V07C/V07B filename label and falls back to the other.
  • Reading: rasterio over the HDF5 /Grid subdatasets, reorienting the source (time, lon, lat) layout to (latitude, longitude), converting fill values (-9999.9 float / -9999 int16) to NaN. precipitation is converted mm/hr → kg m-2 s-1 to match the existing precipitation_surface / precipitation_flux convention.
  • Variables: precipitation_surface, probability_of_liquid_precipitation_surface, precipitation_quality_index_surface.
  • Grid / time: global 0.1° (1800 × 3600), record from 1998-01-01 (verified against the GES DISC archive listing).
  • Chunking: chunk (1440, 45, 45) / shard (1440, 450, 450) = 30 days/shard (~37 GB per-worker buffer). The memory ↔ read-locality ↔ update-cost tradeoff and lean (720) / premium (2880) alternatives are documented in template_config.py.
  • Storage: Icechunk on AWS Open Data (s3://dynamical-nasa-imerg).
  • Added "0.1 degrees (~10km)" to the shared SpatialResolution literal; added the two non-CF/non-ECMWF variables to the compliance-test exemption lists.

Testing

  • Unit tests for all custom logic (URL building for both runs, V07B/V07C selection, the HDF5 reorientation, fill/scale, coord generation, version-fallback download, operational update jobs, K8s/validators).
  • A fully-mocked backfill_localupdate integration test that runs offline and exercises the whole download → read → write → append pipeline.
  • Slow tests that download and read a real granule from each run (Early & Late) — require Earthdata credentials, so they don't run in plain CI.
  • ruff, ty, and the full non-slow suite pass.

Follow-ups before backfill

  • Verify lat/lon orientation against a real file: the (time,lon,lat)(lat,lon) transpose + latitude flip is implemented from the source spec but only confirmed by the slow tests. Run uv run pytest tests/nasa -m slow with Earthdata credentials before backfilling.
  • Add the datasets to the dynamical.org catalog (separate repo).

Relates to #462

🤖 Generated with Claude Code

aldenks and others added 2 commits June 1, 2026 15:42
Integrate two global half-hourly precipitation analysis datasets from NASA
GPM IMERG V07: nasa-imerg-analysis-early-v7 and nasa-imerg-analysis-late-v7.

The two runs differ only in source product/URL and update latency, so they
share NasaImergRegionJob and a NasaImergAnalysisTemplateConfig base under
src/reformatters/nasa/imerg/ (GFS-style base/subclass split). A single
NasaImergSourceFileCoord carries a `run` field; per-run RegionJob subclasses
set it via a ClassVar.

- Source: GES DISC HTTPS with NASA Earthdata Login (reuses the SMAP auth
  pattern). Tries the date-appropriate V07C/V07B filename label with fallback.
- Reads HDF5 /Grid variables via rasterio, reorienting the source
  (time, lon, lat) layout to (latitude, longitude) and converting fill values
  to NaN. precipitation is converted mm/hr -> kg m-2 s-1 to match the existing
  precipitation_surface / precipitation_flux convention.
- Variables: precipitation_surface, probability_of_liquid_precipitation_surface,
  precipitation_quality_index_surface.
- Grid: global 0.1 deg (1800 x 3600), record from 1998-01-01 (verified on GES
  DISC). Chunk (1440,45,45) / shard (1440,450,450) = 30 days/shard; alternatives
  documented in template_config.

Tests: unit tests for all custom logic, a fully-mocked backfill->update
integration test (runs offline), and slow tests that download and read a real
granule from each run (require Earthdata credentials).

Relates to #462

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…kip-guard integration tests

- Replace the central IMERG_RUN_CONFIG dict + `run` field/ClassVar with two
  NasaImergSourceFileCoord subclasses (one per run) that own their GES DISC
  product id and filename code. The shared base RegionJob is parameterized by a
  `source_file_coord_class` ClassVar set in each run's module, so the base no
  longer knows about specific runs.
- Add tests/integration.py `require_secret` helper: real download-from-source
  tests now run where the kubernetes secret is reachable (kubectl context or a
  mounted secret file) and skip cleanly elsewhere (plain PR CI, contributor
  machines) instead of erroring.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@aldenks aldenks linked an issue Jun 5, 2026 that may be closed by this pull request
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.

IMERG analysis - early and late

1 participant