Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions flopy/discretization/structuredgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@
import numpy as np
from .grid import Grid, CachedData

try:
from numpy.lib import NumpyVersion

numpy115 = NumpyVersion(np.__version__) >= "1.15.0"
except ImportError:
numpy115 = False

if not numpy115:

def flip_numpy115(m, axis=None):
"""Provide same behavior for np.flip since numpy 1.15.0."""
import numpy.core.numeric as _nx
from numpy.core.numeric import asarray

if not hasattr(m, "ndim"):
m = asarray(m)
if axis is None:
indexer = (np.s_[::-1],) * m.ndim
else:
axis = _nx.normalize_axis_tuple(axis, m.ndim)
indexer = [np.s_[:]] * m.ndim
for ax in axis:
indexer[ax] = np.s_[::-1]
indexer = tuple(indexer)
return m[indexer]

np.flip = flip_numpy115


def array_at_verts_basic2d(a):
"""
Expand Down