Skip to content

Commit

Permalink
Fix for numpy 1v16. (#3257)
Browse files Browse the repository at this point in the history
  • Loading branch information
pp-mo authored and bjlittle committed Feb 1, 2019
1 parent b0d5512 commit c3048cb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/iris/fileformats/pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,10 @@ def _data_bytes_to_shaped_array(data_bytes, lbpack, boundary_packing,
raise iris.exceptions.NotYetImplementedError(
'PP fields with LBPACK of %s are not yet supported.' % lbpack)

# Ensure we have write permission on the data buffer.
data.setflags(write=True)
# Ensure we have a writeable data buffer.
# NOTE: "data.setflags(write=True)" is not valid for numpy >= 1.16.0.
if not data.flags['WRITEABLE']:
data = data.copy()

# Ensure the data is in the native byte order
if not data.dtype.isnative:
Expand Down

0 comments on commit c3048cb

Please sign in to comment.