smash.Model.get_rr_final_states#

Model.get_rr_final_states(key)[source]#

Get the values of a Model rainfall-runoff final state.

Parameters:
keystr

The name of the rainfall-runoff final state.

Returns:
valuenumpy.ndarray

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

See also

Model.rr_final_states

Model rainfall-runoff final states.

Examples

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

Run the direct Model to generate discharge responses

>>> model.forward_run()

Access to a specific rainfall-runoff final state grid

>>> model.get_rr_final_states("hp")
array([[-99.        , -99.        , -99.        , -99.        ,
        -99.        , -99.        , -99.        , -99.        ,
        -99.        , -99.        , -99.        , -99.        ,
          0.8682228 ,   0.88014543, -99.        , -99.        ,
        ...
        -99.        , -99.        , -99.        , -99.        ]],
      dtype=float32)

Note

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

Access the rainfall-runoff state keys

>>> model.rr_final_states.keys
array(['hi', 'hp', 'ht', 'hlr'], dtype='<U3')

Get the index of the rainfall-runoff final state 'hp'

>>> ind = np.argwhere(model.rr_final_states.keys == "hp").item()
>>> ind
1

Slice the rr_final_states.values array on the last axis

>>> model.rr_final_states.values[..., ind]
array([[-99.        , -99.        , -99.        , -99.        ,
        -99.        , -99.        , -99.        , -99.        ,
        -99.        , -99.        , -99.        , -99.        ,
          0.8682228 ,   0.88014543, -99.        , -99.        ,
        ...
        -99.        , -99.        , -99.        , -99.        ]],
      dtype=float32)