Skip to content
Snippets Groups Projects
Commit bc62a0f5 authored by leufen1's avatar leufen1
Browse files

updated test for statistics

parent a997bce5
No related branches found
No related tags found
3 merge requests!500Develop,!499Resolve "release v2.3.0",!492Resolve "new metric bias / mean error"
Pipeline #112355 passed
This commit is part of merge request !499. Comments created here will be created in the context of that merge request.
......@@ -375,6 +375,7 @@ class TestCalculateErrorMetrics:
x_array1 = xr.DataArray(d1, coords=coords, dims=coords.keys())
x_array2 = xr.DataArray(d2, coords=coords, dims=coords.keys())
expected = {"mse": xr.DataArray(np.array([1, 2, 0, 0, 1./3]), coords={"value": [0, 1, 2, 3, 4]}, dims=["value"]),
"me": xr.DataArray(np.array([-1./3, -2./3, 0, 0, -1./3]), coords={"value": [0, 1, 2, 3, 4]}, dims=["value"]),
"rmse": np.sqrt(xr.DataArray(np.array([1, 2, 0, 0, 1./3]), coords={"value": [0, 1, 2, 3, 4]}, dims=["value"])),
"mae": xr.DataArray(np.array([1, 4./3, 0, 0, 1./3]), coords={"value": [0, 1, 2, 3, 4]}, dims=["value"]),
"ioa": xr.DataArray(np.array([0.3721, 0.4255, 1, 1, 0.4706]), coords={"value": [0, 1, 2, 3, 4]}, dims=["value"]),
......@@ -383,6 +384,7 @@ class TestCalculateErrorMetrics:
assert check_nested_equality(expected, calculate_error_metrics(x_array1, x_array2, "index"), 3) is True
expected = {"mse": xr.DataArray(np.array([1.2, 0.4, 0.4]), coords={"index": [0, 1, 2]}, dims=["index"]),
"me": xr.DataArray(np.array([-0.8, -0.4, 0.4]), coords={"index": [0, 1, 2]}, dims=["index"]),
"rmse": np.sqrt(xr.DataArray(np.array([1.2, 0.4, 0.4]), coords={"index": [0, 1, 2]}, dims=["index"])),
"mae": xr.DataArray(np.array([0.8, 0.4, 0.4]), coords={"index": [0, 1, 2]}, dims=["index"]),
"ioa": xr.DataArray(np.array([0.8478, 0.9333, 0.9629]), coords={"index": [0, 1, 2]}, dims=["index"]),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment