Coordinate system agnostic region extraction by david-bentley · Pull Request #7266 · SciTools/iris · GitHub
Skip to content

Coordinate system agnostic region extraction - #7266

Open
david-bentley wants to merge 11 commits into
SciTools:mainfrom
david-bentley:enhancement/region_extract
Open

david-bentley wants to merge 11 commits into
SciTools:mainfrom
david-bentley:enhancement/region_extract

Conversation

@david-bentley

Copy link
Copy Markdown

Description

Add a function to extract a region, decoupling the specified region bounds from the coordinate system of the cube. For example, given a cube in a rotated pole coordinate system

>>> print(cube)
air_pressure / (Pa)                 (grid_latitude: 151; grid_longitude: 97)
    Dimension coordinates:
        grid_latitude                             x                    -
        grid_longitude                            -                    x
    Scalar coordinates:
        forecast_reference_time     2013-08-15 03:00:00
        level_height                5.0 m
        sigma                       0.9994238, bound=(1.0, 0.99846387)
        time                        2013-08-15 11:00:00
    Attributes:
        Conventions                 'CF-1.7'
        STASH                       m01s00i408
        source                      'Data from Met Office Unified Model'
        um_version                  '8.2'

one can specify a subregion in a regular lat/lon coordinate system to extract that region from the rotated pole cube:

>>> area = (-4.790656510485121, 50.14530257322982, -3.450313532058675, 51.72890111361691)
>>> print(iris.util.extract_region(cube, area, crs=ccrs.PlateCarree()))
air_pressure / (Pa)                 (grid_latitude: 120; grid_longitude: 66)
    Dimension coordinates:
        grid_latitude                             x                    -
        grid_longitude                            -                    x
    Scalar coordinates:
        forecast_reference_time     2013-08-15 03:00:00
        level_height                5.0 m
        sigma                       0.9994238, bound=(1.0, 0.99846387)
        time                        2013-08-15 11:00:00
    Attributes:
        Conventions                 'CF-1.7'
        STASH                       m01s00i408
        source                      'Data from Met Office Unified Model'
        um_version                  '8.2'

The function accepts the same keyword arguments as cube.intersection() (e.g. ignore_bounds, threshold).

Closes #6855

Checklist

@CLAassistant

Copy link
Copy Markdown

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Coordinate system agnostic region extraction

2 participants