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

Apply spatial mask across non-spatial dimensions #156

Closed

Conversation

colinahill
Copy link

This fixes issue #155

@@ -318,6 +318,17 @@ def mask(
value_inside=not invert,
)

# Repeat rasterized mask across all non-spatial dims
Copy link
Member

Choose a reason for hiding this comment

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

Instead of using spatial_dims method to get names of spatial dimensions, can you please use xx.odc.ydim to obtain location of the y-axis (x-axis always follows y) and expand rasterized using that.

non_sdims = (*xx.dims[:ydim], xx.dims[ydim+2:])

@robbibt
Copy link
Contributor

robbibt commented May 31, 2024

Hey @colinahill, I'm not sure it should be necessary to loop over the non-spatial dims - theoretically xarray should handle all that automatically when the code runs this .where() line: https://github.com/opendatacube/odc-geo/blob/develop/odc/geo/_xr_interop.py#L321-L322

I've unfortunately also not been able to reproduce the issue - running something like this on a multi-temporal dataset successfully applies the mask to all timesteps:
image

@alexgleith
Copy link
Contributor

Closing as it seems it's not necessary and there's been no response from the proposer.

@alexgleith alexgleith closed this Sep 26, 2024
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.

4 participants