Skip to content

Commit

Permalink
Merge pull request #147 from LabSid-USP/124-enable-export-of-the-resu…
Browse files Browse the repository at this point in the history
…lting-total-runoff-raster-series

Enable export of the resulting Total Runoff (RNF) raster series and time series
  • Loading branch information
soaressgabriel authored Feb 27, 2024
2 parents fd2430b + 7425202 commit 283eda0
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 8 deletions.
57 changes: 55 additions & 2 deletions doc/source/fileformats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -736,12 +736,26 @@ Resulting maps of Soil Moisture Content (SMC) [mm] in raster format for all simu
- Columns = :ref:`clone columns<fileformats:Mask of Catchment (Clone) raster>`;
- Cell Size = :ref:`clone cell size<fileformats:Mask of Catchment (Clone) raster>`.

Total Runoff raster series
^^^^^^^^^^^^^^^^^^^^^^^^^^

Resulting maps of Total Runoff [mm] in raster format for all simulation period for each pixel of :ref:`clone map <fileformats:Mask of Catchment (Clone) raster>`.

- Filetype: PCRaster map format (:file:`rnf00000.001`- :file:`rnf99999.999` raster map series).
- Unit: :raw-html:`m<sup>3</sup>s<sup>-1</sup>`
- Dimensions:

- Rows = :ref:`clone rows <fileformats:Mask of Catchment (Clone) raster>`;
- Columns = :ref:`clone columns<fileformats:Mask of Catchment (Clone) raster>`;
- Cell Size = :ref:`clone cell size<fileformats:Mask of Catchment (Clone) raster>`.


Accumulated Total Runoff raster series
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Resulting maps of Accumulated Total Runoff [:raw-html:`m<sup>3</sup>s<sup>-1</sup>`] in raster format for all simulation period for each pixel of :ref:`clone map <fileformats:Mask of Catchment (Clone) raster>`.

- 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:`m<sup>3</sup>s<sup>-1</sup>`
- Dimensions:

Expand Down Expand Up @@ -988,6 +1002,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 <fileformats:Stations (samples) raster>`.

- 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 <fileformats:Stations (samples) raster>`.

- Filetype: Comma-Separated Values (CSV) :file:`*.csv`
- Unit: mm
- Dimensions:
Expand Down Expand Up @@ -1025,7 +1078,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:`m<sup>3</sup>s<sup>-1</sup>`] in table format for all simulation period for each sampling station present in :ref:`stations map <fileformats:Stations (samples) raster>`.
Resulting maps of Accumulated Total Runoff (ARN) [:raw-html:`m<sup>3</sup>s<sup>-1</sup>`] in table format for all simulation period for each sampling station present in :ref:`stations map <fileformats:Stations (samples) raster>`.

- Filetype: Comma-Separated Values (CSV) :file:`*.csv`
- Unit: :raw-html:`m<sup>3</sup>s<sup>-1</sup>`
Expand Down
3 changes: 2 additions & 1 deletion doc/source/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,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]
Expand Down
16 changes: 14 additions & 2 deletions doc/source/userguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -760,15 +760,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. <fileformats:Accumulated Total Runoff raster series>`

.. 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:`m<sup>3</sup>s<sup>-1</sup>`] result maps in raster format for each of the time steps included in the simulation period. :ref:`See more. <fileformats:Accumulated Total Runoff raster series>`
Optional boolean value. If enabled, this option allows the generation of Accumulated Total Runoff (ARN) [:raw-html:`m<sup>3</sup>s<sup>-1</sup>`] result maps in raster format for each of the time steps included in the simulation period. :ref:`See more. <fileformats:Accumulated Total Runoff raster series>`

.. code-block:: dosini
[GENERATE_FILE]
rnf = True
arn = True
Configuration File Template
---------------------------
Expand Down Expand Up @@ -855,6 +866,7 @@ Configuration File Template
rec = True
smc = True
rnf = True
arn = True
tss = True
[RASTER_FILE_FORMAT]
Expand Down
11 changes: 10 additions & 1 deletion rubem/_dynamic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,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 @@ -58,7 +59,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 @@ -108,6 +110,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 @@ -160,6 +168,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 @@ -114,6 +114,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
13 changes: 11 additions & 2 deletions 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 @@ -80,6 +85,7 @@ def any_enabled(self) -> bool:
self.rec,
self.smc,
self.rnf,
self.arn,
]
)

Expand All @@ -100,6 +106,7 @@ def all_enabled(self) -> bool:
self.rec,
self.smc,
self.rnf,
self.arn,
]
)

Expand All @@ -112,7 +119,9 @@ 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"Accumulated Total Runoff (RNF): {'Enabled' if self.rnf else 'Disabled'}\n"
f"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}"
)

3 changes: 3 additions & 0 deletions tests/unit/configuration/test_model_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class TestModelConfiguration:
"rec": True,
"smc": True,
"rnf": True,
"arn": True,
"tss": True,
},
"RASTER_FILE_FORMAT": {"map_raster_series": True, "tiff_raster_series": True},
Expand Down Expand Up @@ -154,6 +155,7 @@ class TestModelConfiguration:
rec = True
smc = True
rnf = True
arn = True
tss = True
[RASTER_FILE_FORMAT]
map_raster_series = True
Expand Down Expand Up @@ -240,6 +242,7 @@ class TestModelConfiguration:
"rec": true,
"smc": true,
"rnf": true,
"arn": true,
"tss": true
},
"RASTER_FILE_FORMAT": {
Expand Down

0 comments on commit 283eda0

Please sign in to comment.