Skip to content

Commit

Permalink
Merge pull request #134 from dcdenu4/bugfix/dropping-band-metadata
Browse files Browse the repository at this point in the history
133 Pass metadata to mask_raster
  • Loading branch information
richpsharp authored Dec 4, 2020
2 parents 4821d5d + 405f513 commit 74b249f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Unreleased Changes
------------------
* ``pygeoprocessing.warp_raster`` now raises a ``ValueError`` when an invalid
resampling method is provided.
* Fixed bug in ``pygeoprocessing.warp_raster`` that would not properly handle
GDAL Byte type signing when masking warped raster with a vector.
* Fixed issue in ``convolve_2d`` that would cause excessive memory use
leading to out of memory errors.
* Fixed issue in ``convolve_2d`` that could lead to a file removal race
Expand Down
6 changes: 5 additions & 1 deletion src/pygeoprocessing/geoprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2030,6 +2030,10 @@ def warp_raster(
callback_data=[target_raster_path])

if vector_mask_options:
# Make sure the raster creation options passed to ``mask_raster``
# reflect any metadata updates
updated_raster_driver_creation_tuple = (
raster_driver_creation_tuple[0], tuple(raster_creation_options))
# there was a cutline vector, so mask it out now, otherwise target
# is already the result.
mask_raster(
Expand All @@ -2039,7 +2043,7 @@ def warp_raster(
where_clause=mask_vector_where_filter,
target_mask_value=None, working_dir=temp_working_dir,
all_touched=False,
raster_driver_creation_tuple=raster_driver_creation_tuple)
raster_driver_creation_tuple=updated_raster_driver_creation_tuple)
shutil.rmtree(temp_working_dir)


Expand Down

0 comments on commit 74b249f

Please sign in to comment.