Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
version 1.0.5 (not yet released)
--------------------------------
version 1.0.5 (git tag v1.0.5rel)
---------------------------------
* fix error in contour method that caused a bogus mask to be applied
to the data (issue 58).
* fix further corner cases with splitting of parallels that cross
the dateline (issue 40).
* add latlon keyword to plotting methods. If latlon=True, x and y
Expand Down
3 changes: 2 additions & 1 deletion KNOWN_BUGS
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
always tries to fill the inside of a polygon. Under certain situations,
what is the inside of a coastline polygon can be ambiguous, and the
outside may be filled instead of the inside.
Workaround - mask the land areas with the drawlsmask method instead of
Workarounds - change the map projection region slightly or
mask the land areas with the drawlsmask method instead of
filling the coastline polygons (this is illustrated in the ortho_demo.py example).
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ include Changelog
include setup.py
include nad2bin.c
include src/*
include examples/shiftdata.py
include examples/allskymap.py
include examples/allskymap_cr_example.py
include examples/plothighsandlows.py
Expand Down
3 changes: 3 additions & 0 deletions examples/README
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,6 @@ make_inset.py shows how to make an inset showing the location of the map project
from a global perspective.

utmtest.py shows how to plot a UTM zone.

shiftdata.py shows how to use the 'latlon' keyword to automatically transform to map
projection coordinates and shift the data longitudinally to fit the map projection region.
20 changes: 10 additions & 10 deletions examples/ccsm_popgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@
plt.figure(figsize=(6,8))
plt.subplot(2,1,1)
# subplot 1 just shows POP grid cells.
map = Basemap(projection='merc', lat_ts=20, llcrnrlon=-180, \
m = Basemap(projection='merc', lat_ts=20, llcrnrlon=-180, \
urcrnrlon=180, llcrnrlat=-84, urcrnrlat=84, resolution='c')

map.drawcoastlines()
map.fillcontinents(color='white')
m.drawcoastlines()
m.fillcontinents(color='white')

x, y = map(tlon,tlat)
im = map.pcolor(x,y,ma.masked_array(np.zeros(temp.shape,'f'), temp.mask),
shading='faceted', antialiased=True, cmap=plt.cm.cool,
x, y = m(tlon,tlat)
im = m.pcolor(x,y,ma.masked_array(np.zeros(temp.shape,'f'), temp.mask),
shading='faceted', antialiased=True, cmap=plt.cm.cool,
vmin=0, vmax=0)
# disclaimer: these are not really the grid cells because of the
# way pcolor interprets the x and y args.
Expand All @@ -66,11 +66,11 @@
# subplot 2 is a contour plot of surface temperature from the
# CCSM ocean model.
plt.subplot(2,1,2)
map.drawcoastlines()
map.fillcontinents(color='white')
m.drawcoastlines()
m.fillcontinents(color='white')

CS1 = map.contourf(x,y,temp,15)
CS2 = map.contour(x,y,temp,15,colors='black',linewidths=0.5)
CS1 = m.contourf(x,y,temp,15)
CS2 = m.contour(x,y,temp,15,colors='black',linewidths=0.5)
plt.title('(B) Surface Temp contours on POP Grid')

plt.show()
Expand Down
4 changes: 2 additions & 2 deletions examples/fcstmaps_axesgrid.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import print_function
# this example reads today's numerical weather forecasts
# this example reads today's numerical weather forecasts
# from the NOAA OpenDAP servers and makes a multi-panel plot.
# This version demonstrates the use of the AxesGrid toolkit.
import numpy as np
Expand Down Expand Up @@ -100,7 +100,7 @@
ax.set_title('%d-h forecast valid '%fcsthr+verifdates[nt],fontsize=9)
# figure title
plt.figtext(0.5,0.95,
"2-m temp (\N{DEGREE SIGN}C) forecasts from %s"%verifdates[0],
u"2-m temp (\N{DEGREE SIGN}C) forecasts from %s"%verifdates[0],
horizontalalignment='center',fontsize=14)
# a single colorbar.
cbar = fig.colorbar(cs, cax=grid.cbar_axes[0], orientation='horizontal')
Expand Down
3 changes: 1 addition & 2 deletions examples/geos_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ def get_input(prompt):
fig = plt.figure()
m = Basemap(projection='geos',lon_0=lon_0,rsphere=(6378137.00,6356752.3142),resolution='l')
m.drawcoastlines()
m.drawmapboundary(fill_color='aqua')
m.fillcontinents(color='coral',lake_color='aqua')
m.drawmapboundary(fill_color='aqua')
m.drawcountries()
# draw parallels and meridians.
m.drawparallels(np.arange(-90.,120.,30.))
m.drawmeridians(np.arange(0.,420.,60.))
m.drawmapboundary()
plt.title('Geostationary Map Centered on Lon=%s' % (lon_0))
plt.show()
20 changes: 18 additions & 2 deletions lib/mpl_toolkits/basemap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,8 @@ def __init__(self, llcrnrlon=None, llcrnrlat=None,
self.boundinglat = boundinglat
# is a round pole-centered plot desired?
self.round = round
# full disk projection?
self._fulldisk = False # default value

# set up projection parameter dict.
projparams = {}
Expand Down Expand Up @@ -1378,6 +1380,13 @@ def _getmapboundary(self):
n = n + 1
self.boundarylonmin = lons.min()
self.boundarylonmax = lons.max()
# for circular full disk projections where boundary is
# a latitude circle, set boundarylonmax and boundarylonmin
# to cover entire world (so parallels will be drawn).
if self._fulldisk and \
np.abs(self.boundarylonmax-self.boundarylonmin) < 1.:
self.boundarylonmin = -180.
self.boundarylonmax = 180.
b = np.empty((len(lons),2),np.float64)
b[:,0] = lons; b[:,1] = lats
boundaryll = _geoslib.Polygon(b)
Expand Down Expand Up @@ -3083,6 +3092,8 @@ def pcolor(self,x,y,data,**kwargs):
x = np.compress(mask,x)
y = np.compress(mask,y)
data = np.compress(mask,data)
# delete this keyword so it's not pass on to pcolor.
del kwargs['tri']
if masked:
triang = tri.Triangulation(x, y)
z = data[triang.triangles]
Expand All @@ -3091,8 +3102,6 @@ def pcolor(self,x,y,data,**kwargs):
ret = ax.tripcolor(triang,data,**kwargs)
else:
ret = ax.tripcolor(x,y,data,**kwargs)
# delete this keyword so it's not pass on to pcolor.
del kwargs['tri']
else:
# make x,y masked arrays
# (masked where data is outside of projection limb)
Expand Down Expand Up @@ -3249,6 +3258,8 @@ def contour(self,x,y,data,*args,**kwargs):
x = np.compress(mask,x)
y = np.compress(mask,y)
data = np.compress(mask,data)
# delete this keyword so it's not pass on to pcolor.
del kwargs['tri']
if masked:
triang = tri.Triangulation(x, y)
z = data[triang.triangles]
Expand Down Expand Up @@ -3457,6 +3468,11 @@ def streamplot(self, x, y, u, v, *args, **kwargs):

Other \*args and \**kwargs passed on to matplotlib.pyplot.streamplot.
"""
if _matplotlib_version < '1.2':
msg = dedent("""
streamplot method requires matplotlib 1.2 or higher,
you have %s""" % _matplotlib_version)
raise NotImplementedError(msg)
ax, plt = self._ax_plt_from_kw(kwargs)
# allow callers to override the hold state by passing hold=True|False
b = ax.ishold()
Expand Down