Skip to content

Commit

Permalink
Merge pull request #834 from Unidata/issue833
Browse files Browse the repository at this point in the history
fix numpy deprecation warning for non-tuple slices (issue #833)
  • Loading branch information
jswhit authored Aug 20, 2018
2 parents 4918dcf + a046744 commit 151ccb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
=============================
* add get_dims Variable method (issue #824)
* make sure format keyword not ignored when mode is 'ws' (issue #827)
* fix numpy FutureWarning (non-tuple sequence for
multidimensional indexing is deprecated), issue #833.

version 1.4.1 (tag v1.4.1rel)
=============================
Expand Down
4 changes: 2 additions & 2 deletions netCDF4/_netCDF4.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4872,7 +4872,7 @@ numpy arrays are not performed).
raise IndexError('size of data array does not conform to slice')
if negstride:
# reverse data along axes with negative strides.
data = data[sl].copy() # make sure a copy is made.
data = data[tuple(sl)].copy() # make sure a copy is made.
if self._isprimitive or self._iscompound or self._isenum:
# primitive, enum or compound data type.
# if data type of array doesn't match variable,
Expand Down Expand Up @@ -5091,7 +5091,7 @@ numpy arrays are not performed).
free(stridep)
if negstride:
# reverse data along axes with negative strides.
data = data[sl].copy() # make a copy so data is contiguous.
data = data[tuple(sl)].copy() # make a copy so data is contiguous.
# netcdf-c always returns data in native byte order,
# regardless of variable endian-ness. Here we swap the
# bytes if the variable dtype is not native endian, so the
Expand Down

0 comments on commit 151ccb3

Please sign in to comment.