cedadev / jasmin_scivm

9 stars 0 forks source link

Please update basemap for python #181

Closed klboaggi closed 6 years ago

klboaggi commented 6 years ago

Running the same codes I was before the latest JASMIN release, I am receiving the following error while trying to use Basemap:

map.drawcoastlines(linewidth=0.25) File "/usr/lib/python2.7/site-packages/mpl_toolkits/basemap/init.py", line 1861, in drawcoastlines self.set_axes_limits(ax=ax) File "/usr/lib/python2.7/site-packages/mpl_toolkits/basemap/init.py", line 3180, in set_axes_limits limb2 = self.drawmapboundary(linewidth=0) File "/usr/lib/python2.7/site-packages/mpl_toolkits/basemap/init.py", line 1623, in drawmapboundary fill_color = ax.get_axis_bgcolor() AttributeError: 'AxesSubplot' object has no attribute 'get_axis_bgcolor'

I read that it has something to do with the the new version of matplotlib (2.2.2) and its compatibility with the old version of basemap (1.0.7). I am new to using python, but this error has only began since the update and I cannot plot using basemap anymore.

Thank you so much!!

alaniwi commented 6 years ago

Unfortunately, looking at https://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/, there is not a later version of basemap to update to - it is already on its latest available release (1.0.7). It has been announced that it is being deprecated in favour of cartopy, which is something which we already provide, although I believe that it uses different syntax and is not simply a drop-in replacement for basemap.

If you wish to use a legacy version of matplotlib for better compatibility with basemap, you can do so by means of a virtual environment. For example:

$ virtualenv --system-site-packages /path/to/venv
$ . /path/to/venv/bin/activate
$ pip install matplotlib==1.4.3

Doing the above, I was able to get test plots shown at https://matplotlib.org/basemap/users/examples.html to work - at least when writing to a file using plt.savefig(filename).

More information regarding using virtual environments on JASMIN can be found at https://help.jasmin.ac.uk/article/4489-python-virtual-environments

For now I am going to close this ticket.

alaniwi commented 6 years ago

Reopening for the same reason I reopened #182 - https://github.com/cedadev/jasmin_scivm/issues/182#issuecomment-415520174

alaniwi commented 6 years ago

1.1.0 working with first example script at https://matplotlib.org/basemap/users/geography.html using drawcoastlines

alaniwi commented 6 years ago

Included in JAP 1.35. Installation date should be announced soon.