-
Notifications
You must be signed in to change notification settings - Fork 301
Open
Description
β¨ Feature Request
Functionality to generate a slice tuple that can be used to subset a cube with a given constraint. This could be a standalone function, or a method on iris.Constraint. Usage might look like this:
height_constraint = iris.Constraint(height=9000)
slices_tuple = height_constraint.as_slices_tuple(cube)
subset_cube = cube[slices_tuple]
# Equivalent to:
subset_cube = height_contstraint.extract(cube)Motivation
This would allow for assigning data to a subset of a cube directly, rather than operating on a copy of the cube region. For example, setting all points at height=9000 to zero:
cube[slices_tuple] = 0Additional context
Click to expand this section...
It looks like β_ColumnIndexManager.as_slice already provides this functionality, but it is not part of the public API.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status
Status
Backlog