Skip to content

Conversation

@schlunma
Copy link
Contributor

@schlunma schlunma commented Feb 17, 2022

Description

The default behavior of iris.cube.Cube.extract() is to return a scalar coordinate if only a single value is extracted. This causes some NCL diagnostics to fail if clip_timerange extracts only single point in time. This PR fixes this behavior.

Closes #1496


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:

@schlunma schlunma added the bug Something isn't working label Feb 17, 2022
@schlunma schlunma added this to the v2.5.0 milestone Feb 17, 2022
@schlunma schlunma self-assigned this Feb 17, 2022
Copy link
Contributor

@valeriupredoi valeriupredoi left a comment

Choose a reason for hiding this comment

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

cool, thanks, Manu! Just a minor note that we should check units and calendar are preserved too

@codecov
Copy link

codecov bot commented Feb 17, 2022

Codecov Report

Merging #1497 (7c07230) into main (51a8a02) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1497   +/-   ##
=======================================
  Coverage   90.71%   90.72%           
=======================================
  Files         197      197           
  Lines       10517    10527   +10     
=======================================
+ Hits         9541     9551   +10     
  Misses        976      976           
Impacted Files Coverage Δ
esmvalcore/preprocessor/_time.py 95.65% <100.00%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 51a8a02...7c07230. Read the comment docs.

@schlunma
Copy link
Contributor Author

nice, can you add a call to units preservation as well please?

Added!

I also added support for cases where time is not the first dimension. Never seen this in any dataset, but better safe than sorry 😄

Copy link
Contributor

@valeriupredoi valeriupredoi left a comment

Choose a reason for hiding this comment

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

sehr gut 😁 I've never seen time anywhere but the 0th dimension either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clip_timerange squeezes time dimensions

3 participants