Skip to content
Snippets Groups Projects
Commit b1b33134 authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Improve robustness: check current axes

Without the assert, if the current axes is not a Geoaxes instance,
there is a less clear error with a plot instruction later.
parent 699b07a6
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ import matplotlib.pyplot as plt ...@@ -26,6 +26,7 @@ import matplotlib.pyplot as plt
import math import math
import cartopy.crs as ccrs import cartopy.crs as ccrs
from os import path from os import path
from cartopy.mpl import geoaxes
def snapshot(k, shp_tr_dir, *, dashed = False, light = False, def snapshot(k, shp_tr_dir, *, dashed = False, light = False,
new_figure = False, src_crs = ccrs.PlateCarree(), new_figure = False, src_crs = ccrs.PlateCarree(),
...@@ -73,6 +74,7 @@ def snapshot(k, shp_tr_dir, *, dashed = False, light = False, ...@@ -73,6 +74,7 @@ def snapshot(k, shp_tr_dir, *, dashed = False, light = False,
plt.suptitle(f"k = {k}") plt.suptitle(f"k = {k}")
else: else:
ax = plt.gca() ax = plt.gca()
assert isinstance(ax, geoaxes.GeoAxes)
for ishape in range(ishape_first, ishape_last[k - k1] + 1): for ishape in range(ishape_first, ishape_last[k - k1] + 1):
shape_rec_extr = reader_extr.shapeRecord(ishape) shape_rec_extr = reader_extr.shapeRecord(ishape)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment