Skip to content

Commit

Permalink
Merge pull request #1540 from davemfish/bugfix/UNA-1539-undefined-nodata
Browse files Browse the repository at this point in the history
Nature Access, check for `None` nodata value
  • Loading branch information
phargogh authored Mar 15, 2024
2 parents 74513c0 + 75d544e commit 88b11e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ Unreleased Changes
* Fixed an issue where certain nodata values were not being handled
correctly, leading to pixel values of +/- infinity in the urban nature
balance output raster. https://github.com/natcap/invest/issues/1519
* Fixed an issue where an LULC raster without a nodata value would
always raise in exception during reclassification.
https://github.com/natcap/invest/issues/1539
* SDR
* Fixed an issue encountered in the sediment deposition function where
rasters with more than 2^32 pixels would raise a cryptic error relating
Expand Down
6 changes: 4 additions & 2 deletions src/natcap/invest/urban_nature_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -1854,8 +1854,10 @@ def _reclassify_urban_nature_area(
urban_nature_area = squared_pixel_area * urban_nature_proportion
urban_nature_area_map[lucode] = urban_nature_area

lulc_raster_info = pygeoprocessing.get_raster_info(lulc_raster_path)
urban_nature_area_map[lulc_raster_info['nodata'][0]] = FLOAT32_NODATA
lulc_raster_nodata = pygeoprocessing.get_raster_info(
lulc_raster_path)['nodata'][0]
if lulc_raster_nodata is not None:
urban_nature_area_map[lulc_raster_nodata] = FLOAT32_NODATA

utils.reclassify_raster(
raster_path_band=(lulc_raster_path, 1),
Expand Down

0 comments on commit 88b11e1

Please sign in to comment.