From 436ec8e3c0179d4547072a9d31f74d49ffd8ff69 Mon Sep 17 00:00:00 2001 From: Emily Davis Date: Fri, 4 Oct 2024 11:05:48 -0600 Subject: [PATCH 1/3] Use reprojected access vector in rasterization task --- src/natcap/invest/habitat_quality.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/natcap/invest/habitat_quality.py b/src/natcap/invest/habitat_quality.py index 2bf024fe46..301c18cfc7 100644 --- a/src/natcap/invest/habitat_quality.py +++ b/src/natcap/invest/habitat_quality.py @@ -555,7 +555,7 @@ def execute(args): rasterize_access_task = task_graph.add_task( func=pygeoprocessing.rasterize, - args=(args['access_vector_path'], access_raster_path), + args=(reprojected_access_path, access_raster_path), kwargs={ 'option_list': ['ATTRIBUTE=ACCESS'], 'burn_values': None From e7ea91b1c8fb1ba112325bc52a71f43c50c0747d Mon Sep 17 00:00:00 2001 From: Emily Soth Date: Mon, 7 Oct 2024 14:10:56 -0700 Subject: [PATCH 2/3] update SDR variable names and correct typo in docstring #1629 --- src/natcap/invest/sdr/sdr_core.pyx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/natcap/invest/sdr/sdr_core.pyx b/src/natcap/invest/sdr/sdr_core.pyx index 69fc7500e4..345ef6ab76 100644 --- a/src/natcap/invest/sdr/sdr_core.pyx +++ b/src/natcap/invest/sdr/sdr_core.pyx @@ -356,13 +356,13 @@ def calculate_sediment_deposition( This algorithm outputs both sediment deposition (t_i) and flux (f_i):: - t_i = dr_i * (sum over j ∈ J of f_j * p(i,j)) + E'_i + t_i = dt_i * (sum over j ∈ J of f_j * p(j,i)) - f_i = (1 - dr_i) * (sum over j ∈ J of f_j * p(i,j)) + E'_i + f_i = (1 - dt_i) * (sum over j ∈ J of f_j * p(j,i)) + E'_i (sum over k ∈ K of SDR_k * p(i,k)) - SDR_i - dr_i = -------------------------------------------- + dt_i = -------------------------------------------- (1 - SDR_i) where: @@ -645,21 +645,21 @@ def calculate_sediment_deposition( if sdr_i == 1: # This reflects property B in the user's guide and is # an edge case to avoid division-by-zero. - dr_i = 1 + dt_i = 1 else: - dr_i = (downslope_sdr_weighted_sum - sdr_i) / (1 - sdr_i) + dt_i = (downslope_sdr_weighted_sum - sdr_i) / (1 - sdr_i) # Lisa's modified equations - t_i = dr_i * f_j_weighted_sum # deposition, a.k.a trapped sediment - f_i = (1 - dr_i) * f_j_weighted_sum + e_prime_i # flux + t_i = dt_i * f_j_weighted_sum # deposition, a.k.a trapped sediment + f_i = (1 - dt_i) * f_j_weighted_sum + e_prime_i # flux - # On large flow paths, it's possible for dr_i, f_i and t_i + # On large flow paths, it's possible for dt_i, f_i and t_i # to have very small negative values that are numerically # equivalent to 0. These negative values were raising # questions on the forums and it's easier to clamp the # values here than to explain IEEE 754. - if dr_i < 0: - dr_i = 0 + if dt_i < 0: + dt_i = 0 if t_i < 0: t_i = 0 if f_i < 0: From 759cb83da168d7d85265d90e95262b55d55f970c Mon Sep 17 00:00:00 2001 From: Emily Davis Date: Mon, 7 Oct 2024 15:29:04 -0600 Subject: [PATCH 3/3] Update HISTORY --- HISTORY.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index dfa49b3025..5ab3fd4117 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -48,6 +48,9 @@ Unreleased Changes * Fixed a bug that, in certain scenarios, caused a datastack to be saved with relative paths when the Relative Paths checkbox was left unchecked (https://github.com/natcap/invest/issues/1609) +* Habitat Quality + * Access raster is now generated from the reprojected access vector. + (https://github.com/natcap/invest/issues/1615) 3.14.2 (2024-05-29) -------------------