Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broadcast properly cell_measures when using extract_shape with decomposed: True #2348

Merged
merged 7 commits into from
Apr 3, 2024

Conversation

sloosvel
Copy link
Contributor

@sloosvel sloosvel commented Feb 26, 2024

Description

This PR makes sure that time-dependent cell measures are broadcasted properly to a cube with a shape_id coordinate.
Closes #2347

Link to documentation:


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:

@sloosvel sloosvel added the preprocessor Related to the preprocessor label Feb 26, 2024
@sloosvel sloosvel added this to the v2.11.0 milestone Feb 26, 2024
Copy link

codecov bot commented Feb 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.10%. Comparing base (3a0b49f) to head (66c7ee0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2348   +/-   ##
=======================================
  Coverage   94.10%   94.10%           
=======================================
  Files         246      246           
  Lines       13477    13482    +5     
=======================================
+ Hits        12682    12687    +5     
  Misses        795      795           

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

Copy link
Contributor

@schlunma schlunma left a comment

Choose a reason for hiding this comment

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

Thanks Saskia, looks good to me, just have two minor comments.

esmvalcore/preprocessor/_area.py Outdated Show resolved Hide resolved
esmvalcore/preprocessor/_area.py Show resolved Hide resolved
sloosvel and others added 3 commits February 27, 2024 09:11
@sloosvel
Copy link
Contributor Author

Thanks for the comments @schlunma , I added a comment and changed a bit the condition to also make it work when only one region is extracted and the result cube has no shape_id dimension. Here is a recipe to test both cases:

  description: |
    This a recipe to monitor experiments by automatizing the creation of plots
    from raw preprocessor output.
  authors:
    - vegas-regidor_javier
  maintainer:
    - loosveldt-tomas_saskia


datasets:
- dataset: EC-Earth3-CC
  ensemble: r1i1p1f1
  grid: gn
  exp: historical
  mip: Omon
  project: CMIP6

preprocessors:
  extract_two_regions:
    extract_shape:
      shapefile: AR6
      method: contains
      crop: False
      decomposed: True
      ids: {Acronym: [EAO, WAF]}
    volume_statistics:
      operator: mean
  extract_one_region:
    extract_shape:
      shapefile: AR6
      method: contains
      crop: False
      decomposed: True
      ids: {Acronym: [EAO]}
    volume_statistics:
      operator: mean

diagnostics:
  timeseries:
    variables:
      thetao_1:
        short_name: thetao
        timerange: '1950/1952'
        preprocessor: extract_two_regions
      thetao_2:
        short_name: thetao
        timerange: '1950/1952'
        preprocessor: extract_one_region
    scripts: null

Copy link
Contributor

@schlunma schlunma left a comment

Choose a reason for hiding this comment

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

Thanks Saskia for making the changes, everything looks good now! The output of the recipe looks as expected 🚀

@bouweandela bouweandela merged commit fcd5455 into main Apr 3, 2024
7 checks passed
@bouweandela bouweandela deleted the dev_volcello_extract_shape branch April 3, 2024 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preprocessor Related to the preprocessor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preprocessor shape 'extract_shape' breaks if cell measure is time dependent
3 participants