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
{{ message }}
Repository navigation
ValueError: 'vertices' must be a 2D list or array with shape Nx2 #512
File "plt_RAIN.py", line 62, in
m.drawcoastlines(linewidth=0.8)
File "/usr/local/lib/python3.8/dist-packages/mpl_toolkits/basemap/init.py", line 1859, in drawcoastlines
coastlines = LineCollection(self.coastsegs,antialiaseds=(antialiased,))
File "/usr/lib/python3/dist-packages/matplotlib/collections.py", line 1333, in init
self.set_segments(segments)
File "/usr/lib/python3/dist-packages/matplotlib/collections.py", line 1348, in set_segments
self._paths = [mpath.Path(_seg) for _seg in _segments]
File "/usr/lib/python3/dist-packages/matplotlib/collections.py", line 1348, in
self._paths = [mpath.Path(_seg) for _seg in _segments]
File "/usr/lib/python3/dist-packages/matplotlib/path.py", line 129, in init
raise ValueError(
ValueError: 'vertices' must be a 2D list or array with shape Nx2
I checked everything, but I'm used to run this on basemap 1.0.7 and everything was ok.
And when I run without m.drawcoastlines(), there is no problem.
This is most likely due to a change I made to address a problem with an
update in proj4. IIRC, the projection parameters were getting cast to
float32, thereby reducing the accuracy of the projection. Most likely, I
removed the casting, so maybe an integer passing though is causing issues?
On Thu, Mar 31, 2022 at 12:02 PM Huziy Oleksandr ***@***.***> wrote:
I have a similar problem. I think this might be because your domain does
not intersect any coastlines? I have this reproducer:
# fails from mpl_toolkits.basemap import Basemapb = Basemap(projection="cea", llcrnrlon=267.5, urcrnrlon=283.995, llcrnrlat=41.35, urcrnrlat=51, resolution="l") b.drawcoastlines()
*Note*: The above fails in basemap 1.2.1 and works in basemap 1.1.0,
regression somewhere...
But if I extend a bit to have an intersection with the ocean coastlines
(in this case to the Hudson Bay) it works
# works from mpl_toolkits.basemap import Basemapb = Basemap(projection="cea", llcrnrlon=267.5, urcrnrlon=283.995, llcrnrlat=41.35, urcrnrlat=51.8, resolution="l") b.drawcoastlines()
@jswhit <https://github.com/jswhit> I know we are not supposed to bug you
with this project, but maybe you have a workaround for this...
—
Reply to this email directly, view it on GitHub
<#512 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACHF6GGGE47N3R2IDWZAX3VCXECRANCNFSM4YPWKFLQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
@guziy With the latest basemap I am not able to reproduce it. If I type your first snippet in IPython, I get this:
(py38) vic@onyx:~$ python -m IPython --pylab=Tk
Python 3.8.12 (default, Jan 3 2022, 10:33:21)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.30.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from mpl_toolkits.basemap import Basemap
...: import matplotlib.pyplot as plt
...: b = Basemap(projection="cea",
...: llcrnrlon=267.5, urcrnrlon=283.995,
...: llcrnrlat=41.35, urcrnrlat=51, resolution="l")
...: b.drawcoastlines()
...: plt.show()
In [2]: from mpl_toolkits import basemap
In [3]: basemap.__version__
Out[3]: '1.3.2'
For this example I am using the basemap wheel in PyPI, which bundles a relatively old GEOS library (3.5.1). Could it be that your basemap installation uses the GEOS from your system, which is probably newer, and the new GEOS does not get on well with the current implementation?
@guziy The basemap conda package needs an update at some point, but I haven't still had time to learn a bit on how to refactor the basemap conda recipe appropriately after my split of basemap into three parts.
From other issue (#522 (comment)) it seems that we are blocked at the moment to GEOS < 3.9.
@guziy This issue and your fix were included in basemap 1.3.3. Since April, a bit of development on the conda-forge side has been ongoing, and we now have up-to-date basemap packages in conda-forge as well as in PyPI.
The latest basemap release (1.3.5) has been deployed to PyPI and conda-forge today, it also includes this bugfix of course, and it solves the problem about linking with newer GEOS versions (#522). So I think we can safely close this issue!
Activity
guziy commentedon Mar 31, 2022
I have a similar problem. I think this might be because your domain does not intersect any coastlines? I have this reproducer:
Note: The above fails in basemap 1.2.1 (matplotlib 3.5.1) and works in basemap 1.1.0 (matplotlib 2.1.1), regression somewhere...
But if I extend a bit to have an intersection with the ocean coastlines (in this case to the Hudson Bay) it works
@jswhit I know we are not supposed to bug you with this project, but maybe you have a workaround for this...
WeatherGod commentedon Mar 31, 2022
molinav commentedon Mar 31, 2022
@guziy With the latest
basemapI am not able to reproduce it. If I type your first snippet in IPython, I get this:For this example I am using the
basemapwheel in PyPI, which bundles a relatively old GEOS library (3.5.1). Could it be that yourbasemapinstallation uses the GEOS from your system, which is probably newer, and the new GEOS does not get on well with the current implementation?guziy commentedon Apr 1, 2022
@molinav Could you please try to create the following conda environment:
Here are the versions
Here is the info for the basemap=1.2.2 conda package:
Merge pull request #538 from guziy/fix-drawcoastlines
molinav commentedon Apr 1, 2022
@guziy The
basemapconda package needs an update at some point, but I haven't still had time to learn a bit on how to refactor thebasemapconda recipe appropriately after my split ofbasemapinto three parts.From other issue (#522 (comment)) it seems that we are blocked at the moment to GEOS < 3.9.
guziy commentedon Apr 1, 2022
molinav commentedon Apr 1, 2022
The conda recipe is available in a separate repo:
https://github.com/conda-forge/basemap-feedstock
There were a couple of external attempts to update the recipe but they did not succeed or were closed before finishing:
conda-forge/basemap-feedstock#92
conda-forge/basemap-feedstock#93
Unfortunately, I could not still find time to learn about conda recipes to provide my own update there.
molinav commentedon Oct 25, 2022
@guziy This issue and your fix were included in
basemap1.3.3. Since April, a bit of development on theconda-forgeside has been ongoing, and we now have up-to-datebasemappackages inconda-forgeas well as in PyPI.The latest
basemaprelease (1.3.5) has been deployed to PyPI andconda-forgetoday, it also includes this bugfix of course, and it solves the problem about linking with newer GEOS versions (#522). So I think we can safely close this issue!