basemap
basemap copied to clipboard
drawcoastlines() plots wrong boundary for the Antarctic coast
I am trying to draw continental coastlines with basemap. However, the following:
from mpl_toolkits.basemap import Basemap
m = Basemap(projection='eck4', lon_0=0, resolution='l')
m.drawcoastlines()
cuts off the Antarctic coastline at the Greenwich meridian as seen here. This is a problem not just with the Eckert IV projection, but with most (all?) global projections. E.g.,
m = Basemap(projection='cyl', resolution='l', llcrnrlat=-90, urcrnrlat=90, llcrnrlon=-180, urcrnrlon=180)
produces the same wrong behavior. I'm aware that basemap has been discontinued in favor or cartopy, but I have a lot of legacy plotting code using basemap that is now broken because of this. Here are the versions I'm using:
basemap 1.2.1 python 3.8.12 numpy 1.21.2 matplotlib 3.4.3
All were installed from macports.
Please help?
What version of geos did you link basemap to? I remember having similar problems when plotting Antarctica and they got solved using an older geos library (e.g. 3.3).
geos 3.9.1, which got installed by macports as a dependency when I installed basemap.
Do I have to go back all the way to 3.3? I can install an older version, but there seems to have been several versions between 3.3 and 3.9.
I'd try to do one minor version at a time, so try 3.8.x, and if that doesn't work, try 3.7.x, and so on.
On Tue, Oct 26, 2021 at 8:56 AM AgilentGCMS @.***> wrote:
Do I have to go back all the way to 3.3? I can install an older version, but there seems to have been several versions between 3.3 and 3.9.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/matplotlib/basemap/issues/522#issuecomment-951911180, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACHF6GBIWJLZV3WI362II3UI2QP7ANCNFSM5GWWWRXQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Downgrading to geos 3.8.1 solved it! Any idea why an upgraded geos causes this? I'd be happy to file a geos bug report if I knew what exactly was causing this.
For the moment it seems that we are blocked to GEOS < 3.9. I was testing and this error occurs for the 3.9.x series as well as the 3.10.x series.
Thank you for this helpful post, I encountered the same issue of Antarctica being half-gone with geos 3.9.1 and was able to solve with:
conda install -c conda-forge geos=3.8.1=h4a8c4bd_0
(based on previous installation of basemap using conda-forge)
Is there any update on this?
I've been trying to revert to geos 3.8.1 in my conda env but that's taking hours to resolve and it will probably mess up the entire environment :)
Is there any way maybe to compile an older version of geos directly and make basemap use that one instead than the one of conda
?
Hi @guidocioni! Unfortunately, I haven't had time to look at it yet.
In the meantime, one workaround if you are using Windows or GNU/Linux is that you install manually basemap
with pip
and resolve the dependencies yourself with conda
:
conda install numpy matplotlib pyproj pyshp
python -m pip install --no-deps basemap basemap-data
The precompiled binary wheels hosted in PyPI bundle GEOS 3.5.1 for both Windows and GNU/Linux, and they do not suffer from this bug.
pip install --no-deps basemap basemap-data
Thanks! That's definitely the easiest way to solve it for now.
I only had to uninstall basemap
from conda (basemap-data
and basemap-data-hires
were left in place) without any additional changes of dependencies (!!), and then after installing basemap
with pip
everything is working as expected.
@AgilentGCMS It took me a long while to look at this, but finally I had time to solve it and it will be ready soon in the hotfix release 1.3.5 of basemap
.
@guidocioni As soon as the basemap
release 1.3.5 is available in PyPI, I will trigger rebuilds in the basemap-feedstock
repo so that the fixed version will be available in conda-forge
too. Then you will be able to install basemap
with conda
as usual.
The bugfix is already available in the latest basemap
release 1.3.5 (on PyPI and conda-forge). Thanks for reporting the issue!