Skip to content

Commit 2aa99c9

Browse files
committed
address pyproj warnings in case pyproj>=3.5 is used
1 parent d52ca0d commit 2aa99c9

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

eomaps/scalebar.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import logging
99
from collections import OrderedDict
1010
from functools import lru_cache
11+
import importlib.metadata
12+
from packaging import version
1113

1214
import numpy as np
1315

@@ -24,6 +26,13 @@
2426

2527
_log = logging.getLogger(__name__)
2628

29+
# TODO remove this once pyproj >3.5 is enforced
30+
pyproj_version = version.parse(importlib.metadata.version("pyproj"))
31+
if pyproj_version >= version.Version("3.5"):
32+
_pyproj_geod_fix_args = {"return_back_azimuth": True}
33+
else:
34+
_pyproj_geod_fix_args = {}
35+
2736

2837
class ScaleBar:
2938
"""
@@ -979,6 +988,7 @@ def _get_base_pts(self, lon, lat, azim, npts=None):
979988
del_s=self._current_scale,
980989
initial_idx=0,
981990
terminus_idx=0,
991+
**_pyproj_geod_fix_args,
982992
)
983993

984994
if isinstance(self._label_props["every"], int):
@@ -1003,6 +1013,7 @@ def _get_pts(self, lon, lat, azim):
10031013
npts=self._interm_pts,
10041014
initial_idx=0,
10051015
terminus_idx=0,
1016+
**_pyproj_geod_fix_args,
10061017
)
10071018
lons.append(p.lons)
10081019
lats.append(p.lats)

0 commit comments

Comments
 (0)