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

epy_cartoplot.py problem during savefig on overseas domains #40

Open
AlexandreMary opened this issue Nov 27, 2024 · 2 comments
Open

epy_cartoplot.py problem during savefig on overseas domains #40

AlexandreMary opened this issue Nov 27, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@AlexandreMary
Copy link
Contributor

epy_cartoplot.py faces an issue during the call to savefig() on (some) overseas domains.
Issue reported by Eric B. and Sophie M. at least.
Note that it works from within a python script on in interactive python, apparently.

@AlexandreMary AlexandreMary added the bug Something isn't working label Nov 27, 2024
@AlexandreMary
Copy link
Contributor Author

epy_cartoplot.py -f S090TEMPERATURE cpl.ifs-determ-prod.indienxl-08km00+0000\:00.fa

Traceback (most recent call last):
  File "/home/marimbordess/with_epygram/bin/epy_cartoplot.py", line 477, in <module>
    main(six.u(args.filename),
  File "/home/marimbordess/with_epygram/bin/epy_cartoplot.py", line 318, in main
    fig.savefig(outputfilename, **save_kwargs)
  File "/home/marimbordess/with_epygram/lib/python3.12/site-packages/matplotlib/figure.py", line 3395, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/marimbordess/with_epygram/lib/python3.12/site-packages/matplotlib/backend_bases.py", line 2175, in print_figure
    self.figure.draw(renderer)
  File "/home/marimbordess/with_epygram/lib/python3.12/site-packages/matplotlib/artist.py", line 95, in draw_wrapper
    result = draw(artist, renderer, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/marimbordess/with_epygram/lib/python3.12/site-packages/matplotlib/artist.py", line 72, in draw_wrapper
    return draw(artist, renderer)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/marimbordess/with_epygram/lib/python3.12/site-packages/matplotlib/figure.py", line 3162, in draw
    mimage._draw_list_compositing_images(
  File "/home/marimbordess/with_epygram/lib/python3.12/site-packages/matplotlib/image.py", line 132, in _draw_list_compositing_images
    a.draw(renderer)
  File "/home/marimbordess/with_epygram/lib/python3.12/site-packages/matplotlib/artist.py", line 72, in draw_wrapper
    return draw(artist, renderer)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/marimbordess/with_epygram/lib/python3.12/site-packages/cartopy/mpl/geoaxes.py", line 509, in draw
    self._draw_preprocess()
  File "/home/marimbordess/with_epygram/lib/python3.12/site-packages/cartopy/mpl/geoaxes.py", line 485, in _draw_preprocess
    self.patch._adjust_location()
  File "/home/marimbordess/with_epygram/lib/python3.12/site-packages/cartopy/mpl/geoaxes.py", line 238, in _adjust_location
    cpatch._ensure_path_closed(
  File "/home/marimbordess/with_epygram/lib/python3.12/site-packages/cartopy/mpl/patch.py", line 49, in _ensure_path_closed
    return Path(vertices, codes)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/marimbordess/with_epygram/lib/python3.12/site-packages/matplotlib/path.py", line 130, in __init__
    _api.check_shape((None, 2), vertices=vertices)
  File "/home/marimbordess/with_epygram/lib/python3.12/site-packages/matplotlib/_api/__init__.py", line 161, in check_shape
    raise ValueError(
ValueError: 'vertices' must be 2D with shape (N, 2), but your input has shape (0,)

@FlorianSuzat
Copy link
Contributor

Hi, this workaround permit to avoid the problem:
downgrade cartopy to version 0.23.0
pip install cartopy==0.23.0 --force-reinstall
maybe the solution is to provide to cartopy devs a test cas that reproduce the problem to expect a solution in futures versions

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

2 participants