Replies: 4 comments 4 replies
|
I solved my problem like this, b.t.w.: This corresponds to writing Apparently a tuple of integers or |
0 replies
|
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. |
1 reply
|
Moving this over to Iris. Hold on to your hats! |
1 reply
|
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))) |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I was just wondering if Iris has any analogue to
numpy.take?I have a cube
cand want to do is something similar toc[:, 0, :, :, 0, ...]where some indices should be0and 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 incthat 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.All reactions