Replies: 4 comments 4 replies
-
I solved my problem like this, b.t.w.:
This corresponds to writing
Apparently a tuple of integers or |
Beta Was this translation helpful? Give feedback.
-
Take a look at In cases where advanced indexing is needed, we usually construct something similar to your example in https://github.com/SciTools/iris-grib/discussions/302#discussioncomment-3915696. |
Beta Was this translation helpful? Give feedback.
-
Moving this over to Iris. Hold on to your hats! |
Beta Was this translation helpful? Give feedback.
-
Does import iris.cube
import iris.coords
foo_coord = iris.coords.DimCoord(1, long_name='foo')
bar_coord = iris.coords.DimCoord(1, long_name='bar')
cube = iris.cube.Cube([[1]])
for dim, coord in enumerate([foo_coord, bar_coord]):
cube.add_dim_coord(coord, dim)
print(cube)
print(cube.extract(iris.Constraint(bar=1)))
|
Beta Was this translation helpful? Give feedback.
-
Hi,
I was just wondering if Iris has any analogue to
numpy.take
?I have a cube
c
and want to do is something similar toc[:, 0, :, :, 0, ...]
where some indices should be0
and the rest of the indices beslice(None)
and where the positions of all zero-indices are stored in a set. I want to do this since those zeros represent dimensions inc
that always only have one point in them and therefore safely can be discarded. I know I can do this withc.collapsed
, but then I need to provide an aggregator, which feels unnecessary when the entire operation basically just amounts to a reshaping of the data.Beta Was this translation helpful? Give feedback.
All reactions