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

♻️ Use xarray.merge with join="override" in collate functions #72

Merged
merged 2 commits into from
Oct 2, 2022

Conversation

weiji14
Copy link
Owner

@weiji14 weiji14 commented Oct 2, 2022

Refactoring the xarray collate functions to use xr.merge instead of the dictionary style way of appending data variables to an xarray.Dataset.

Preview at https://zen3geo--72.org.readthedocs.build/en/72/vector-segmentation-masks.html#stacking-the-raster-layers

This is a solution adapted from 7787f8e in #62 that is more robust to images being cut off due to rounding issues as with 6b18934 in #31.

Patches #62 and #31.

Refactoring the xarray collate functions to use `xr.merge` instead of the dictionary style way of appending data variables to an xarray.Dataset. Solution adapted from 7787f8e in #62 that is more robust to images being cut off due to rounding issues as with 6b18934 in #31. Downside is the need to verbosely rename the xarray.DataArray objects, and handle some conflicting coordinate labels.
A few whitespace fixes and fixing some DataPipe references.
@weiji14 weiji14 added the documentation Improvements or additions to documentation label Oct 2, 2022
@weiji14 weiji14 added this to the 0.6.0 milestone Oct 2, 2022
@weiji14 weiji14 self-assigned this Oct 2, 2022
@weiji14
Copy link
Owner Author

weiji14 commented Oct 2, 2022

Debating on whether to turn xarray.merge into a DataPipe.

On one hand, this would keep things DRY (Don't Repeat Yourself). On the other hand:

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away

Will meditate on this for a while.

@weiji14 weiji14 merged commit d83fedf into main Oct 2, 2022
@weiji14 weiji14 deleted the collate_using_xr_merge branch October 2, 2022 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant