5.13.2-dev0
mHM
The mesoscale Hydrological Model
Loading...
Searching...
No Matches
mhm.tools Namespace Reference

Tools to interact with mHM. More...

Functions

 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.
 

Detailed Description

Tools to interact with mHM.

Function Documentation

◆ 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
ValueErrorIf the level is not in ["L0", "L1", "L11" or "L2"].

Definition at line 49 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 14 of file tools.py.

◆ get_runoff()

mhm.tools.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 29 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 39 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
ValueErrorIf the variable name doesn't start with "L0", "L1", "L11" or "L2".

Definition at line 72 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 107 of file tools.py.