-
Notifications
You must be signed in to change notification settings - Fork 296
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] = 0
Additional 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.
hdyson and bjlittle
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status