Skip to content

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

Closed

Description

@AgilentGCMS

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?

Activity

  1. molinav commented on Oct 26, 2021

    @molinav
    Member

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

  2. AgilentGCMS commented on Oct 26, 2021

    @AgilentGCMS
    Author

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

  3. AgilentGCMS commented on Oct 26, 2021

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

  4. WeatherGod commented on Oct 26, 2021

    @WeatherGod
    Member
  5. AgilentGCMS commented on Oct 26, 2021

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

  6. molinav commented on Jan 25, 2022

    @molinav
    Member

    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.

  7. cosmicpudding commented on Feb 1, 2022

    @cosmicpudding

    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)

  8. guidocioni commented on Sep 6, 2022

    @guidocioni

    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?

  9. molinav commented on Sep 6, 2022

    @molinav
    Member

    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.

  10. guidocioni commented on Sep 6, 2022

    @guidocioni

    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.

  11. molinav commented on Oct 24, 2022

    @molinav
    Member

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

  12. molinav commented on Oct 25, 2022

    @molinav
    Member

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

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions