hydromt.stats.skills.rsquared#

hydromt.stats.skills.rsquared(sim, obs, dim='time')[source]#

Return the coefficient of determination of two time series.

\[\begin{split}r^2=(\\frac{\\sum ^n _{i=1}(e_i - \\bar{e})(s_i - \\bar{s})} {\\sqrt{\\sum ^n _{i=1}(e_i - \\bar{e})^2} \\sqrt{\\sum ^n _{i=1}(s_i - \\bar{s})^2}})^2\end{split}\]
Parameters:
  • sim (xarray DataArray) – simulations time series

  • obs (xarray DataArray) – observations time series

  • dim (str, optional) – name of time dimension in sim and obs (the default is ‘time’)

Returns:

the coefficient of determination

Return type:

xarray DataArray