Use tolerance in reproject() only for Rasterio>1.4.3 and re-structure chunked ops
#681
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.
This PR specifies the
toleranceargument only for certain versions of Rasterio and above (to avoid undefined keyword arguments being passed to GDAL), and re-structures chunked operations to be more logically organized (and avoid circular import conflicts).Tolerance argument
I realized we forgot to add this @vschaffn:
Organization of chunked operation
Additionally, this PR re-writes
_reproject()to call on a single and consistent_rio_reproject()function either directly or through_reproject_block()within Multiprocessing or Dask (otherwise we had 2 different codes running reprojection).This allows to have consistent behaviour (output dtype, nodata, number of threads and memory limit, etc).
And it will be useful to add Dask support in #446.
In terms of structure, this PR adds a
_geotransformations.pymodule where all subfunctions ofgeotransformationsthat need to be re-used in other modules can be moved (e.g., for Dask/Multiprocessing chunked implementations of these functions).It also moves out generic chunked functions from
delayed_dask.pyinto achunked.pymodule, where they are called from bothmultiproc.py(for Multiprocessing) anddask.py(renamed fromdelayed_dask.py, for Dask).Original problem
The only problem was the code structure: Having
_rio_reprojectinraster/geotransformationscauses a circular import problem, as it needs to be imported by_reproject_blockinraster/distributed_computing/, which is contained in_reproject_multiproc(or_dask) there, that is finally imported inraster/geotransformationsagain.So I've left
_rio_reprojectinraster/distributed_computing/for now, but we might have to think about how this will affect our architecture, as there will be the exact same problem for every chunked operation we implement!