unox.evaluate

Functions

compare_arrs(a_xr_arr, b_xr_arr, val_type, **kwargs)

Get a measure of similarity between two arrays.

Module Contents

unox.evaluate.compare_arrs(a_xr_arr, b_xr_arr, val_type, **kwargs)[source]

Get a measure of similarity between two arrays.

If selecting the ‘R2’ type: Calculates a correlation between the values of the two given arrays and returns the R^2 value. If selecting the ‘RMSE’ type: Calculates the root mean square error between the two given arrays and returns the RMSE value.

Parameters:
  • a_xr_arr (xarray.DataArray, numpy.ndarray) – The first xarray DataArray or numpy array to compare.

  • b_xr_arr (xarray.DataArray, numpy.ndarray) – The second xarray DataArray or numpy array to compare.

  • val_type (str) – The type of comparison to perform. Options are ‘R2’ for R-squared correlation (default) or ‘RMSE’ for root mean squared error.

  • **kwargs (keyword arguments) – Additional keyword arguments accepted to facilitate wrapper functions.

Returns:

comp_value – The numeric value comparing the two arrays. Will either be R^2 or RMSE depending on the selected type.

Return type:

float