Skip to content

Commit

Permalink
Finished Algae Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kewalak committed Mar 27, 2024
1 parent 69bbfef commit db5ab9a
Show file tree
Hide file tree
Showing 2 changed files with 961 additions and 17 deletions.
40 changes: 38 additions & 2 deletions src/clearwater_modules/nsm1/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,25 @@ def FN(
KsN: Michaelis-Menton half-saturation constant relating inorganic N to algal growth (mg-N/L)
"""

FN_orig = xr.where(use_NH4 or use_NO3, (NH4 + NO3) / (KsN + NH4 + NO3), 1)
#FN_orig = xr.where(use_NH4 or use_NO3, (NH4 + NO3) / (KsN + NH4 + NO3), 1)

FN_orig: np.ndarray = np.select(
condlist= [
use_NH4 == True and use_NO3 == True,
use_NH4 == False and use_NO3 == True,
use_NH4 == True and use_NO3 == False,
use_NH4 == False and use_NO3 == False,
],

choicelist= [
(NH4 + NO3) / (KsN + NH4 + NO3),
(NO3) / (KsN + NO3),
(NH4) / (KsN + NH4),
1
],

default = 1
)


FN: np.ndarray = np.select(
Expand Down Expand Up @@ -853,8 +871,26 @@ def FNb(
KsNb: Michaelis-Menton half-saturation constant relating inorganic N to benthic algal growth (mg-N/L)
"""

FNb_orig = xr.where(use_NH4 or use_NO3, (NH4 + NO3) / (KsNb + NH4 + NO3),1)
#FNb_orig = xr.where(use_NH4 or use_NO3, (NH4 + NO3) / (KsNb + NH4 + NO3),1)

FNb_orig: np.ndarray = np.select(
condlist= [
use_NH4 == True and use_NO3 == True,
use_NH4 == True and use_NO3 == False,
use_NH4 == False and use_NO3 == True,
use_NH4 == False and use_NO3 == False,
],

choicelist= [
(NH4 + NO3) / (KsNb + NH4 + NO3),
(NH4) / (KsNb + NH4),
(NO3) / (KsNb + NO3),
1
],

default = 1
)

FNb: np.ndarray = np.select(
condlist= [
math.isnan(FNb_orig),
Expand Down
Loading

0 comments on commit db5ab9a

Please sign in to comment.