Tools to interact with mHM.
More...
|
| get_parameter () |
| Get parameter names and configuration.
|
|
| get_runoff () |
| Get 2D array of runoff time-series for all gauges.
|
|
| get_runoff_eval (gauge_id) |
| Get 2D array of simulated and observed runoff time-series for selected gauges.
|
|
| get_mask (level, indexing="ij", selection=False) |
| Get mask for a certain mHM level.
|
|
| get_variable (name, index=1, indexing="ij", compressed=False) |
| Get a specific variable from mHM in the current time-step.
|
|
| set_meteo (time, pre=None, temp=None, pet=None, tmin=None, tmax=None, netrad=None, absvappress=None, windspeed=None, ssrd=None, strd=None, tann=None, compressed=False, indexing="ij") |
| Set meteo data with a time stamp in mHM.
|
|
Tools to interact with mHM.
- Copyright
- Copyright 2005-2023, the mHM Developers, Luis Samaniego, Sabine Attinger: All rights reserved. mHM is released under the LGPLv3+ license
The UFZ(CHS) mesoscale hydrologic model mHM is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the free Software Foundation either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You received a copy of the GNU Lesser General Public License along with the UFZ CHS mesoscale hydrologic model mHM. It can be found in the files COPYING
and COPYING.LESSER
provided with this software. The complete GNU license text can also be found at http://www.gnu.org/licenses/.
◆ get_mask()
mhm.tools.get_mask |
( |
|
level, |
|
|
|
indexing = "ij" , |
|
|
|
selection = False |
|
) |
| |
Get mask for a certain mHM level.
- Parameters
-
level | (str): Name level ("L0", "L1", "L11", "L2") |
indexing | (str, optional): Indexing for the 2D mask, either "xy" or "ij" (yx order), by default "ij" |
selection | (bool): A masked value in mHM indicates cells inside the domain. In numpy, masked values are outside the domain. That means, by default False |
- Return values
-
mask | (numpy.ndarray): Boolean numpy array holding the mask. |
- Exceptions
-
ValueError | If the level is not in ["L0", "L1", "L11" or "L2"]. |
Definition at line 48 of file tools.py.
◆ get_parameter()
mhm.tools.get_parameter |
( |
| ) |
|
Get parameter names and configuration.
- Return values
-
names | (List[Str]): Names of all used parameters in mHM. |
config | (numpy.ndarray): Configuration for all used parameters (min, max, value, flag, scale). |
Definition at line 13 of file tools.py.
◆ get_runoff()
Get 2D array of runoff time-series for all gauges.
- Return values
-
runoff | (numpy.ndarray): The runoff for all gauges with dims (time, gauge). |
Definition at line 28 of file tools.py.
◆ get_runoff_eval()
mhm.tools.get_runoff_eval |
( |
|
gauge_id | ) |
|
Get 2D array of simulated and observed runoff time-series for selected gauges.
- Return values
-
runoff | (numpy.ndarray(TS, 2)): The runoff for selected gauges with dims (time-steps, 2). |
Definition at line 38 of file tools.py.
◆ get_variable()
mhm.tools.get_variable |
( |
|
name, |
|
|
|
index = 1 , |
|
|
|
indexing = "ij" , |
|
|
|
compressed = False |
|
) |
| |
Get a specific variable from mHM in the current time-step.
- Parameters
-
name | (str): Name of the variable |
index | (int, optional): If the variable has an additional dimension (e.g. the horizon), one needs to specify an index, by default 1 |
indexing | (str, optional): Indexing for the 2D variable, either "xy" or "ij", by default "ij" |
compressed | (bool): Whether the data should be flattened and only contain values for each unmasked domain cell. By default False |
- Return values
-
variable | (numpy.ndarray): Numpy array holding the desired variable. |
- Exceptions
-
ValueError | If the variable name doesn't start with "L0", "L1", "L11" or "L2". |
Definition at line 71 of file tools.py.
◆ set_meteo()
mhm.tools.set_meteo |
( |
|
time, |
|
|
|
pre = None , |
|
|
|
temp = None , |
|
|
|
pet = None , |
|
|
|
tmin = None , |
|
|
|
tmax = None , |
|
|
|
netrad = None , |
|
|
|
absvappress = None , |
|
|
|
windspeed = None , |
|
|
|
ssrd = None , |
|
|
|
strd = None , |
|
|
|
tann = None , |
|
|
|
compressed = False , |
|
|
|
indexing = "ij" |
|
) |
| |
Set meteo data with a time stamp in mHM.
- Parameters
-
time | (datetime.datetime): Timestamp |
pre | (numpy.ndarray, optional): [mm] Precipitation |
temp | (numpy.ndarray, optional): [degC] Air temperature |
pet | (numpy.ndarray, optional): [mm TS-1] Potential evapotranspiration |
tmin | (numpy.ndarray, optional): [degC] minimum daily air temperature |
tmax | (numpy.ndarray, optional): [degC] maximum daily air temperature |
netrad | (numpy.ndarray, optional): [W m2] net radiation |
absvappress | (numpy.ndarray, optional): [Pa] absolute vapour pressure |
windspeed | (numpy.ndarray, optional): [m s-1] windspeed |
ssrd | (numpy.ndarray, optional): [W m2] short wave radiation |
strd | (numpy.ndarray, optional): [W m2] long wave radiation |
tann | (numpy.ndarray, optional): [degC] annual mean air temperature |
compressed | (bool): Whether the data is flattened and only contains values for each unmasked domain cell. By default False |
indexing | (str, optional): Indexing for 2D arrays if data is not compressed, either "xy" or "ij" (yx order), by default "ij" |
Definition at line 106 of file tools.py.