Skip to content

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

Open
@bouweandela

Description

@bouweandela

✨ 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Status

    No status

    Status

    📌 Prioritised

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions