Skip to content

Commit

Permalink
Fix support for old and new style numpy exceptions
Browse files Browse the repository at this point in the history
I don't understand why `np.AxisError` doesn't work for np 2.x
  • Loading branch information
LSchueler committed Nov 20, 2024
1 parent ec9a16c commit 791256d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/gstools/field/pgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ def calc_pgs(self):
pgs : :class:`numpy.ndarray`
the plurigaussian field
"""
# very clunky way of supporting both np 1.x and 2.x exceptions
try:
np.AxisError = np.exceptions.AxisError
except:
...
try:
mapping = np.stack(self._Zs, axis=1)
except np.AxisError:
Expand Down

0 comments on commit 791256d

Please sign in to comment.