Skip to content

Commit

Permalink
Merge pull request natcap#1459 from phargogh/bugfix/1458-pollination-…
Browse files Browse the repository at this point in the history
…sample-outputs-have-a-lot-of-nans

Restoring nodata values in pollination
  • Loading branch information
emlys authored Dec 6, 2023
2 parents 79f128a + ed7861c commit f7597fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ Unreleased Changes
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
* Fixed a regression where nodata values were not being properly compared.
This was only an issue in some development builds after 3.14.0.
(`#1458 <https://github.com/natcap/invest/issues/1458>`_)
* Replaced custom kernel implementation with ``pygeoprocessing.kernels``.
Convolution results may be slightly different (more accurate).
* SDR
Expand Down
11 changes: 8 additions & 3 deletions src/natcap/invest/pollination.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,8 @@ def execute(args):
foraged_flowers_index_path,
floral_resources_index_path_map[species],
convolve_ps_path],
target_path=pollinator_abundance_path),
target_path=pollinator_abundance_path,
target_nodata=_INDEX_NODATA),
dependent_task_list=[
foraged_flowers_index_task_map[(species, season)],
floral_resources_index_task_map[species],
Expand Down Expand Up @@ -1430,7 +1431,9 @@ def _multiply_by_scalar(raster_path, scalar, target_path):
pygeoprocessing.raster_map(
op=lambda array: array * scalar,
rasters=[raster_path],
target_path=target_path)
target_path=target_path,
target_nodata=_INDEX_NODATA,
)


def _calculate_pollinator_supply_index(
Expand All @@ -1451,7 +1454,9 @@ def _calculate_pollinator_supply_index(
pygeoprocessing.raster_map(
op=lambda f_r, h_n: species_abundance * f_r * h_n,
rasters=[habitat_nesting_suitability_path, floral_resources_path],
target_path=target_path)
target_path=target_path,
target_nodata=_INDEX_NODATA
)


@validation.invest_validator
Expand Down

0 comments on commit f7597fa

Please sign in to comment.