python-xarray/xarray-pr9305-cftime.patch
Sebastian Wagner d3af5d70ef - Update to 2024.7.0
* Add test for rechunking to a size string by @dcherian in #9117
  * Update docstring in api.py for open_mfdataset(), clarifying
    "chunks" argument by @arthur-e in #9121
  * Grouper refactor by @dcherian in #9122
  * adjust repr tests to account for different platforms (#9127) by
    @mgorny in #9128
  * Support duplicate dimensions in .chunk by @mraspaud in #9099
  * Update zendoo badge link by @max-sixty in #9133
  * Split out distributed writes in zarr docs by @max-sixty in
    #9132
  * Improve to_zarr docs by @max-sixty in #9139
  * groupby: remove some internal use of IndexVariable by @dcherian
    in #9123
  * Improve zarr chunks docs by @max-sixty in #9140
  * Include numbagg in type checks by @max-sixty in #9159
  * Remove mypy exclusions for a couple more libraries by
    @max-sixty in #9160
  * Add test for #9155 by @max-sixty in #9161
  * switch to datetime unit "D" by @keewis in #9170
  * Slightly improve DataTree repr by @shoyer in #9064
  * Fix example code formatting for CachingFileManager by @djhoese
    in #9178
  * Change np.core.defchararray to np.char (#9165) by @pont-us in
    #9166
  * temporarily remove pydap from CI by @keewis in #9183
  * also pin numpy in the all-but-dask CI by @keewis in #9184
  * promote floating-point numeric datetimes to 64-bit before
    decoding by @keewis in #9182
  * "source" encoding for datasets opened from fsspec objects by

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-xarray?expand=0&rev=99
2024-09-04 13:02:54 +00:00

74 lines
3.2 KiB
Diff

From cc4daebf1a4a41483c6b60fc57d82d8bc30911e5 Mon Sep 17 00:00:00 2001
From: Mark Harfouche <mark.harfouche@gmail.com>
Date: Sat, 18 May 2024 12:54:03 -0400
Subject: [PATCH] Use ME in test_plot instead of M
```
pytest xarray/tests/test_plot.py::TestNcAxisNotInstalled::test_ncaxis_notinstalled_line_plot
```
would return the following error
```
xarray/tests/test_plot.py E [100%]
======================================= ERRORS =======================================
____ ERROR at setup of TestNcAxisNotInstalled.test_ncaxis_notinstalled_line_plot _____
self = <xarray.tests.test_plot.TestNcAxisNotInstalled object at 0x78ed1992aa10>
@pytest.fixture(autouse=True)
def setUp(self) -> None:
"""
Create a DataArray with a time-axis that contains cftime.datetime
objects.
"""
month = np.arange(1, 13, 1)
data = np.sin(2 * np.pi * month / 12.0)
darray = DataArray(data, dims=["time"])
> darray.coords["time"] = xr.cftime_range(
start="2017", periods=12, freq="1M", calendar="noleap"
)
/home/mark/git/xarray/xarray/tests/test_plot.py:3004:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/mark/git/xarray/xarray/coding/cftime_offsets.py:1129: in cftime_range
offset = to_offset(freq)
/home/mark/git/xarray/xarray/coding/cftime_offsets.py:767: in to_offset
_emit_freq_deprecation_warning(freq)
/home/mark/git/xarray/xarray/coding/cftime_offsets.py:751: in _emit_freq_deprecation_warning
emit_user_level_warning(message, FutureWarning)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
message = "'M' is deprecated and will be removed in a future version. Please use 'ME' instead of 'M'."
category = <class 'FutureWarning'>
def emit_user_level_warning(message, category=None) -> None:
"""Emit a warning at the user level by inspecting the stack trace."""
stacklevel = find_stack_level()
> return warnings.warn(message, category=category, stacklevel=stacklevel)
E FutureWarning: 'M' is deprecated and will be removed in a future version. Please use 'ME' instead of 'M'.
/home/mark/git/xarray/xarray/core/utils.py:1112: FutureWarning
============================== short test summary info ===============================
ERROR xarray/tests/test_plot.py::TestNcAxisNotInstalled::test_ncaxis_notinstalled_line_plot - FutureWarning: 'M' is deprecated and will be removed in a future version. Please ...
================================== 1 error in 0.64s ==================================
```
---
xarray/tests/test_plot.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xarray/tests/test_plot.py b/xarray/tests/test_plot.py
index e636be5589f..27f4ded5646 100644
--- a/xarray/tests/test_plot.py
+++ b/xarray/tests/test_plot.py
@@ -3002,7 +3002,7 @@ def setUp(self) -> None:
data = np.sin(2 * np.pi * month / 12.0)
darray = DataArray(data, dims=["time"])
darray.coords["time"] = xr.cftime_range(
- start="2017", periods=12, freq="1M", calendar="noleap"
+ start="2017", periods=12, freq="1ME", calendar="noleap"
)
self.darray = darray