weiji14 / zen3geo

The 🌏 data science library you've been waiting for~
http://zen3geo.rtfd.io/en/latest/walkthrough.html
GNU Lesser General Public License v3.0
77 stars 3 forks source link

:recycle: Refactor DatashaderRasterizer to be up front about datapipe lengths #39

Closed weiji14 closed 2 years ago

weiji14 commented 2 years ago

Check during initialization of DatashaderRasterizerIterDataPipe on whether the input canvas and vector datapipes have compatible lengths. This is better than finding out that the zip function doesn't work when the datapipe is being iterated over. Added a unit test to cover the 3:2 ratio case and documented why the ValueError is raised on unmatched lengths. Also renamed the previous ValueError on unsupported geometry types to NotImplementedError to avoid confusion.

Motivated by issues discovered in #31 (see af489a8d9fecf1fd0241e5b62a7abdf0f0b2f0dd) when some DataPipe functions like https://pytorch.org/data/0.4/generated/torchdata.datapipes.iter.BatchMapper.html do not return any lengths.

Patches #35.