Skip to content

Commit

Permalink
use tmpdir, use copies
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre committed Sep 19, 2024
1 parent 3dddd7a commit 709cb2d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/test_biasadjust.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ def test_basic(
self, periods, to_level, bias_adjust_institution, bias_adjust_project
):
dtrain = xs.train(
self.dref,
self.dref.copy(),
self.dsim.sel(time=slice("2001", "2003")),
var="tas",
period=["2001", "2003"],
)

out = xs.adjust(
dtrain,
self.dsim,
self.dsim.copy(),
periods=periods,
to_level=to_level,
bias_adjust_institution=bias_adjust_institution,
Expand Down Expand Up @@ -175,9 +175,9 @@ def test_basic(
np.concatenate([np.ones(365 * 1) * 1, np.ones(365 * 1) * 3]),
)

def test_write_train(self):
def test_write_train(self, tmpdir):
dtrain = xs.train(
self.dref,
self.dref.copy(),
self.dsim.sel(time=slice("2001", "2003")),
var="tas",
period=["2001", "2003"],
Expand All @@ -186,15 +186,15 @@ def test_write_train(self):
jitter_under={"thresh": "2 K"},
)

root = str(notebooks / "_data")
root = str(tmpdir / "_data")
xs.save_to_zarr(dtrain, f"{root}/test.zarr", mode="o")
dtrain2 = xr.open_dataset(
f"{root}/test.zarr", chunks={"dayofyear": 365, "quantiles": 15}
)

out = xs.adjust(
dtrain,
self.dsim,
self.dsim.copy(),
periods=["2001", "2006"],
xclim_adjust_args={
"detrend": {
Expand All @@ -205,7 +205,7 @@ def test_write_train(self):

out2 = xs.adjust(
dtrain2,
self.dsim,
self.dsim.copy(),
periods=["2001", "2006"],
xclim_adjust_args={
"detrend": {
Expand Down

0 comments on commit 709cb2d

Please sign in to comment.