From f142696b7365ae9b42154084f3d1b33aa5436fa8 Mon Sep 17 00:00:00 2001 From: Gabriel Soares <70075435+soaressgabriel@users.noreply.github.com> Date: Thu, 22 Feb 2024 21:02:20 -0300 Subject: [PATCH 1/4] Add support for Total Runoff (RNF) output variable --- rubem/_dynamic_model.py | 11 ++++++++++- rubem/configuration/model_configuration.py | 1 + rubem/configuration/output_variables.py | 9 ++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/rubem/_dynamic_model.py b/rubem/_dynamic_model.py index ab12cbc..696db16 100644 --- a/rubem/_dynamic_model.py +++ b/rubem/_dynamic_model.py @@ -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): @@ -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): @@ -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, @@ -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 diff --git a/rubem/configuration/model_configuration.py b/rubem/configuration/model_configuration.py index 74efcab..d99d04a 100644 --- a/rubem/configuration/model_configuration.py +++ b/rubem/configuration/model_configuration.py @@ -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 diff --git a/rubem/configuration/output_variables.py b/rubem/configuration/output_variables.py index a59a6ed..0a87aa7 100644 --- a/rubem/configuration/output_variables.py +++ b/rubem/configuration/output_variables.py @@ -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`. @@ -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: @@ -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 @@ -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.") @@ -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}" From 64ea6e877c9a57fc62c1ca9008379b5912ce6fe0 Mon Sep 17 00:00:00 2001 From: Gabriel Soares <70075435+soaressgabriel@users.noreply.github.com> Date: Mon, 26 Feb 2024 15:24:49 -0300 Subject: [PATCH 2/4] Add "arn" key to test config dictionary, INI and JSON strs --- tests/unit/configuration/test_model_configuration.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/unit/configuration/test_model_configuration.py b/tests/unit/configuration/test_model_configuration.py index 68658ab..8fb6c5c 100644 --- a/tests/unit/configuration/test_model_configuration.py +++ b/tests/unit/configuration/test_model_configuration.py @@ -80,6 +80,7 @@ class TestModelConfiguration: "rec": True, "smc": True, "rnf": True, + "arn": True, "tss": True, }, "RASTER_FILE_FORMAT": {"map_raster_series": True, "tiff_raster_series": True}, @@ -156,6 +157,7 @@ class TestModelConfiguration: rec = True smc = True rnf = True + arn = True tss = True [RASTER_FILE_FORMAT] map_raster_series = True @@ -243,6 +245,7 @@ class TestModelConfiguration: "rec": true, "smc": true, "rnf": true, + "arn": true, "tss": true }, "RASTER_FILE_FORMAT": { From 49fb8f797be9adca4c183228d1d480f977e790c3 Mon Sep 17 00:00:00 2001 From: Gabriel Soares <70075435+soaressgabriel@users.noreply.github.com> Date: Mon, 26 Feb 2024 15:25:30 -0300 Subject: [PATCH 3/4] Fix typo in output variable name --- rubem/configuration/output_variables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rubem/configuration/output_variables.py b/rubem/configuration/output_variables.py index 0a87aa7..efd2978 100644 --- a/rubem/configuration/output_variables.py +++ b/rubem/configuration/output_variables.py @@ -91,7 +91,7 @@ def __str__(self) -> str: 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"Accumulated Total Runoff (ARN): {'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}" ) From 8d314ed54ba9283a5350c6df805e4b16503bb39b Mon Sep 17 00:00:00 2001 From: Gabriel Soares <70075435+soaressgabriel@users.noreply.github.com> Date: Mon, 26 Feb 2024 15:39:28 -0300 Subject: [PATCH 4/4] Update fileformats.rst with changes to Total Runoff and Accumulated Total Runoff --- doc/source/fileformats.rst | 57 ++++++++++++++++++++++++++++++++++++-- doc/source/tutorials.rst | 3 +- doc/source/userguide.rst | 16 +++++++++-- 3 files changed, 71 insertions(+), 5 deletions(-) diff --git a/doc/source/fileformats.rst b/doc/source/fileformats.rst index 0dc8ee3..7db41cb 100644 --- a/doc/source/fileformats.rst +++ b/doc/source/fileformats.rst @@ -755,12 +755,26 @@ Resulting maps of Soil Moisture Content (SMC) [mm] in raster format for all simu - Columns = :ref:`clone columns`; - Cell Size = :ref:`clone cell size`. +Total Runoff raster series +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Resulting maps of Total Runoff [mm] in raster format for all simulation period for each pixel of :ref:`clone map `. + +- Filetype: PCRaster map format (:file:`rnf00000.001`- :file:`rnf99999.999` raster map series). +- Unit: :raw-html:`m3s-1` +- Dimensions: + + - Rows = :ref:`clone rows `; + - Columns = :ref:`clone columns`; + - Cell Size = :ref:`clone cell size`. + + Accumulated Total Runoff raster series ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Resulting maps of Accumulated Total Runoff [:raw-html:`m3s-1`] in raster format for all simulation period for each pixel of :ref:`clone map `. -- Filetype: PCRaster map format (:file:`rnf00000.001`- :file:`rnf99999.999` raster map series). +- Filetype: PCRaster map format (:file:`arn00000.001`- :file:`arn99999.999` raster map series). - Unit: :raw-html:`m3s-1` - Dimensions: @@ -1007,6 +1021,45 @@ Soil Moisture Content table Resulting maps of Soil Moisture Content (SMC) [mm] in table format for all simulation period for each sampling station present in :ref:`stations map `. +- Filetype: Comma-Separated Values (CSV) :file:`*.csv` +- Unit: mm +- Dimensions: + + - Rows = number of time steps; + - Columns = number of sampling stations from the station map. + +.. list-table:: Basic file structure: + :header-rows: 1 + + * - Time Step + - Station #1 + - Station #2 + - `...` + - Station #N + + * - 1 + - Float <\*> + - Float <\*> + - `...` + - Float <\*> + + * - `...` + - `...` + - `...` + - `...` + - `...` + + * - N + - Float <\*> + - Float <\*> + - `...` + - Float <\*> + +Total Runoff table +^^^^^^^^^^^^^^^^^^ + +Resulting maps of Total Runoff (RNF) [mm] in table format for all simulation period for each sampling station present in :ref:`stations map `. + - Filetype: Comma-Separated Values (CSV) :file:`*.csv` - Unit: mm - Dimensions: @@ -1044,7 +1097,7 @@ Resulting maps of Soil Moisture Content (SMC) [mm] in table format for all simul Accumulated Total Runoff table ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Resulting maps of Accumulated Total Runoff [:raw-html:`m3s-1`] in table format for all simulation period for each sampling station present in :ref:`stations map `. +Resulting maps of Accumulated Total Runoff (ARN) [:raw-html:`m3s-1`] in table format for all simulation period for each sampling station present in :ref:`stations map `. - Filetype: Comma-Separated Values (CSV) :file:`*.csv` - Unit: :raw-html:`m3s-1` diff --git a/doc/source/tutorials.rst b/doc/source/tutorials.rst index 6f02c15..5102dc8 100644 --- a/doc/source/tutorials.rst +++ b/doc/source/tutorials.rst @@ -475,7 +475,8 @@ The complete project configuration file should look like this: lfw = False rec = True smc = False - rnf = True + rnf = False + arn = True tss = True [RASTER_FILE_FORMAT] diff --git a/doc/source/userguide.rst b/doc/source/userguide.rst index 6550d63..8dc9ed9 100644 --- a/doc/source/userguide.rst +++ b/doc/source/userguide.rst @@ -771,15 +771,26 @@ Optional boolean value. If enabled, this option allows the generation of Soil Mo [GENERATE_FILE] smc = True +Total Runoff +```````````` + +Optional boolean value. If enabled, this option allows the generation of Total Runoff (RNF) [mm] result maps in raster format for each of the time steps included in the simulation period. :ref:`See more. ` + +.. code-block:: dosini + + [GENERATE_FILE] + rnf = True + + Accumulated Total Runoff ```````````````````````` -Optional boolean value. If enabled, this option allows the generation of Accumulated Total Runoff [:raw-html:`m3s-1`] result maps in raster format for each of the time steps included in the simulation period. :ref:`See more. ` +Optional boolean value. If enabled, this option allows the generation of Accumulated Total Runoff (ARN) [:raw-html:`m3s-1`] result maps in raster format for each of the time steps included in the simulation period. :ref:`See more. ` .. code-block:: dosini [GENERATE_FILE] - rnf = True + arn = True Configuration File Template --------------------------- @@ -867,6 +878,7 @@ Configuration File Template rec = True smc = True rnf = True + arn = True tss = True [RASTER_FILE_FORMAT]