From: <js...@us...> - 2007-11-20 20:21:57
|
Revision: 4397 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4397&view=rev Author: jswhit Date: 2007-11-20 12:21:53 -0800 (Tue, 20 Nov 2007) Log Message: ----------- fix drawlsmask for 'moll','robin' and 'sinu' projections. Modified Paths: -------------- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-20 18:25:33 UTC (rev 4396) +++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-20 20:21:53 UTC (rev 4397) @@ -2461,8 +2461,22 @@ nx = int((self.xmax-self.xmin)/dx)+1; ny = int((self.ymax-self.ymin)/dx)+1 # interpolate rgba values from proj='cyl' (geographic coords) # to a rectangular map projection grid. - mask = self.transform_scalar(lsmask,lsmask_lons,\ - lsmask_lats,nx,ny,order=0,masked=255) + mask,x,y = self.transform_scalar(lsmask,lsmask_lons,\ + lsmask_lats,nx,ny,returnxy=True,order=0,masked=255) + # for these projections, points outside the projection + # limb have to be set to transparent manually. + if self.projection in ['moll','robin','sinu']: + lons, lats = self(x, y, inverse=True) + lon_0 = self.projparams['lon_0'] + lats = lats[:,nx/2] + lons1 = (lon_0+180.)*npy.ones(lons.shape[0],npy.float64) + lons2 = (lon_0-180.)*npy.ones(lons.shape[0],npy.float64) + xmax,ytmp = self(lons1,lats) + xmin,ytmp = self(lons2,lats) + for j in range(lats.shape[0]): + xx = x[j,:] + mask[j,:]=npy.where(npy.logical_or(xx<xmin[j],xx>xmax[j]),\ + 255,mask[j,:]) self.lsmask = mask # optionally, set lakes to ocean color. if lakes: @@ -2479,6 +2493,7 @@ rgba[:,:,3] = npy.where(mask==255,0,rgba[:,:,3]) # plot mask as rgba image. im = self.imshow(rgba,interpolation='nearest',ax=ax,**kwargs) + return im ### End of Basemap class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-21 13:23:56
|
Revision: 4400 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4400&view=rev Author: jswhit Date: 2007-11-21 05:23:54 -0800 (Wed, 21 Nov 2007) Log Message: ----------- add disclaimer in drawlsmask docstring Modified Paths: -------------- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-20 22:00:51 UTC (rev 4399) +++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-21 13:23:54 UTC (rev 4400) @@ -167,7 +167,7 @@ The following parameters are map projection parameters which all default to None. Not all parameters are used by all projections, some are ignored. - The module variable 'projection_params' is a dictionary which + The module variable 'projection_params' is a dictionary which lists which parameters apply to which projections. lat_ts - latitude of true scale for mercator projection, optional @@ -2388,6 +2388,9 @@ """ draw land-sea mask image. + *Note* the land-sea mask image cannot be overlaid on top + of other images, due to limitations in matplotlib image handling. + land is colored with rgba integer tuple rgba_land. ocean is colored with rgba integer tuple rgba_ocean. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-21 21:25:29
|
Revision: 4413 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4413&view=rev Author: jswhit Date: 2007-11-21 13:25:27 -0800 (Wed, 21 Nov 2007) Log Message: ----------- fix error message Modified Paths: -------------- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-21 20:53:42 UTC (rev 4412) +++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-21 21:25:27 UTC (rev 4413) @@ -334,7 +334,7 @@ lat_1 = lat_0 projparams['lat_1'] = lat_1 if lat_1 is None or lon_0 is None: - raise ValueError('must specify lat_1 or lat_0 and lon_0 for %(projection)s basemap (lat_2 is optional)' % _projnames) + raise ValueError('must specify lat_1 or lat_0 and lon_0 for %s basemap (lat_2 is optional)' % _projnames[projection]) if lat_2 is None: projparams['lat_2'] = lat_1 if not using_corners: @@ -360,7 +360,7 @@ 'splaea', 'nplaea', 'spaeqd', 'npaeqd']: if boundinglat is None or lon_0 is None: - raise ValueError('must specify boundinglat and lon_0 for %(projection) basemap' % _projnames) + raise ValueError('must specify boundinglat and lon_0 for %s basemap' % _projnames[projection]) if projection[0] == 's': sgn = -1 else: @@ -377,7 +377,7 @@ lon,self.llcrnrlat = proj(math.sqrt(2.)*y,0.,inverse=True) self.urcrnrlat = self.llcrnrlat if width is not None or height is not None: - print 'warning: width and height keywords ignored for %s projection' % self.projection + print 'warning: width and height keywords ignored for %s projection' % _projnames[projection] elif projection == 'laea': if lat_0 is None or lon_0 is None: raise ValueError, 'must specify lat_0 and lon_0 for Lambert Azimuthal basemap' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-22 03:53:10
|
Revision: 4417 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4417&view=rev Author: jswhit Date: 2007-11-21 19:53:04 -0800 (Wed, 21 Nov 2007) Log Message: ----------- make sure ponds in islands in lakes are filled with correctly Modified Paths: -------------- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-21 21:37:02 UTC (rev 4416) +++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-22 03:53:04 UTC (rev 4417) @@ -1071,7 +1071,7 @@ hasp3 = npy.sum(test1*test4) if not hasp1 or not hasp2 or not hasp3 or not hasp4: xy = zip(xa.tolist(),ya.tolist()) - if self.coastpolygontypes[np] != 2: + if self.coastpolygontypes[np] not in [2,4]: poly = Polygon(xy,facecolor=color,edgecolor=color,linewidth=0) else: # lakes filled with background color by default if lake_color is None: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |