|
21 | 21 | (
|
22 | 22 | ("resample", {"time": "M"}, {"T": "M"}),
|
23 | 23 | ("rolling", {"lat": 5}, {"Y": 5}),
|
24 |
| - ("coarsen", {"lon": 2, "lat": 5}, {"X": 2, "Y": 5}), |
25 |
| - ("groupby", {"group": "time"}, {"group": "T"}) |
| 24 | + ("groupby", {"group": "time"}, {"group": "T"}), |
| 25 | + pytest.param( |
| 26 | + "coarsen", |
| 27 | + {"lon": 2, "lat": 5}, |
| 28 | + {"X": 2, "Y": 5}, |
| 29 | + marks=pytest.mark.skip( |
| 30 | + reason="xarray GH4120. any test after this will fail since attrs are lost" |
| 31 | + ), |
| 32 | + ), |
| 33 | + # order of above tests is important: See xarray GH4120 |
26 | 34 | # groupby("time.day")?
|
27 | 35 | # groupby_bins
|
28 | 36 | # weighted
|
@@ -68,19 +76,24 @@ def test_args_methods(obj):
|
68 | 76 | @pytest.mark.parametrize("obj", dataarrays)
|
69 | 77 | def test_dataarray_plot(obj):
|
70 | 78 |
|
71 |
| - obj.isel(time=1).cf.plot(x="X", y="Y") |
| 79 | + rv = obj.isel(time=1).cf.plot(x="X", y="Y") |
| 80 | + assert isinstance(rv, mpl.collections.QuadMesh) |
72 | 81 | plt.close()
|
73 | 82 |
|
74 |
| - obj.isel(time=1).cf.plot.contourf(x="X", y="Y") |
| 83 | + rv = obj.isel(time=1).cf.plot.contourf(x="X", y="Y") |
| 84 | + assert isinstance(rv, mpl.contour.QuadContourSet) |
75 | 85 | plt.close()
|
76 | 86 |
|
77 |
| - obj.cf.plot(x="X", y="Y", col="T") |
| 87 | + rv = obj.cf.plot(x="X", y="Y", col="T") |
| 88 | + assert isinstance(rv, xr.plot.FacetGrid) |
78 | 89 | plt.close()
|
79 | 90 |
|
80 |
| - obj.cf.plot.contourf(x="X", y="Y", col="T") |
| 91 | + rv = obj.cf.plot.contourf(x="X", y="Y", col="T") |
| 92 | + assert isinstance(rv, xr.plot.FacetGrid) |
81 | 93 | plt.close()
|
82 | 94 |
|
83 |
| - obj.isel(lat=[0, 1], lon=1).cf.plot.line(x="T", hue="Y") |
| 95 | + rv = obj.isel(lat=[0, 1], lon=1).cf.plot.line(x="T", hue="Y") |
| 96 | + assert all([isinstance(line, mpl.lines.Line2D) for line in rv]) |
84 | 97 | plt.close()
|
85 | 98 |
|
86 | 99 |
|
|
0 commit comments