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
Track CRS info in BoundingBox and changes to GeoBox constructors #38
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adding .crs property to BoundingBox class, it no longer derives from namedtuple so there is some potential for breakage compared to what's in datacube-core.
.from_transform - construct from shape+affine .polygon return geometry from bbox
compute footprint of geobox in any projection with configurable padding and precision
`align=` was too confusing and hard to document, concept of anchor I feel is more reasonable. You can anchor pixel edges to 0,0 or pixel center to 0,0, or you can leave it floating. Or you can pick any location within a pixel and say that 0,0 should coincide with that. center == (0.5, 0.5) edge == (0, 0) Also replacing _align_pix methods, that were hard to decipher, with snap_grid method in odc.geo.math
Codecov Report
@@ Coverage Diff @@
## develop #38 +/- ##
===========================================
+ Coverage 97.91% 97.99% +0.07%
===========================================
Files 19 19
Lines 2595 2690 +95
===========================================
+ Hits 2541 2636 +95
Misses 54 54
Continue to review full report at Codecov.
|
gadomski
approved these changes
Apr 25, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BoundingBox was an odd one out without CRS info attached, now it has that
Changes to GeoBox.from_bbox
Essentially if you take
0,0
in the real world, bring it to pixel space and locate pixel that contains it, then you want location within that pixel to be a certain point in[0, 1), [0, 1)
, so0,0
is edge aligned, same asalign=(0,0)
used to be, and to get center aligned pixel you pick(0.5, 0.5)
. Also you can just not align at all, in which case resulted geobox will start at left,top and might go a little bit over right, bottom.Also adds some more convenience methods to bounding box and geobox.
Closes #25