Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load_tile_map/tilemap: Raise an exception if tiles are not downloaded? #3154

Open
seisman opened this issue Apr 2, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@seisman
Copy link
Member

seisman commented Apr 2, 2024

See https://github.com/GenericMappingTools/pygmt/actions/runs/8516861579/job/23326547419?pr=3153 for an example run. Sometimes, the test test_tilemap_ogc_wgs84 fails with long error messages and the most useful error messages are:

----------------------------- Captured stderr call -----------------------------
grdimage (gmtapi_import_grid): Could not read from file [/tmp/pygmt-pe8klnis.tif]
[Session pygmt-session (2510)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)
[Session pygmt-session (2510)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)
[Session pygmt-session (2510)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)

As I understand it, when the contextily.bounds2img function fails to retrieve the tiles (likely due to temporary internet connection issues), it returns an empty numpy array (https://github.com/geopandas/contextily/blob/f8c34e0a25e14d9c36c15c04892754e9369ba9bb/contextily/tile.py#L665). The zero numpy array then is passed to the grdimage, which may cause the errors above.

So, maybe in load_tile_map/Figure.tilemap, when contextily.bounds2img returns an empty numpy array, we should raise an exception? The test still fails in this case, but at least the error messages will be much easier to understand.

@seisman seisman added the bug Something isn't working label Apr 2, 2024
@seisman seisman added this to the 0.12.0 milestone Apr 20, 2024
@seisman seisman removed this from the 0.12.0 milestone Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant