From b8e6abaf30c7d155068bfe2dcebb1e0d880769dd Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Sun, 19 May 2024 20:13:16 +0100 Subject: [PATCH 1/2] Make Gridliner deprecation warning show up --- lib/cartopy/mpl/gridliner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cartopy/mpl/gridliner.py b/lib/cartopy/mpl/gridliner.py index c750a7543..b2b3a5877 100644 --- a/lib/cartopy/mpl/gridliner.py +++ b/lib/cartopy/mpl/gridliner.py @@ -9,6 +9,7 @@ """ +import inspect import itertools import operator import warnings @@ -447,10 +448,13 @@ def __init__(self, axes, crs, draw_labels=False, xlocator=None, if auto_update is None: auto_update = True else: + calling_module = inspect.stack()[1].filename warnings.warn( "The auto_update parameter was deprecated at Cartopy 0.23. In future " "the gridlines and labels will always be updated.", - DeprecationWarning) + DeprecationWarning, + stacklevel=(3 if calling_module.endswith('cartopy/mpl/geoaxes.py') + else 2)) self._auto_update = auto_update def has_labels(self): From d8297b81a5c4b2358a5cd629b07a4106dd80c49a Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Sat, 25 May 2024 12:21:56 +0100 Subject: [PATCH 2/2] Add comment about outstanding issue --- lib/cartopy/mpl/gridliner.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cartopy/mpl/gridliner.py b/lib/cartopy/mpl/gridliner.py index b2b3a5877..cf06b8b3d 100644 --- a/lib/cartopy/mpl/gridliner.py +++ b/lib/cartopy/mpl/gridliner.py @@ -448,6 +448,7 @@ def __init__(self, axes, crs, draw_labels=False, xlocator=None, if auto_update is None: auto_update = True else: + # Note #2394 should be addressed before this deprecation expires. calling_module = inspect.stack()[1].filename warnings.warn( "The auto_update parameter was deprecated at Cartopy 0.23. In future "