Skip to content

Commit

Permalink
Allow Negative Values
Browse files Browse the repository at this point in the history
All tests passing besides one test in Carbon and one in CBOD marked to fail with reason known issue with kbod 20 test TBA.
  • Loading branch information
kewalak committed Sep 24, 2024
1 parent fadcbcc commit 016b73d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/clearwater_modules/nsm1/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ def Ap(
dApdt: Change in algae biomass concentration (ug-Chla/L/d)
dt: current iteration dt (d)
"""
return xr.where(Ap + dApdt * dt >0, Ap + dApdt * dt ,0)
return Ap + dApdt * dt

############################################ From benthic algae

Expand Down Expand Up @@ -1104,7 +1104,7 @@ def Ab(
"""

return xr.where(Ab + dAbdt * dt > 0 , Ab + dAbdt * dt, 0)
return Ab + dAbdt * dt


def Chlb(
Expand Down Expand Up @@ -1423,7 +1423,7 @@ def OrgN(
"""

return xr.where(OrgN + dOrgNdt * dt > 0 , OrgN + dOrgNdt * dt , 0)
return OrgN + dOrgNdt * dt

def NitrificationInhibition(
use_DOX: bool,
Expand Down Expand Up @@ -1605,7 +1605,7 @@ def NH4(
"""

return xr.where(NH4 + dNH4dt * dt > 0 , NH4 + dNH4dt * dt , 0)
return NH4 + dNH4dt * dt

def NO3_Denit(
use_DOX: bool,
Expand Down Expand Up @@ -1750,7 +1750,7 @@ def NO3(
"""

return xr.where(NO3 + dNO3dt * dt > 0 , NO3 + dNO3dt * dt, 0)
return NO3 + dNO3dt * dt


def DIN(
Expand Down Expand Up @@ -2111,7 +2111,7 @@ def TIP(
TIP: Total inorganic phosphorus water concentration (mg-P/L),
dt: current iteration dt (d)
"""
return xr.where(TIP + dTIPdt * dt > 0, TIP + dTIPdt * dt,0)
return TIP + dTIPdt * dt


def OrgP(
Expand All @@ -2127,7 +2127,7 @@ def OrgP(
OrgP: Total organic phosphorus water concentration (mg-P/L),
dt: current iteration dt (d)
"""
return xr.where(OrgP + dOrgPdt * dt >0 , OrgP + dOrgPdt * dt,0)
return OrgP + dOrgPdt * dt

def TOP(
use_OrgP: bool,
Expand Down Expand Up @@ -2332,7 +2332,7 @@ def POM(
POM: POM concentration from previous dt (mg/L)
dt: Current iteration dt (d)
"""
return xr.where(POM + dPOMdt * dt >0, POM + dPOMdt * dt, 0)
return POM + dPOMdt * dt


################################## From CBOD
Expand Down Expand Up @@ -2437,7 +2437,7 @@ def CBOD(
dCBODdt: CBOD concentration change for current dt (mg/L/d)
dt: current iteration dt (d)
"""
return xr.where(CBOD + dCBODdt * dt >0, CBOD + dCBODdt * dt,0)
return CBOD + dCBODdt * dt

############################### From Carbon

Expand Down Expand Up @@ -2565,7 +2565,7 @@ def POC(
dPOCdt: POC concentration change for current dt (mg/L/d)
dt: current iteration dt (d)
"""
return xr.where(POC + dPOCdt * dt>0, POC + dPOCdt * dt,0)
return POC + dPOCdt * dt


def DOC_algal_mortality(
Expand Down Expand Up @@ -2686,7 +2686,7 @@ def DOC(
dDOCdt: Dissolved organic carbon concentration change for current dt (mg/L/d)
dt: current iteration dt (d)
"""
return xr.where(DOC + dDOCdt * dt > 0, DOC + dDOCdt * dt, 0)
return DOC + dDOCdt * dt



Expand Down Expand Up @@ -2873,7 +2873,7 @@ def DIC(
dDICdt: Change in concentration of DIC for current dt (mg/L/d)
dt: Current iteration dt (d)
"""
return xr.where(DIC + dDICdt * dt >0, DIC + dDICdt * dt,0)
return DIC + dDICdt * dt


######################################## From DOX
Expand Down Expand Up @@ -3138,7 +3138,7 @@ def DOX(
dDOXdt: Change in dissolved oxygen concentration over dt
dt: Current iteration dt (d)
"""
return xr.where(DOX + dDOXdt * dt>0, DOX + dDOXdt * dt, 0)
return DOX + dDOXdt * dt

######################################### From pathogen

Expand Down Expand Up @@ -3244,7 +3244,7 @@ def PX(
PX: Pathogen concentration (cfu/100mL)
dt: Current iteration dt (d)
"""
return xr.where(PX + dt * dPXdt >0, PX + dt * dPXdt , 0)
return PX + dt * dPXdt


##################################### From alkalinity
Expand Down Expand Up @@ -3450,7 +3450,7 @@ def Alk(
dAlkdt: Change in concentration of alkalinity for current dt (mg/L/d)
dt: Current iteration dt (d)
"""
return xr.where(Alk + dAlkdt * dt > 0, Alk + dAlkdt * dt, 0)
return Alk + dAlkdt * dt

##################################### From N2

Expand Down Expand Up @@ -3524,7 +3524,7 @@ def N2(
dt: Current iteration dt (d)
"""

return xr.where(N2 + dN2dt * dt > 0 , N2 + dN2dt * dt , 0)
return N2 + dN2dt * dt

def TDG(
N2: xr.DataArray,
Expand Down

0 comments on commit 016b73d

Please sign in to comment.