You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The images returned in fetch_tile (L74, img_tiles.py) are not the same size at times which causes _merge_tiles to error out on line 646. In testing, this happens when a tile is of size 512x512 and the other tiles are 256x256. Note, that this doesn't happen all the time and is dependent on the fetched tiles. The code below reproduces it about once every 3-4 tries. Note, we are also seeing this failure in our CI for act-atmos in that it's randomly failing and not consistent.
Code to reproduce
import cartopy.crs as ccrs
import cartopy.feature as cfeature
from cartopy.io.img_tiles import Stamen
import matplotlib.pyplot as plt
# Set projection and lat/lon extent
projection = ccrs.PlateCarree()
ax = plt.axes(projection=projection)
plt.subplots_adjust(left=0.01, right=0.99, bottom=0.05, top=0.93)
ax.set_extent([-65.38219661712647, -63.99097232818603, -33.219947052001956, -31.828722763061524], crs=projection)
# Set up tiles
tiler = Stamen('terrain')
ax.add_image(tiler, 8)
plt.show()
Traceback
Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.11/site-packages/matplotlib/backend_bases.py", line 1226, in _on_timer
ret = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/matplotlib/backends/backend_macosx.py", line 68, in callback_func
callback()
File "/opt/anaconda3/lib/python3.11/site-packages/matplotlib/backends/backend_macosx.py", line 88, in _draw_idle
self.draw()
File "/opt/anaconda3/lib/python3.11/site-packages/matplotlib/backends/backend_macosx.py", line 50, in draw
super().draw()
File "/opt/anaconda3/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py", line 400, in draw
self.figure.draw(self.renderer)
File "/opt/anaconda3/lib/python3.11/site-packages/matplotlib/artist.py", line 95, in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/matplotlib/artist.py", line 72, in draw_wrapper
return draw(artist, renderer)
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/matplotlib/figure.py", line 3140, in draw
mimage._draw_list_compositing_images(
File "/opt/anaconda3/lib/python3.11/site-packages/matplotlib/image.py", line 131, in _draw_list_compositing_images
a.draw(renderer)
File "/opt/anaconda3/lib/python3.11/site-packages/matplotlib/artist.py", line 72, in draw_wrapper
return draw(artist, renderer)
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/cartopy/mpl/geoaxes.py", line 531, in draw
img, extent, origin = factory.image_for_domain(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/cartopy/io/img_tiles.py", line 98, in image_for_domain
img, extent, origin = _merge_tiles(tiles)
^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/cartopy/io/img_tiles.py", line 646, in _merge_tiles
img[img_slice] = tile_img
~~~^^^^^^^^^^^
ValueError: could not broadcast input array from shape (512,512,3) into shape (766,766,3)
Hello @AdamTheisen, this should be because the server is returning a warning tile some of the time due to a phaseout of the current service. There is a fix in the works at: #2266:
Description
The images returned in fetch_tile (L74, img_tiles.py) are not the same size at times which causes _merge_tiles to error out on line 646. In testing, this happens when a tile is of size 512x512 and the other tiles are 256x256. Note, that this doesn't happen all the time and is dependent on the fetched tiles. The code below reproduces it about once every 3-4 tries. Note, we are also seeing this failure in our CI for act-atmos in that it's randomly failing and not consistent.
Code to reproduce
Traceback
Full environment definition
Operating system
macOS Ventura 13.6
Cartopy version
Tested on both
0.21.1
0.22.0
conda list
pip list
The text was updated successfully, but these errors were encountered: