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

drawcoastlines() plots wrong boundary for the Antarctic coast #522

Closed
AgilentGCMS opened this issue Oct 26, 2021 · 12 comments
Closed

drawcoastlines() plots wrong boundary for the Antarctic coast #522

AgilentGCMS opened this issue Oct 26, 2021 · 12 comments

Comments

@AgilentGCMS
Copy link

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?

@molinav
Copy link
Member

molinav commented Oct 26, 2021

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).

@AgilentGCMS
Copy link
Author

geos 3.9.1, which got installed by macports as a dependency when I installed basemap.

@AgilentGCMS
Copy link
Author

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.

@WeatherGod
Copy link
Member

WeatherGod commented Oct 26, 2021 via email

@AgilentGCMS
Copy link
Author

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.

@molinav
Copy link
Member

molinav commented Jan 25, 2022

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.

@cosmicpudding
Copy link

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)

@guidocioni
Copy link

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?

@molinav
Copy link
Member

molinav commented Sep 6, 2022

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.

@guidocioni
Copy link

guidocioni commented Sep 6, 2022

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.

@molinav
Copy link
Member

molinav commented Oct 24, 2022

@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.

@molinav
Copy link
Member

molinav commented Oct 25, 2022

The bugfix is already available in the latest basemap release 1.3.5 (on PyPI and conda-forge). Thanks for reporting the issue!

@molinav molinav closed this as completed Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants