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

update tests

parent 4fdf7b77
No related branches found
No related tags found
3 merge requests!522filter can now combine obs, forecast, and apriori for first iteration. Further...,!521Resolve "release v2.4.0",!513Resolve "robust apriori estimate for short timeseries"
Pipeline #140222 passed
...@@ -178,8 +178,8 @@ class TestClimateFIRFilter: ...@@ -178,8 +178,8 @@ class TestClimateFIRFilter:
obj = object.__new__(ClimateFIRFilter) obj = object.__new__(ClimateFIRFilter)
sel_opts = {time_dim: slice("2010-05", "2010-08")} sel_opts = {time_dim: slice("2010-05", "2010-08")}
res = obj.create_monthly_mean(xr_array_long, time_dim, sel_opts=sel_opts) res = obj.create_monthly_mean(xr_array_long, time_dim, sel_opts=sel_opts)
assert res.dropna(time_dim)[f"{time_dim}.month"].min() == 5 assert res.dropna(time_dim)[f"{time_dim}.month"].min() == 1
assert res.dropna(time_dim)[f"{time_dim}.month"].max() == 8 assert res.dropna(time_dim)[f"{time_dim}.month"].max() == 12
mean_jun_2010 = xr_array_long[xr_array_long[f"{time_dim}.month"] == 6].sel({time_dim: "2010"}).mean() mean_jun_2010 = xr_array_long[xr_array_long[f"{time_dim}.month"] == 6].sel({time_dim: "2010"}).mean()
assert res.sel({time_dim: "2010-06-15T00:00:00"}) == mean_jun_2010 assert res.sel({time_dim: "2010-06-15T00:00:00"}) == mean_jun_2010
...@@ -226,8 +226,8 @@ class TestClimateFIRFilter: ...@@ -226,8 +226,8 @@ class TestClimateFIRFilter:
xr_array_long = xr_array_long.resample({time_dim: "1H"}).interpolate() xr_array_long = xr_array_long.resample({time_dim: "1H"}).interpolate()
sel_opts = {time_dim: slice("2010-05", "2010-08")} sel_opts = {time_dim: slice("2010-05", "2010-08")}
res = obj.create_seasonal_hourly_mean(xr_array_long, time_dim, sel_opts=sel_opts) res = obj.create_seasonal_hourly_mean(xr_array_long, time_dim, sel_opts=sel_opts)
assert res.dropna(time_dim)[f"{time_dim}.month"].min() == 5 assert res.dropna(time_dim)[f"{time_dim}.month"].min() == 1
assert res.dropna(time_dim)[f"{time_dim}.month"].max() == 8 assert res.dropna(time_dim)[f"{time_dim}.month"].max() == 12
def test_create_unity_array(self, xr_array, time_dim): def test_create_unity_array(self, xr_array, time_dim):
obj = object.__new__(ClimateFIRFilter) obj = object.__new__(ClimateFIRFilter)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment