Skip to content

Commit

Permalink
Add support for Total Runoff (RNF) output variable
Browse files Browse the repository at this point in the history
  • Loading branch information
soaressgabriel committed Feb 23, 2024
1 parent f0fa3f3 commit f142696
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
11 changes: 10 additions & 1 deletion rubem/_dynamic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def __getEnabledOutputVars(self):
"rec": self.config.output_variables.rec,
"smc": self.config.output_variables.smc,
"rnf": self.config.output_variables.rnf,
"arn": self.config.output_variables.arn,
}

def __stepUpdateOutputVars(self):
Expand All @@ -78,7 +79,8 @@ def __stepUpdateOutputVars(self):
"lfw": self.LF,
"rec": self.REC,
"smc": self.TUr,
"rnf": self.runoff,
"rnf": self.Qtot,
"arn": self.runoff,
}

def __stepReport(self):
Expand Down Expand Up @@ -129,6 +131,12 @@ def __setupTimeoutputTimeseries(self):
self.config.raster_files.sample_locations,
noHeader=True,
)
self.TssFileAccRun = pcrfw.TimeoutputTimeseries(
"tss_arn",
self,
self.config.raster_files.sample_locations,
noHeader=True,
)
self.TssFileInt = pcrfw.TimeoutputTimeseries(
"tss_itp",
self,
Expand Down Expand Up @@ -181,6 +189,7 @@ def __setupTimeoutputTimeseries(self):
"rec": self.TssFileRec.sample,
"smc": self.TssFileSsat.sample,
"rnf": self.TssFileRun.sample,
"arn": self.TssFileAccRun.sample,
}
# Information for output, get sample location numbers - integer,
# from 1 to n
Expand Down
1 change: 1 addition & 0 deletions rubem/configuration/model_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def __init__(
rec=str_to_bool(self.__get_setting("GENERATE_FILE", "rec")),
smc=str_to_bool(self.__get_setting("GENERATE_FILE", "smc")),
rnf=str_to_bool(self.__get_setting("GENERATE_FILE", "rnf")),
arn=str_to_bool(self.__get_setting("GENERATE_FILE", "arn")),
tss=str_to_bool(self.__get_setting("GENERATE_FILE", "tss")),
output_format=(
OutputFileFormat.PCRASTER
Expand Down
9 changes: 8 additions & 1 deletion rubem/configuration/output_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ class OutputVariables:
:param smc: Enable or disable Soil Moisture Content (SMC). Defaults to `False`.
:type smc: bool, optional
:param rnf: Enable or disable Accumulated Total Runoff (RNF). Defaults to `False`.
:param rnf: Enable or disable Total Runoff (RNF). Defaults to `False`.
:type rnf: bool, optional
:param rnf: Enable or disable Accumulated Total Runoff (ARN). Defaults to `False`.
:type rnf: bool, optional
:param tss: Enable or disable Create time output time series (TSS). Defaults to `False`.
Expand All @@ -48,6 +51,7 @@ def __init__(
rec: bool = False,
smc: bool = False,
rnf: bool = False,
arn: bool = False,
tss: bool = False,
output_format: OutputFileFormat = OutputFileFormat.PCRASTER,
) -> None:
Expand All @@ -60,6 +64,7 @@ def __init__(
self.rec = rec
self.smc = smc
self.rnf = rnf
self.arn = arn
self.tss = tss
self.file_format = output_format

Expand All @@ -72,6 +77,7 @@ def __init__(
and not self.rec
and not self.smc
and not self.rnf
and not self.arn
):
self.logger.warning("No output variables selected.")

Expand All @@ -84,6 +90,7 @@ def __str__(self) -> str:
f"Lateral Flow (LFW): {'Enabled' if self.lfw else 'Disabled'}\n"
f"Recharge (REC): {'Enabled' if self.rec else 'Disabled'}\n"
f"Soil Moisture Content (SMC): {'Enabled' if self.smc else 'Disabled'}\n"
f"Total Runoff (RNF): {'Enabled' if self.rnf else 'Disabled'}\n"
f"Accumulated Total Runoff (RNF): {'Enabled' if self.rnf else 'Disabled'}\n"
f"Create time output time series (TSS): {'Enabled' if self.tss else 'Disabled'}\n"
f"Output format: {self.file_format}"
Expand Down

0 comments on commit f142696

Please sign in to comment.