Skip to content

Add use_standard_grid option for CORDEX datasets#3059

Open
bouweandela wants to merge 25 commits into
mainfrom
aladin
Open

Add use_standard_grid option for CORDEX datasets#3059
bouweandela wants to merge 25 commits into
mainfrom
aladin

Conversation

@bouweandela
Copy link
Copy Markdown
Member

@bouweandela bouweandela commented Apr 30, 2026

Description

Add an option to specify use_standard_grid: true for CORDEX datasets to replace the grid by the standard CORDEX grid. Works for rotated pole coordinates and, if the grid mapping is correct, for Lambert conformal coordinates as well.

Also includes a fix for the units of ALADIN53 sftlf and ts.

Closes #2840
Closes #2036

Link to documentation: https://esmvaltool--3059.org.readthedocs.build/projects/ESMValCore/en/3059/recipe/overview.html#cordex-datasets

Backward incompatible change

Replacing the grid by a standard grid is no longer done automatically if grid differences are small, but needs to be enabled on a per-dataset basis by adding use_standard_grid: true to the dataset in the recipe (or default extra facets for the CORDEX project to make it permanent).


Before you get started

Checklist

It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.


To help with the number pull requests:

@bouweandela bouweandela added the fix for dataset Related to dataset-specific fix files label Apr 30, 2026
@bouweandela
Copy link
Copy Markdown
Member Author

bouweandela commented Apr 30, 2026

Recipe for testing:

Details
documentation:
  title: |
    Example recipe that loads CORDEX-CMIP5 datasets.
  description: |
    This is an example recipe that loads CORDEX-CMIP5 datasets.
    It computes the climatology for surface temperature (ts).
  authors:
    - andela_bouwe
  maintainer:
    - andela_bouwe

preprocessors:
  preprocessor:
    extract_region:
      start_longitude: 0
      end_longitude: 2
      start_latitude: 50
      end_latitude: 52

diagnostics:
  land_area_fraction_europe:
    additional_datasets:
      - dataset: ALADIN53
        driver: CNRM-CERFACS-CNRM-CM5
        ensemble: r1i1p1
        institute: CNRM
        rcm_version: v1
      - dataset: ALADIN63
        driver: CNRM-CERFACS-CNRM-CM5
        ensemble: r1i1p1
        institute: CNRM
        rcm_version: v2
    variables:
      sftlf:
        project: CORDEX
        mip: fx
        domain: EUR-11
        exp: historical
        timerange: 2003/2005
        # preprocessor: preprocessor
        use_standard_grid: true
    scripts:
      plot:
        plot_folder: '{plot_dir}'
        plot_filename: '{plot_type}_{real_name}_{alias}_{mip}'
        facet_used_for_labels: 'alias'
        script: monitor/multi_datasets.py
        plots:
          map:
            # plot_func: pcolor
            show_stats: false

  land_area_fraction_south_pole:
    additional_datasets:
      - institute: DMI
        driver: ICHEC-EC-EARTH
        ensemble: r3i1p1
        dataset: HIRHAM5
        rcm_version: v1
    variables:
      sftlf:
        project: CORDEX
        mip: fx
        domain: ANT-44
        exp: historical
        timerange: 2003/2005
        use_standard_grid: true
    scripts:
      plot:
        plot_folder: '{plot_dir}'
        plot_filename: '{plot_type}_{real_name}_{alias}_{mip}'
        facet_used_for_labels: 'alias'
        script: monitor/multi_datasets.py
        plots:
          map:
            show_stats: false
            projection: SouthPolarStereo

@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.18%. Comparing base (65c3797) to head (ecc1ceb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3059      +/-   ##
==========================================
+ Coverage   96.16%   96.18%   +0.01%     
==========================================
  Files         270      271       +1     
  Lines       15831    15905      +74     
==========================================
+ Hits        15224    15298      +74     
  Misses        607      607              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bouweandela bouweandela reopened this May 20, 2026
@bouweandela
Copy link
Copy Markdown
Member Author

bouweandela commented Jun 3, 2026

Code for testing

from esmvalcore.dataset import Dataset
import iris.quickplot
import matplotlib.pyplot as plt

ds = Dataset(
    short_name="sftlf",
    mip="fx",
    project="CORDEX",
    domain="EUR-11",
    dataset="ALADIN63",
    driver="CNRM-CERFACS-CNRM-CM5",
    institute="CNRM",
    exp="historical",
    ensemble="r1i1p1",
    rcm_version="v2",
    timerange="2001/2002",
    use_standard_grid=True,
)
cube = ds.load()
# Plot the data
iris.quickplot.pcolormesh(cube, coords=["projection_x_coordinate", "projection_y_coordinate"])
# Plot coastlines
plt.gca().coastlines()

# To plot individual points:
# iris.quickplot.points(cube, s=1, c=cube.data, coords=["projection_x_coordinate", "projection_y_coordinate"])

# To plot geographical coordinates:
# iris.quickplot.pcolormesh(cube, coords=["longitude", "latitude"])

# To plot grid boxes and points:
# iris.plot.points(cube[:2, :3], coords=["longitude", "latitude"])
# iris.plot.outline(cube[:2, :3], coords=["longitude", "latitude"])

plt.show()

@bouweandela bouweandela changed the title Add fixes for CORDEX Aladin models Add use_standard_grid option for CORDEX datasets Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backwards incompatible change fix for dataset Related to dataset-specific fix files

Projects

Status: In Progress

1 participant