File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ Bug fixes
5959 By `Kai Mühlbauer <https://github.com/kmuehlbauer >`_.
6060- do not cast `_FillValue `/`missing_value ` in `CFMaskCoder ` if `_Unsigned ` is provided
6161 (:issue: `8844 `, :pull: `8852 `).
62+ - Adapt handling of copy keyword argument in scipy backend for numpy >= 2.0dev
63+ (:issue: `8844 `, :pull: `8851 `).
6264 By `Kai Mühlbauer <https://github.com/kmuehlbauer >`_.
6365
6466Documentation
Original file line number Diff line number Diff line change 2828 Frozen ,
2929 FrozenDict ,
3030 close_on_error ,
31+ module_available ,
3132 try_read_magic_number_from_file_or_path ,
3233)
3334from xarray .core .variable import Variable
3940 from xarray .core .dataset import Dataset
4041
4142
43+ HAS_NUMPY_2_0 = module_available ("numpy" , minversion = "2.0.0.dev0" )
44+
45+
4246def _decode_string (s ):
4347 if isinstance (s , bytes ):
4448 return s .decode ("utf-8" , "replace" )
@@ -76,6 +80,12 @@ def __getitem__(self, key):
7680 # with the netCDF4 library by ensuring we can safely read arrays even
7781 # after closing associated files.
7882 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+
7989 return np .array (data , dtype = self .dtype , copy = copy )
8090
8191 def __setitem__ (self , key , value ):
You can’t perform that action at this time.
0 commit comments