File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ Bug fixes
59
59
By `Kai Mühlbauer <https://github.com/kmuehlbauer >`_.
60
60
- do not cast `_FillValue `/`missing_value ` in `CFMaskCoder ` if `_Unsigned ` is provided
61
61
(:issue: `8844 `, :pull: `8852 `).
62
+ - Adapt handling of copy keyword argument in scipy backend for numpy >= 2.0dev
63
+ (:issue: `8844 `, :pull: `8851 `).
62
64
By `Kai Mühlbauer <https://github.com/kmuehlbauer >`_.
63
65
64
66
Documentation
Original file line number Diff line number Diff line change 28
28
Frozen ,
29
29
FrozenDict ,
30
30
close_on_error ,
31
+ module_available ,
31
32
try_read_magic_number_from_file_or_path ,
32
33
)
33
34
from xarray .core .variable import Variable
39
40
from xarray .core .dataset import Dataset
40
41
41
42
43
+ HAS_NUMPY_2_0 = module_available ("numpy" , minversion = "2.0.0.dev0" )
44
+
45
+
42
46
def _decode_string (s ):
43
47
if isinstance (s , bytes ):
44
48
return s .decode ("utf-8" , "replace" )
@@ -76,6 +80,12 @@ def __getitem__(self, key):
76
80
# with the netCDF4 library by ensuring we can safely read arrays even
77
81
# after closing associated files.
78
82
copy = self .datastore .ds .use_mmap
83
+
84
+ # adapt handling of copy-kwarg to numpy 2.0
85
+ # see https://github.com/numpy/numpy/issues/25916
86
+ # and https://github.com/numpy/numpy/pull/25922
87
+ copy = None if HAS_NUMPY_2_0 and copy is False else copy
88
+
79
89
return np .array (data , dtype = self .dtype , copy = copy )
80
90
81
91
def __setitem__ (self , key , value ):
You can’t perform that action at this time.
0 commit comments