smash.Model.get_rr_parameters#

Model.get_rr_parameters(key)[source]#

Get the values of a Model rainfall-runoff parameter.

Parameters:
keystr

The name of the rainfall-runoff parameter.

Returns:
valuenumpy.ndarray

An array of shape (nrow, ncol) representing the values of the rainfall-runoff parameter.

See also

Model.rr_parameters

Model rainfall-runoff parameters.

Examples

>>> from smash.factory import load_dataset
>>> setup, mesh = load_dataset("cance")
>>> model = smash.Model(setup, mesh)

Access to a specific rainfall-runoff parameter grid

>>> model.get_rr_parameters("cp")
array([[200., 200., 200., 200., 200., 200., 200., 200., 200., 200., 200.,
        200., 200., 200., 200., 200., 200., 200., 200., 200., 200., 200.,
        ...
        200., 200., 200., 200., 200., 200.]], dtype=float32)

Note

This method is equivalent to directly slicing the rr_parameters.values array (as shown below) but is simpler to use

Access the rainfall-runoff parameter keys

>>> model.rr_parameters.keys
array(['ci', 'cp', 'ct', 'kexc', 'llr'], dtype='<U4')

Get the index of the rainfall-runoff parameter 'cp'

>>> ind = np.argwhere(model.rr_parameters.keys == "cp").item()
>>> ind
1

Slice the rr_parameters.values array on the last axis

>>> model.rr_parameters.values[..., ind]
array([[200., 200., 200., 200., 200., 200., 200., 200., 200., 200., 200.,
        200., 200., 200., 200., 200., 200., 200., 200., 200., 200., 200.,
        ...
        200., 200., 200., 200., 200., 200.]], dtype=float32)