Skip to content

Commit

Permalink
path fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dnowacki-usgs committed Dec 2, 2024
1 parent 55c60f9 commit 0c36129
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/cartopy/io/ogc_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ def _load_cache(self):
if self._default_cache:
warnings.warn(
'Cartopy created the following directory to cache '
'WMTSRasterSource tiles: {}'.format(cache_dir))
self.cache = self.cache.union(set(os.listdir(cache_dir)))
f'WMTSRasterSource tiles: {cache_dir}')
self.cache = self.cache.union(set(cache_dir.iterdir()))

def _choose_matrix(self, tile_matrices, meters_per_unit, max_pixel_span):
# Get the tile matrices in order of increasing resolution.
Expand Down Expand Up @@ -683,15 +683,12 @@ def _wmts_images(self, wmts, layer, matrix_set_name, extent,
# Try it from disk cache
if self.cache_path is not None:
filename = f"{img_key[0]}_{img_key[1]}.npy"
cached_file = os.path.join(
self._cache_dir,
filename
)
cached_file = self._cache_dir / filename
else:
filename = None
cached_file = None

if filename in self.cache:
if cached_file in self.cache:
img = Image.fromarray(np.load(cached_file, allow_pickle=False))
else:
try:
Expand Down

0 comments on commit 0c36129

Please sign in to comment.