@@ -3982,6 +3982,9 @@ def warpimage(self,image="bluemarble",scale=None,**kwargs):
3982
3982
except ImportError :
3983
3983
raise ImportError ('warpimage method requires PIL (http://www.pythonware.com/products/pil)' )
3984
3984
from matplotlib .image import pil_to_array
3985
+ if self .celestial :
3986
+ msg = 'warpimage does not work in celestial coordinates'
3987
+ raise ValueError (msg )
3985
3988
ax = kwargs .pop ('ax' , None ) or self ._check_ax ()
3986
3989
# default image file is blue marble next generation
3987
3990
# from NASA (http://visibleearth.nasa.gov).
@@ -4089,7 +4092,8 @@ def warpimage(self,image="bluemarble",scale=None,**kwargs):
4089
4092
# make points outside projection limb transparent.
4090
4093
self ._bm_rgba_warped = self ._bm_rgba_warped .filled (0. )
4091
4094
# treat pseudo-cyl projections such as mollweide, robinson and sinusoidal.
4092
- elif self .projection in _pseudocyl :
4095
+ elif self .projection in _pseudocyl and \
4096
+ self .projection != 'hammer' :
4093
4097
lonsr ,latsr = self (x ,y ,inverse = True )
4094
4098
mask = ma .zeros ((ny ,nx ,4 ),np .int8 )
4095
4099
lon_0 = self .projparams ['lon_0' ]
@@ -4112,6 +4116,12 @@ def warpimage(self,image="bluemarble",scale=None,**kwargs):
4112
4116
self ._bm_rgba_warped = self ._bm_rgba_warped .filled (0. )
4113
4117
# plot warped rgba image.
4114
4118
im = self .imshow (self ._bm_rgba_warped ,ax = ax ,** kwargs )
4119
+ # for hammer projection, use clip path defined by
4120
+ # projection limb (patch created in drawmapboundary).
4121
+ if self .projection == 'hammer' :
4122
+ if not self ._mapboundarydrawn :
4123
+ self .drawmapboundary (color = 'none' ,linewidth = None )
4124
+ im .set_clip_path (self ._mapboundarydrawn )
4115
4125
else :
4116
4126
# bmproj True, no interpolation necessary.
4117
4127
im = self .imshow (self ._bm_rgba ,ax = ax ,** kwargs )
0 commit comments