Skip to content

feat(esmvaltool): add timeseries extraction for regional and ozone diagnostics#607

Merged
lewisjared merged 3 commits intomainfrom
esmvaltool-timeseries-extraction
Mar 31, 2026
Merged

feat(esmvaltool): add timeseries extraction for regional and ozone diagnostics#607
lewisjared merged 3 commits intomainfrom
esmvaltool-timeseries-extraction

Conversation

@lewisjared
Copy link
Copy Markdown
Contributor

@lewisjared lewisjared commented Mar 30, 2026

Description

Add series extraction for ESMValTool regional and ozone diagnostics, and fix file patterns to match the current ESMValTool output directory structure.

Changes:

  • base.py: Add byte string decoding in _extract_series_from_file for NetCDF coordinates stored as byte strings (e.g. shape_id)
  • regional_historical_changes.py:
    • Add ANNUAL_CYCLE_DIAGNOSTICS and TIMESERIES_DIAGNOSTICS constants mapping variable names to ESMValTool diagnostic directory names
    • Add _region_to_filename() helper to convert region names (with ., /, &) to the dash format used in ESMValTool output filenames
    • Update RegionalHistoricalAnnualCycle and RegionalHistoricalTimeSeries file/series patterns to match the new ESMValTool output structure
  • ozone.py:
    • Add file and series definitions for ozone-sh-oct and ozone-nh-mar polar cap timeseries diagnostics
    • Add file definitions for ozone-annual-cycle and ozone-lat-time diagnostics

Note: Test case regression data needs to be regenerated separately via ref test-cases run --force-regen.

Checklist

Please confirm that this pull request has done the following:

  • Tests added
  • Documentation added (where applicable)
  • Changelog item added to changelog/

…agnostics

- Add series extraction for RegionalHistoricalAnnualCycle and
  RegionalHistoricalTimeSeries with updated file patterns matching
  new ESMValTool output directory structure
- Add series extraction for ozone polar cap timeseries diagnostics
  (ozone-sh-oct, ozone-nh-mar) and file definitions for ozone
  annual cycle and lat-time diagnostics
- Add byte string decoding in _extract_series_from_file for NetCDF
  coordinates stored as byte strings (e.g. shape_id)
- Add _region_to_filename helper to convert region names with special
  characters (., /, &) to dash format used in ESMValTool filenames
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
core 93.18% <ø> (ø)
providers 91.85% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ool/src/climate_ref_esmvaltool/diagnostics/base.py 96.96% <100.00%> (+0.04%) ⬆️
...ol/src/climate_ref_esmvaltool/diagnostics/ozone.py 92.15% <100.00%> (+0.57%) ⬆️
...valtool/diagnostics/regional_historical_changes.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for extracting time series outputs from additional ESMValTool diagnostics (regional historical + ozone), and updates output file/series glob patterns to match ESMValTool’s current directory/layout conventions.

Changes:

  • Added diagnostic-to-directory mappings and a region-name filename normalizer for regional annual-cycle and timeseries diagnostics, and updated plot/NetCDF file patterns accordingly.
  • Added FileDefinition / SeriesDefinition entries for ozone polar-cap timeseries plus file definitions for ozone annual-cycle and lat–time diagnostics.
  • Enhanced _extract_series_from_file to decode byte-string NetCDF coordinates (e.g., shape_id) into normal strings.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/climate-ref-esmvaltool/src/climate_ref_esmvaltool/diagnostics/regional_historical_changes.py Updates regional diagnostic output patterns and adds mapping/helpers to align with current ESMValTool output structure.
packages/climate-ref-esmvaltool/src/climate_ref_esmvaltool/diagnostics/ozone.py Adds missing file/series definitions so ozone diagnostics can surface plots and extract timeseries data.
packages/climate-ref-esmvaltool/src/climate_ref_esmvaltool/diagnostics/base.py Adds byte-string decoding when extracting series indices from NetCDF outputs.
changelog/607.feature.md Records the new extraction support and file pattern updates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lewisjared lewisjared merged commit ddfb8d4 into main Mar 31, 2026
18 checks passed
@lewisjared lewisjared deleted the esmvaltool-timeseries-extraction branch March 31, 2026 10:31
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