Skip to content
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

warp_raster is missing an option to specify the overview level #326

Closed
phargogh opened this issue Jun 24, 2023 · 0 comments · Fixed by #337
Closed

warp_raster is missing an option to specify the overview level #326

phargogh opened this issue Jun 24, 2023 · 0 comments · Fixed by #337
Assignees
Labels
bug Something isn't working in progress Working on it!
Milestone

Comments

@phargogh
Copy link
Member

If overviews are present in a raster, GDAL will automatically pick an overview level to use that it thinks is reasonable. This leads to unexpected results.

gdal.Warp has an option to specify the overviewLevel, and if overviewLevel=0, it uses the base raster. We should expose this in the warp_raster API.

@phargogh phargogh added the bug Something isn't working label Jun 24, 2023
@phargogh phargogh self-assigned this Jun 24, 2023
phargogh added a commit to phargogh/pygeoprocessing that referenced this issue Jun 24, 2023
@phargogh phargogh added this to the 2.4.1 milestone Aug 1, 2023
@phargogh phargogh added the in progress Working on it! label Aug 27, 2023
phargogh added a commit to phargogh/pygeoprocessing that referenced this issue Aug 27, 2023
phargogh added a commit to phargogh/pygeoprocessing that referenced this issue Aug 27, 2023
Also adding a test for this functionality.  RE:natcap#326
phargogh added a commit to phargogh/pygeoprocessing that referenced this issue Aug 27, 2023
gdal.WarpOptions in GDAL < 3.4 did not handle all supported gdal.GRA_*
resampling options, instead using the incomplete set of options under
gdal.GRIORA_*.  This was fixed in GDAL 3.4.  The change introduced in
this commit handles both approaches to interpreting the resample
algorithm names available with this rough algorithm:

1. If gdal.WarpOptions() handles the name, use that.
2. Otherwise (if the name is unknown because of the gdal.GRIORA_* issue
   or if a shorthand is used instead, like '-rb' instead of '-r
   bilinear'), interpret the name from the GRA_* attribute name.

Testing this solution on my computer works on GDAL < 3.4 (3.3 tested)
and also on GDAL >= 3.4 (3.7 tested).

RE:natcap#326
phargogh added a commit to phargogh/pygeoprocessing that referenced this issue Aug 27, 2023
phargogh added a commit to phargogh/pygeoprocessing that referenced this issue Aug 27, 2023
phargogh added a commit to phargogh/pygeoprocessing that referenced this issue Aug 28, 2023
phargogh added a commit to phargogh/pygeoprocessing that referenced this issue Aug 28, 2023
phargogh added a commit to phargogh/pygeoprocessing that referenced this issue Aug 28, 2023
phargogh added a commit to phargogh/pygeoprocessing that referenced this issue Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in progress Working on it!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant