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

✨ XarrayCanvasIterDataPipe for creating blank datashader canvas #34

Merged
merged 5 commits into from
Aug 12, 2022

Conversation

weiji14
Copy link
Owner

@weiji14 weiji14 commented Aug 12, 2022

An iterable-style DataPipe for creating a blank canvas from raster images. This initiates the integration of zen3geo with datashader!

Preview at https://zen3geo--34.org.readthedocs.build/en/34/api.html#zen3geo.datapipes.XarrayCanvas

Part 1 out of 2 of superseding #32. Decided that while datashader has heavier dependencies like scipy, it is a more scalable and structured, multi-step way of doing rasterization of vector data. 1st step being to define a canvas, and 2nd step is to burn the vector (points/lines/polygons) onto that canvas via some aggregation function.

TODO:

  • Initial implementation of XarrayCanvasIterDataPipe
  • Add unit tests
  • Return CRS information also (do in follow up Pull Request perhaps)?

Quickly and accurately render even the largest data, and pandas extension arrays for spatial/geometric operations!

Unfortunately, had to pin the maximum Python version to 3.11 because scipy (the version with Python 3.10 wheels) sets a hard upper pin for Python <3.12.
An iterable-style DataPipe for creating a blank canvas from raster images! The datashader.Canvas is created based on the input xarray object's spatial extent and coordinates, with the metadata obtained using rioxarray. Included a doctest for getting a datashader.Canvas from an xarray.DataArray. Added a new section in the API docs and intersphinx mappings for datashader.
@weiji14 weiji14 added the feature New feature or request label Aug 12, 2022
@weiji14 weiji14 added this to the 0.3.0 milestone Aug 12, 2022
@weiji14 weiji14 self-assigned this Aug 12, 2022
Include the 'spatial' extras dependencies in the Continuous Integration tests, and install datashader for Readthedocs. Also mentioned installing the 'spatial' extras in CONTRIBUTING.md.
Ensure that xarray.Dataset objects can be turned into a datashader.Canvas too! Clarified that the `.rio.x_dim` and `.rio.y_dim` attributes are required, and made some minor stylistic changes to the docstring and code in datashader.py.
@weiji14 weiji14 marked this pull request as ready for review August 12, 2022 20:36
Fixes `AttributeError: 'NoneType' object has no attribute 'Canvas'` when the optional datashader dependency is not installed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant