Skip to content

Commit d539793

Browse files
committed
tweak test for more recent xarray versions
1 parent cdd8f66 commit d539793

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/test_matchpoint.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ def test_matchpoint(self):
4242
ds.run()
4343

4444
matcher = nc.open_matchpoint()
45-
depths = ds.levels
46-
df["depth"] = levels
45+
# depths = ds.levels
46+
# df["depth"] = levels
4747
matcher.add_points(df.drop(columns = "N3_n"))
4848
matcher.add_data(ds, variables = "N3_n", depths = depths)
4949
matcher.matchup()
5050

5151

52+
matcher.values.rename(columns = {"N3_n":"nitrate"}).merge( df).assign(bias = lambda x: np.abs(x.N3_n - x.nitrate)).bias
5253
assert matcher.values.rename(columns = {"N3_n":"nitrate"}).merge( df).assign(bias = lambda x: np.abs(x.N3_n - x.nitrate)).bias.max() < 0.0001
5354
assert len(matcher.values) == len(df)
5455

@@ -91,6 +92,7 @@ def test_matchpoint(self):
9192
df["year"] = [x.year for x in df.time_counter]
9293
df["day"] = [x.day for x in df.time_counter]
9394
df = df.loc[:,["lon", "lat", "month", "day", "year", "N3_n", "depth"]].drop_duplicates()
95+
df = df.sort_values(by = ["lon", "lat", "depth"]).reset_index(drop=True)
9496
ds = nc.open_data("data/matchpoint/amm7_1d_20000301_20000331_ptrc_T.nc", checks=False)
9597
ds.subset(time = [0])
9698
ds.run()

0 commit comments

Comments
 (0)