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

Extract region from a cube with 2D latitude/longitude coordinates #4197

Open
bouweandela opened this issue Jun 15, 2021 · 7 comments
Open

Extract region from a cube with 2D latitude/longitude coordinates #4197

bouweandela opened this issue Jun 15, 2021 · 7 comments
Labels
Feature: ESMValTool Feature: GeoVista Use cases for adding Iris-GeoVista interoperability conveniences

Comments

@bouweandela
Copy link
Member

✨ Feature Request

Motivation

When working with ocean model data, it would be really convenient if iris.cube.Cube.intersection supported 2D latitude and longitude coordinates. Currently

import iris

cube = iris.load_cube("http://esgf1.dkrz.de/thredds/dodsC/cmip5/cmip5/output1/MPI-M/MPI-ESM-LR/historical/mon/ocean/Omon/r1i1p1/v20120625/tos/tos_Omon_MPI-ESM-LR_historical_r1i1p1_185001-200512.nc")

cube.intersection(
    longitude=(10, 20),
    latitude=(10, 20),
    ignore_bounds=True,
)

throws a

CoordinateMultiDimError: Multi-dimensional coordinate not supported: 'longitude'

These coordinates are 2D because they are close enough to a rectangular grid to make this a meaningful data storage format. Therefore it makes sense to be able to select a rectangular cube slice for this type of data. Any points that are outside the region but inside the rectangular slice could e.g. be masked.

I recently implemented something like this in ESMValGroup/ESMValCore#245, but it would be much nicer if this could be supported in iris.

@trexfeathers
Copy link
Contributor

Thanks @bouweandela! We'd love a PR from you if this is something you'd like to see 🙂

@bouweandela
Copy link
Member Author

Thanks! I'll try to find some time to do this soon.

@rcomer rcomer added the Peloton 🚴‍♂️ Target a breakaway issue to be caught and closed by the peloton label Aug 25, 2021
@trexfeathers
Copy link
Contributor

@bouweandela is this still important to you? We're unlikely to dedicate time to it at the UK Met Office:

  • Quite niche
  • Quite difficult
  • You've demonstrated there are other ways of achieving this

@bouweandela
Copy link
Member Author

Yes, still interesting, I'll try to have a look at this soon. I would have expected this is an interesting feature for the met office too since you've recently added support for meshes? Or is there some other way to extract a region from data that is on non rectangular grid?

@trexfeathers
Copy link
Contributor

I would have expected this is an interesting feature for the met office too since you've recently added support for meshes? Or is there some other way to extract a region from data that is on non rectangular grid?

Ah, this is indeed an important question! But the arrival of truly unstructured meshes has also complicated the question...

  • Is the region a rectangle (bounded by lon + lat lines), or bounded by great circles on all sides?
  • What to do with cells that are partially in the region?
    • Exclude?
    • Include?
    • Re-shape?

To avoid making assumptions wherever possible, we've been exploring using GeoVista/PyVista for regional extraction (example), since it should be able to support any required case. But it's early days yet.

@trexfeathers trexfeathers removed the Peloton 🚴‍♂️ Target a breakaway issue to be caught and closed by the peloton label May 5, 2022
@trexfeathers trexfeathers moved this to 🆕 New in ESMValTool Feb 20, 2023
@ESadek-MO ESadek-MO added the Feature: GeoVista Use cases for adding Iris-GeoVista interoperability conveniences label May 24, 2023
@ESadek-MO
Copy link
Contributor

We've not forgotten about this, this is a candidate for a future sprint on Feature: GeoVista Use cases for adding Iris-GeoVista interoperability conveniences integration.

Copy link
Contributor

github-actions bot commented Oct 6, 2024

In order to maintain a backlog of relevant issues, we automatically label them as stale after 500 days of inactivity.

If this issue is still important to you, then please comment on this issue and the stale label will be removed.

Otherwise this issue will be automatically closed in 28 days time.

@github-actions github-actions bot added the Stale A stale issue/pull-request label Oct 6, 2024
@bjlittle bjlittle removed the Stale A stale issue/pull-request label Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: ESMValTool Feature: GeoVista Use cases for adding Iris-GeoVista interoperability conveniences
Projects
Status: No status
Status: No status
Development

No branches or pull requests

6 participants