-
Notifications
You must be signed in to change notification settings - Fork 1
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
Restructure of grid creation code #69
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #69 +/- ##
===========================================
- Coverage 75.86% 69.04% -6.82%
===========================================
Files 3 3
Lines 58 84 +26
===========================================
+ Hits 44 58 +14
- Misses 14 26 +12
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thanks for the update David. A few comments:
|
@vgro The main advantage of the registry is that users can extend the set of grids. They could write: @register_grid('lspace')
def make_l_shaped_grid(...): Honestly, once we've got the three regular polygons that tesselate, it isn't obvious what the use case would be, although I can sort of imagine a situation where someone uses an irregular polygon map. We might want to keep in mind use cases with focal areas of differing size and shape? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have requested a few changes and made a couple of comments, but otherwise I think it looks cleaner and way easier to maintain and test than having an if statement with several branches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good to me, now!
Description
This PR refactors the grid code for three main reasons:
fiona
- while excellent, theconda
dependent install for this is too high a cost. TheShapely
package loses some IO options for a wide range of GIS formats but provides extensive geometry operations.GRID_REGISTRY
and a decorator to populate it: a user extendable dictionary of grid layouts.config
object.The changes also then updates the existing
test_grid.py
to use the new structure, including moving imports outside of test functions.pyproject.toml
andpoetry.lock
are updated to replacefiona
(and tidy up a few misplaced / extraneous dev dependencies).Fixes #28
Type of change
Key checklist
pre-commit
checks:$ pre-commit run -a
$ poetry run pytest
Further checks