diff --git a/HISTORY.rst b/HISTORY.rst index b7d0b077ae..3608338b41 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -58,9 +58,10 @@ Unreleased Changes * Version metadata at import time is now fetched with ``importlib.metadata`` instead of ``pkg_resources``. (`#1442 `_) -* Pollination - * Replaced custom kernel implementation with ``pygeoprocessing.kernels``. - Convolution results may be slightly different (more accurate). +* Coastal Vulnerability + * Fixed a bug where the model would crash when processing a float type + bathymetry raster with no nodata value. + https://github.com/natcap/invest/issues/992 * NDR * Fixing an issue where minor geometric issues in the watersheds input (such as a ring self-intersection) would raise an error in the model. @@ -71,6 +72,9 @@ Unreleased Changes * Fixed an issue in NDR's effective retention where, on rasters with more than 2^31 pixels, the model would crash with an error relating to a negative (overflowed) index. https://github.com/natcap/invest/issues/1431 +* Pollination + * Replaced custom kernel implementation with ``pygeoprocessing.kernels``. + Convolution results may be slightly different (more accurate). * SDR * RKLS, USLE, avoided erosion, and avoided export rasters will now have nodata in streams (`#1415 `_) diff --git a/src/natcap/invest/coastal_vulnerability.py b/src/natcap/invest/coastal_vulnerability.py index ff247987df..3f591231c0 100644 --- a/src/natcap/invest/coastal_vulnerability.py +++ b/src/natcap/invest/coastal_vulnerability.py @@ -2194,14 +2194,7 @@ def warp_and_mask_bathymetry( bathymetry_raster_path) bathy_nodata = bathy_info['nodata'][0] if bathy_nodata is None: - # If a nodata value is not provided, assume the largest positive value - # that the datatype can support. Once we finish masking bathymetry, - # all positive values are masked out anyways so this should be safe. - try: - bathy_nodata = numpy.finfo(bathy_info['numpy_type']).max - except ValueError: - # When the numpy dtype is not a float, must be an int. - bathy_nodata = numpy.iinfo(bathy_info['numpy_type']).max + bathy_nodata = pygeoprocessing.choose_nodata(bathy_info['numpy_type']) bathy_target_dtype = bathy_info['datatype'] clip_and_project_raster(