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

Feature/pyramid reproject map blocks #12

Closed
wants to merge 25 commits into from

Conversation

jhamman
Copy link
Contributor

@jhamman jhamman commented Nov 23, 2021

This PR adds a new feature to the pyramid_reproject function. Rather than iterating over extra dimensions in each DataArray, we now allow the DataArray to be chunked as a dask.array. Under the hood we use xarray.map_blocks to execute rioxarray's reproject function.

Joseph Hamman and others added 17 commits November 22, 2021 20:17
updates:
- [github.com/pre-commit/pre-commit-hooks: v3.4.0 → v4.1.0](pre-commit/pre-commit-hooks@v3.4.0...v4.1.0)
- https://github.com/ambv/blackhttps://github.com/psf/black
- [github.com/psf/black: 20.8b1 → 21.12b0](psf/black@20.8b1...21.12b0)
- https://gitlab.com/pycqa/flake8https://github.com/PyCQA/flake8
- [github.com/PyCQA/flake8: 3.9.0 → 4.0.1](PyCQA/flake8@3.9.0...4.0.1)
- https://github.com/pre-commit/mirrors-isorthttps://github.com/PyCQA/isort
- [github.com/PyCQA/isort: v5.8.0 → 5.10.1](PyCQA/isort@v5.8.0...5.10.1)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
pyramid[lkey] = xr.Dataset(attrs=ds.attrs)
shape = (dim, dim)
for k, da in ds.items():
template_shape = (chunked_dim_sizes) + shape # TODO: pick up here.
Copy link
Member

Choose a reason for hiding this comment

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

where is chunked_dim_sizes supposed to come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. Clearly I didn't finish this part.

If I recall correctly, this is mean to support cases where non-spatial dims are chunked. The most common examples would be chunks along the band or time dimensions.

To do this, we need to construct a template that includes the correct shape for each block.

@andersy005
Copy link
Member

pre-commit.ci autofix

@maxrjones
Copy link
Contributor

Thanks for starting work on this Joe and Anderson! I'm planning to pick this feature up, but since the code base has changed a bunch it'll be easier to work in a fresh PR so I'll close this one now.

@maxrjones maxrjones closed this Mar 19, 2024
@andersy005 andersy005 deleted the feature/pyramid-reproject-map-blocks branch March 19, 2024 18:35
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.

Use xarray.map_blocks to speed up pyramid_reproject
3 participants