Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow n-dimensional arrays into polygonize in DD #253

Open
wants to merge 1 commit into
base: dd
Choose a base branch
from

Conversation

asinghvi17
Copy link
Member

@asinghvi17 asinghvi17 commented Jan 25, 2025

This allows polygonize over an n-dimensional datacube to generate an n-2 dimensional datacube of geometries / featurecollections...kind of like R style vector data cubes.

Maybe we should allow the values to be unpacked into an n-1th dimension so we can unpack the polygons too.

This is particularly useful when polygonizing datacubes.

@asinghvi17 asinghvi17 requested a review from rafaqz January 25, 2025 22:58
else
map(eachslice(A; dims = DD.otherdims(A, dims))) do a
ap = PermutedDimsArray(a, dims)
GO.polygonize(bounds_vecs..., a; crs, kw...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just pass through the dims kw instead of permuting?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The x and y dims need to be in the same order as the lookups though, so I'm not sure how we'd do this...

Copy link
Member

@rafaqz rafaqz Jan 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't it already fix that with dims ordering? It probably should...

Maybe it's counter intuitive but reordering dims in the inner loop is essentially free, so usually faster than array wrappers that have a runtime Indirection

(Ohh right it's not a DD alg internally so it has to be slow... unfortunate why would I write something like that 😭)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants