-
Notifications
You must be signed in to change notification settings - Fork 175
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
More geometry tools (will be used for reproject
eventually)
#600
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #600 +/- ##
===========================================
+ Coverage 85.33% 86.05% +0.72%
===========================================
Files 82 84 +2
Lines 7846 7975 +129
===========================================
+ Hits 6695 6863 +168
+ Misses 1151 1112 -39
Continue to review full report at Codecov.
|
- move utils/geometry.py to utils/geometry/_base.py - re-export public classes and methods
These will be used for reproject roi computation
- estimate affine transform from points - decompose affine transform into parts - figure out scale change for a locally linear transform
with some changes to use datacube structure, also adding tests, also with special case for "same crs" case.
If two geoboxes share same CRS their pixel<>pixel transform is a linear mapping, expose that fact and the actual transform via `.linear` attribute on the returned function.
Copied from dea-proto + adding special case for same crs transforms
reproject
eventually)
Not all CRSs have epsg code, deal gracefully with those that don't
also adding more tests and some docs
Reasons for removal - creates new threadpool on every invocation (high overhead) - doesn't expose important parameters like level of concurrency - netcdf reading/writing is not thread-safe, so this won't help in the most common case - needs really large reads to actually have a benefit (see high overhead) - introduces dependency on not-portable SharedArray library - was added for s3aio driver and was tuned for that use-case, should go into s3aio driver - no tests
avoid circular dependencies
This address issue #602. Also `.buffer` was swapping order of y/x padding, fixing that too.
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 won't pretend to have reviewed the details of every new function, but
- I like the refactoring and cleaning
- The code looks readable
- Tests look reasonable
- Includes some documentation
I've added some of your PR comments about compute_reproject_roi()
into the code since it seems to fit, and touched up a couple of the other docstrings.
Thanks Kirill
The removal of the |
@woodcockr we are working on making concurrent open/read possible with the driver infrastructure, this is a significant change, but it would allow proper implementation of concurrency within the driver itself. Removing I have document problems with that approach in a commit message see here df544c8 Replicated below:
So it's also an issues of correctness for those users of datacube that rely on ingested netcdfs as their primary storage format. |
@Kirill888 I read and understood the "problems" you indicated, but it is a breaking change for s3aio applications and performance of the driver. Thankfully I picked it up before we updated to the latest release. I didn't expect a pull request labelled "More geometry tools" to contain a unrelated to geometry and breaking change. I was curious on a few things you were doing and just happened to spot this in time. |
fair point, my bad for not putting this into a separate PR |
A separate PR would be helpful, so would discussing it with those impacted before it being accepted. Now we need to figure out how to fix it...can we roll back the change and split the PR and commit the other changes and then discuss the breaking change? was pretty sure we'd isolated the impact on anything other than S3AIO when it's pull request was first accepted, including the dependency issue (it's optional). |
doc -> pytest
)utils.geometry.py
->utils.geometry._base.py
_base
dea_proto: geom.py
toutils.geometry.tools.py
use_threads
option from coreTop level method of interest is:
compute_reproject_roi(src:GeoBox, dst:GeoBox) -> (roi: slice, scale: float)
Given two geoboxes find region within source
GeoBox
that overlaps with destinationGeoBox
, also compute scale factor. The idea is that:src[roi] -> scale -> reproject -> dst
src(scale)[roi(scale)] -> reproject -> dst
Here
roi
is "minimal", padding is configureable though, so you only read what you need. Alsoscale
can be used to pick the right kind of overview level to read.