Skip to content

Docs suddenly break due to contextily? #2716

Closed

Description

@seisman

See https://github.com/GenericMappingTools/pygmt/actions/runs/6402505841/job/17379244355

Suddenly the docs break with following errors:

Unexpected failing examples:
/home/runner/work/pygmt/pygmt/examples/gallery/maps/tilemaps.py failed leaving traceback:
Traceback (most recent call last):
  File "/home/runner/work/pygmt/pygmt/examples/gallery/maps/tilemaps.py", line 37, in <module>
    fig.tilemap(
  File "/home/runner/micromamba/envs/pygmt/lib/python3.11/site-packages/pygmt/helpers/decorators.py", line 598, in new_module
    return module_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/micromamba/envs/pygmt/lib/python3.11/site-packages/pygmt/helpers/decorators.py", line 738, in new_module
    return module_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/micromamba/envs/pygmt/lib/python3.11/site-packages/pygmt/src/tilemap.py", line 125, in tilemap
    raster = load_tile_map(
             ^^^^^^^^^^^^^^
  File "/home/runner/micromamba/envs/pygmt/lib/python3.11/site-packages/pygmt/datasets/tile_map.py", line 120, in load_tile_map
    image, extent = contextily.bounds2img(
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/micromamba/envs/pygmt/lib/python3.11/site-packages/contextily/tile.py", line 225, in bounds2img
    merged, extent = _merge_tiles(tiles, arrays)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/micromamba/envs/pygmt/lib/python3.11/site-packages/contextily/tile.py", line 628, in _merge_tiles
    img[y * h : (y + 1) * h, x * w : (x + 1) * w, :] = arr
    ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not broadcast input array from shape (512,512,4) into shape (256,256,4)

Activity

  1. added
    triage
    on Oct 4, 2023
  2. weiji14 commented on Oct 4, 2023

    @weiji14
    Member

    Yes, see geopandas/contextily#223, which is part of the Stamen Maps migration, xref #2699. We should change away from using any Stamen basemaps soon.

  3. added
    bug
    upstream
    and removed
    triage
    on Oct 4, 2023
  4. yvonnefroehlich commented on Oct 4, 2023

    @yvonnefroehlich
    Member

    The problem is related to the second code example of the Gallery example tilemaps.

    When removing the second code example, the documentation is built successfully.

    For the second example, it actually depends on the zoom factor whether the documentation is built successfully. zoom=13 and zoom=15 work for me locally, but zoom=14 leads to the error reported above and in the issue mentioned by @weiji14:

    ValueError: could not broadcast input array from shape (512,512,4) into shape (256,256,4)
    

    I just tried zoom=13 in commit aa7180e and the documentation was build successfully. Edit: And it also works with zoom=15, see commit 03f1599 and https://pygmt-dev--2706.org.readthedocs.build/en/2706/gallery/maps/tilemaps.html.

  5. weiji14 commented on Oct 4, 2023

    @weiji14
    Member

    I just tried zoom=13 in commit aa7180e and the documentation was build successfully. Edit: And it also works with zoom=15, see commit 03f1599 and https://pygmt-dev--2706.org.readthedocs.build/en/2706/gallery/maps/tilemaps.html.

    Hmm, maybe it's related to some rounding issue. I've started a PR to completely switch away from Stamen at #2717.

  6. added this to the 0.11.0 milestone on Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugupstream

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions