Target_computations#

Hydrological_model_validator.Processing.Target_computations.compute_normalised_target_stats(data_dict: Dict) Tuple[ndarray, ndarray, ndarray, List[str]][source]#

Compute normalized target statistics (bias, CRMSD, RMSD) for each year in the provided data dictionary.

Parameters:

data_dict (dict) – Dictionary containing yearly model and satellite data.

Returns:

Arrays of normalized bias, CRMSD, RMSD, and corresponding year labels.

Return type:

Tuple[np.ndarray, np.ndarray, np.ndarray, List[str]]

Raises:

ValueError – If ‘data_dict’ is not a dictionary. If no overlapping or valid model/satellite data is found.

Example

>>> data_dict = {
...     '2000': (np.array([1, 2, 3]), np.array([1, 2, 4])),
...     '2001': (np.array([2, 3, 4]), np.array([2, 3, 5]))
... }
>>> bias, crmsd, rmsd, labels = compute_normalised_target_stats(data_dict)
>>> labels
['2000', '2001']
Hydrological_model_validator.Processing.Target_computations.compute_normalised_target_stats_by_month(data_dict: Dict, month_index: int) Tuple[ndarray, ndarray, ndarray, List[str]][source]#

Compute normalized target statistics (bias, CRMSD, RMSD) for a specified month across all years in the provided data dictionary.

Parameters:
  • data_dict (dict) – Dictionary containing model and satellite data.

  • month_index (int) – Month index (0-based).

Returns:

Arrays of normalized bias, CRMSD, RMSD, and year labels.

Return type:

Tuple[np.ndarray, np.ndarray, np.ndarray, List[str]]

Raises:

ValueError – If ‘month_index’ is not found in the data. If no overlapping or valid data is found for the specified month. If any monthly data contains non-numeric entries.

Example

>>> data_dict = {
...     'model': {2000: [np.array([1.0]), ...]},
...     'satellite': {2000: [np.array([1.1]), ...]}
... }
>>> bias, crmsd, rmsd, labels = compute_normalised_target_stats_by_month(data_dict, 0)
>>> labels
['2000']
Hydrological_model_validator.Processing.Target_computations.compute_single_month_target_stat(year: int, month: int, mod: ndarray, sat: ndarray) Tuple[float, float, float, str] | None[source]#

Compute normalized bias, centered RMSD (CRMSD), and RMSD for a single year-month.

Parameters:
  • year (int) – Year label as an integer.

  • month (int) – Month index (0–11).

  • mod (np.ndarray) – Model data values.

  • sat (np.ndarray) – Satellite data values.

Returns:

Tuple of normalized bias, CRMSD, RMSD, and year label as string. Returns None if the reference standard deviation of satellite data is zero.

Return type:

Optional[Tuple[float, float, float, str]]

Raises:

ValueError – If ‘year’ is not an integer. If ‘month’ is not an integer or not in the range 0–11. If ‘mod’ and ‘sat’ arrays have different shapes. If ‘mod’ or ‘sat’ contain non-numeric data.

Example

>>> compute_single_month_target_stat(2021, 5, np.array([1, 2, 3]), np.array([1, 2, 4]))
(normalized_bias, normalized_crmsd, normalized_rmsd, '2021')
Hydrological_model_validator.Processing.Target_computations.compute_single_target_stat(year: str, mod: ndarray, sat: ndarray) Tuple[float, float, float, str] | None[source]#

Compute normalized bias, centered RMSD (CRMSD), and RMSD for a single year of data.

Parameters:
  • year (str) – Year label as a string.

  • mod (np.ndarray) – Model data values.

  • sat (np.ndarray) – Satellite data values.

Returns:

Tuple of normalized bias, CRMSD, RMSD, and the year label. Returns None if the reference standard deviation of satellite data is zero.

Return type:

Optional[Tuple[float, float, float, str]]

Raises:

ValueError – If ‘mod’ and ‘sat’ arrays have different shapes. If ‘mod’ or ‘sat’ contain non-numeric data. If ‘year’ is not a string.

Example

>>> compute_single_target_stat('2020', np.array([1, 2, 3]), np.array([1, 2, 4]))
(normalized_bias, normalized_crmsd, normalized_rmsd, '2020')
Hydrological_model_validator.Processing.Target_computations.compute_target_extent_monthly(taylor_dict: Dict) float[source]#

Compute the plotting extent (max RMSD rounded up) for a monthly target diagram.

Parameters:

taylor_dict (dict) – Dictionary containing model and satellite data.

Returns:

Rounded-up maximum normalized RMSD across all months.

Return type:

float

Raises:

ValueError – If no valid RMSD data is found across months.

Example

>>> taylor_dict = {
...     '2000': [...],  # monthly data
...     '2001': [...]
... }
>>> extent = compute_target_extent_monthly(taylor_dict)
>>> isinstance(extent, float)
True
Hydrological_model_validator.Processing.Target_computations.compute_target_extent_yearly(data_dict: Dict) float[source]#

Compute the plotting extent (max RMSD rounded up) for a yearly target diagram.

Parameters:

data_dict (dict) – Dictionary containing model and satellite data.

Returns:

Rounded-up maximum normalized RMSD across all years. Returns 1.0 if all RMSDs are below or equal to 1.0.

Return type:

float

Raises:

ValueError – If no valid RMSD data is found.

Example

>>> data_dict = {
...     '2000': [...],  # yearly data
...     '2001': [...]
... }
>>> extent = compute_target_extent_yearly(data_dict)
>>> isinstance(extent, float)
True