From: <js...@us...> - 2008-09-30 17:29:25
|
Revision: 6136 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6136&view=rev Author: jswhit Date: 2008-09-30 17:29:03 +0000 (Tue, 30 Sep 2008) Log Message: ----------- added two new projections ('mbtfpq' and 'gall') Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/examples/plot_tissot.py trunk/toolkits/basemap/examples/test.py trunk/toolkits/basemap/examples/warpimage.py trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008-09-30 11:18:10 UTC (rev 6135) +++ trunk/toolkits/basemap/Changelog 2008-09-30 17:29:03 UTC (rev 6136) @@ -1,4 +1,7 @@ version 0.99.2 (not yet released) + * Added McBryde-Thomas Flat Polar Quartic (projection = + 'mbtfpq') and Gall Stereographic Cylindrical (projection = + 'gall'). * fix warpimage and bluemarble methods for projection = 'cyl', 'robin', 'moll' and 'sinu'. * bugfix patch for rotate_vector from David Huard. David Modified: trunk/toolkits/basemap/examples/plot_tissot.py =================================================================== --- trunk/toolkits/basemap/examples/plot_tissot.py 2008-09-30 11:18:10 UTC (rev 6135) +++ trunk/toolkits/basemap/examples/plot_tissot.py 2008-09-30 17:29:03 UTC (rev 6136) @@ -25,8 +25,9 @@ m5 = Basemap(lon_0=270,lat_0=90,boundinglat=10,projection='nplaea') m6 = Basemap(lon_0=0,projection='moll') m7 = Basemap(lon_0=0,projection='robin') +m8 = Basemap(lon_0=0,projection='mbtfpq') -for m in [m1,m2,m3,m4,m5,m6,m7]: +for m in [m1,m2,m3,m4,m5,m6,m7,m8]: # make a new figure. fig = plt.figure() # draw "circles" at specified longitudes and latitudes. Modified: trunk/toolkits/basemap/examples/test.py =================================================================== --- trunk/toolkits/basemap/examples/test.py 2008-09-30 11:18:10 UTC (rev 6135) +++ trunk/toolkits/basemap/examples/test.py 2008-09-30 17:29:03 UTC (rev 6136) @@ -75,6 +75,26 @@ # create new figure fig=plt.figure() +# setup gall stereographic cylindrical map projection. +m = Basemap(llcrnrlon=-180.,llcrnrlat=-90,urcrnrlon=180.,urcrnrlat=90.,\ + resolution='c',area_thresh=10000.,projection='gall') +# transform to nx x ny regularly spaced native projection grid +nx = len(lons); ny = len(lats) +topodat = m.transform_scalar(topoin,lons,lats,nx,ny) +fig.add_axes([0.1,0.1,0.75,0.75]) +# plot image over map. +im = m.imshow(topodat,plt.cm.jet) +m.drawcoastlines() +# draw parallels +m.drawparallels(circles,labels=[1,1,1,1]) +# draw meridians +m.drawmeridians(meridians,labels=[1,1,1,1]) +plt.title('Gall Stereographic Cylindrical',y=1.1) +print 'plotting Gall Stereographic Cylindrical example ...' +print m.proj4string + +# create new figure +fig=plt.figure() # setup mercator map projection (-80 to +80). m = Basemap(llcrnrlon=-180.,llcrnrlat=-80,urcrnrlon=180.,urcrnrlat=80.,\ resolution='c',area_thresh=10000.,projection='merc',\ @@ -615,6 +635,33 @@ plt.title('Robinson') print 'plotting Robinson example ...' print m.proj4string + +# create new figure +fig=plt.figure() +# setup of basemap ('mbtfpq' = McBryde-Thomas Flat Polar Quartic projection) +m = Basemap(projection='mbtfpq', + resolution='c',area_thresh=10000.,lon_0=0.5*(lonsin[0]+lonsin[-1])) +ax = fig.add_axes([0.1,0.1,0.7,0.7]) +# plot image over map with pcolormesh. +x,y = m(*np.meshgrid(lonsin,latsin)) +p = m.pcolormesh(x,y,topodatin,shading='flat') +pos = ax.get_position() +l, b, w, h = pos.bounds +cax = plt.axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. +plt.colorbar(cax=cax) # draw colorbar +plt.axes(ax) # make the original axes current again +# draw coastlines and political boundaries. +m.drawcoastlines() +# draw parallels and meridians +parallels = np.arange(-60.,90,30.) +m.drawparallels(parallels,labels=[1,0,0,0]) +meridians = np.arange(0.,360.,60.) +m.drawmeridians(meridians,labels=[0,0,0,1],fontsize=8) +# draw boundary around map region. +m.drawmapboundary() +plt.title('McBryde-Thomas Flat Polar Quartic') +print 'plotting McBryde-Thomas Flat Polar Quartic example ...' +print m.proj4string plt.show() Modified: trunk/toolkits/basemap/examples/warpimage.py =================================================================== --- trunk/toolkits/basemap/examples/warpimage.py 2008-09-30 11:18:10 UTC (rev 6135) +++ trunk/toolkits/basemap/examples/warpimage.py 2008-09-30 17:29:03 UTC (rev 6136) @@ -22,16 +22,16 @@ # create new figure fig=plt.figure() -# define orthographic projection centered on North America. -m = Basemap(projection='robin',lon_0=-100,resolution='l') +# define projection centered on North America. +m = Basemap(projection='mbtfpq',lon_0=-100,resolution='l') m.bluemarble() # draw coastlines. m.drawcoastlines(linewidth=0.5,color='0.5') # draw lat/lon grid lines every 30 degrees. m.drawmeridians(np.arange(0,360,60),color='0.5') m.drawparallels(np.arange(-90,90,30),color='0.5') -plt.title("Blue Marble image warped from 'cyl' to 'robinson' projection",fontsize=12) -print 'warp to robinson map ...' +plt.title("Blue Marble image warped from 'cyl' to 'mbtfpq' projection",fontsize=12) +print 'warp to McBryde-Thomas Flat-Polar Quartic map ...' # create new figure fig=plt.figure() Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-09-30 11:18:10 UTC (rev 6135) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-09-30 17:29:03 UTC (rev 6136) @@ -49,6 +49,7 @@ 'tmerc' : 'Transverse Mercator', 'omerc' : 'Oblique Mercator', 'mill' : 'Miller Cylindrical', + 'gall' : 'Gall Stereographic Cylindrical', 'lcc' : 'Lambert Conformal', 'laea' : 'Lambert Azimuthal Equal Area', 'nplaea' : 'North-Polar Lambert Azimuthal', @@ -68,6 +69,7 @@ 'sinu' : 'Sinusoidal', 'moll' : 'Mollweide', 'robin' : 'Robinson', + 'mbtfpq' : 'McBryde-Thomas Flat-Polar Quartic', 'gnom' : 'Gnomonic', } supported_projections = [] @@ -75,12 +77,16 @@ supported_projections.append(" %-17s%-40s\n" % (_items)) supported_projections = ''.join(supported_projections) +_cylproj = ['cyl','merc','mill','gall'] +_pseudocyl = ['moll','robin','sinu','mbtfpq'] + # projection specific parameters. projection_params = {'cyl' : 'corners only (no width/height)', 'merc' : 'corners plus lat_ts (no width/height)', 'tmerc' : 'lon_0,lat_0', 'omerc' : 'lon_0,lat_0,lat_1,lat_2,lon_1,lon_2,no_rot', 'mill' : 'corners only (no width/height)', + 'gall' : 'corners only (no width/height)', 'lcc' : 'lon_0,lat_0,lat_1,lat_2', 'laea' : 'lon_0,lat_0', 'nplaea' : 'bounding_lat,lon_0,lat_0,no corners or width/height', @@ -100,6 +106,7 @@ 'sinu' : 'lon_0,lat_0,no corners or width/height', 'moll' : 'lon_0,lat_0,no corners or width/height', 'robin' : 'lon_0,lat_0,no corners or width/height', + 'mbtfpq' : 'lon_0,lat_0,no corners or width/height', 'gnom' : 'lon_0,lat_0', } @@ -160,7 +167,7 @@ ============== ==================================================== For ``sinu``, ``moll``, ``npstere``, ``spstere``, ``nplaea``, ``splaea``, - ``npaeqd``, ``spaeqd`` or ``robin``, the values of + ``npaeqd``, ``spaeqd``, ``robin`` or ``mbtfpq``, the values of llcrnrlon, llcrnrlat, urcrnrlon, urcrnrlat, width and height are ignored (because either they are computed internally, or entire globe is always plotted). @@ -588,7 +595,7 @@ self._fulldisk = False self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat - elif projection in ['moll','robin','sinu']: + elif projection in _pseudocyl: if lon_0 is None: raise ValueError, 'must specify lon_0 for Robinson, Mollweide, or Sinusoidal basemap' if width is not None or height is not None: @@ -630,7 +637,7 @@ llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat = _choosecorners(width,height,**projparams) self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat - elif projection == 'mill': + elif projection in ['mill','gall']: if not using_corners: llcrnrlon = -180. llcrnrlat = -90. @@ -710,10 +717,10 @@ self.urcrnrx = proj.urcrnrx self.urcrnry = proj.urcrnry # set min/max lats for projection domain. - if projection in ['mill','cyl','merc']: + if projection in _cylproj: self.latmin = self.llcrnrlat self.latmax = self.urcrnrlat - elif projection in ['ortho','geos','moll','robin','sinu']: + elif projection in ['ortho','geos'] + _pseudocyl: self.latmin = -90. self.latmax = 90. else: @@ -759,7 +766,7 @@ yd = (y[1:]-y[0:-1])**2 dist = np.sqrt(xd+yd) split = dist > 5000000. - if np.sum(split) and self.projection not in ['merc','cyl','mill']: + if np.sum(split) and self.projection not in _cylproj: ind = (np.compress(split,np.squeeze(split*np.indices(xd.shape)))+1).tolist() iprev = 0 ind.append(len(xd)) @@ -838,8 +845,7 @@ containsPole = hasNP or hasSP # these projections cannot cross pole. if containsPole and\ - self.projection in ['merc','mill','cyl','robin','moll','sinu','geos']: - #self.projection in ['tmerc','omerc','cass','merc','mill','cyl','robin','moll','sinu','geos']: + self.projection in _cylproj + _pseudocyl + ['geos']: raise ValueError('%s projection cannot cross pole'%(self.projection)) # make sure orthographic or gnomonic projection has containsPole=True # we will compute the intersections in stereographic @@ -1068,7 +1074,7 @@ projparms['x_0']=-llcrnrx projparms['y_0']=-llcrnry maptran = pyproj.Proj(projparms) - elif self.projection in ['moll','robin','sinu']: + elif self.projection in _pseudocyl: # quasi-elliptical region. lon_0 = self.projparams['lon_0'] # left side @@ -1110,7 +1116,7 @@ b[:,0]=[self.xmin,self.xmin,self.xmax,self.xmax] b[:,1]=[self.ymin,self.ymax,self.ymax,self.ymin] boundaryxy = _geoslib.Polygon(b) - if self.projection in ['mill','merc','cyl']: + if self.projection in _cylproj: # make sure map boundary doesn't quite include pole. if self.urcrnrlat > 89.9999: urcrnrlat = 89.9999 @@ -1127,7 +1133,7 @@ b[:,0]=x; b[:,1]=y boundaryxy = _geoslib.Polygon(b) else: - if self.projection not in ['moll','robin','sinu']: + if self.projection not in _pseudocyl: lons, lats = maptran(x,y,inverse=True) # fix lons so there are no jumps. n = 1 @@ -1198,7 +1204,7 @@ limb.set_clip_on(False) if zorder is not None: limb.set_zorder(zorder) - elif self.projection in ['moll','robin','sinu']: # elliptical region. + elif self.projection in _pseudocyl: # elliptical region. nx = 100; ny = 100 # quasi-elliptical region. lon_0 = self.projparams['lon_0'] @@ -1738,7 +1744,7 @@ if xoffset is None: xoffset = (self.urcrnrx-self.llcrnrx)/100. - if self.projection in ['merc','cyl','mill','moll','robin','sinu']: + if self.projection in _cylproj + _pseudocyl: lons = np.arange(self.llcrnrlon,self.urcrnrlon+0.01,0.01) elif self.projection in ['tmerc']: lon_0 = self.projparams['lon_0'] @@ -1751,7 +1757,7 @@ circlesl = circles.tolist() except: circlesl = circles - if self.projection not in ['merc','cyl','mill','moll','robin','sinu']: + if self.projection not in _cylproj + _pseudocyl: if max(circlesl) > 0 and latmax not in circlesl: circlesl.append(latmax) if min(circlesl) < 0 and -latmax not in circlesl: @@ -1780,7 +1786,7 @@ yd = (y[1:]-y[0:-1])**2 dist = np.sqrt(xd+yd) split = dist > 500000. - if np.sum(split) and self.projection not in ['merc','cyl','mill','moll','robin','sinu']: + if np.sum(split) and self.projection not in _cylproj + _pseudocyl: ind = (np.compress(split,np.squeeze(split*np.indices(xd.shape)))+1).tolist() xl = [] yl = [] @@ -1816,12 +1822,12 @@ # if so, find x,y location of intersection and draw a label there. dx = (self.xmax-self.xmin)/1000. dy = (self.ymax-self.ymin)/1000. - if self.projection in ['moll','robin','sinu']: + if self.projection in _pseudocyl: lon_0 = self.projparams['lon_0'] for dolab,side in zip(labels,['l','r','t','b']): if not dolab: continue # for cylindrical projections, don't draw parallels on top or bottom. - if self.projection in ['cyl','merc','mill','moll','robin','sinu'] and side in ['t','b']: continue + if self.projection in _cylproj + _pseudocyl and side in ['t','b']: continue if side in ['l','r']: nmax = int((self.ymax-self.ymin)/dy+1) yy = np.linspace(self.llcrnry,self.urcrnry,nmax) @@ -1897,14 +1903,14 @@ if n >= 0: t = None if side == 'l': - if self.projection in ['moll','robin','sinu']: + if self.projection in _pseudocyl: xlab,ylab = self(lon_0-179.9,lat) else: xlab = self.llcrnrx xlab = xlab-xoffset t = ax.text(xlab,yy[n],latlab,horizontalalignment='right',verticalalignment='center',**kwargs) elif side == 'r': - if self.projection in ['moll','robin','sinu']: + if self.projection in _pseudocyl: xlab,ylab = self(lon_0+179.9,lat) else: xlab = self.urcrnrx @@ -1994,7 +2000,7 @@ if xoffset is None: xoffset = (self.urcrnrx-self.llcrnrx)/100. - if self.projection not in ['merc','cyl','mill','moll','robin','sinu']: + if self.projection not in _cylproj + _pseudocyl: lats = np.arange(-latmax,latmax+0.01,0.01) else: lats = np.arange(-90,90.01,0.01) @@ -2022,7 +2028,7 @@ yd = (y[1:]-y[0:-1])**2 dist = np.sqrt(xd+yd) split = dist > 500000. - if np.sum(split) and self.projection not in ['merc','cyl','mill','moll','robin','sinu']: + if np.sum(split) and self.projection not in _cylproj + _pseudocyl: ind = (np.compress(split,np.squeeze(split*np.indices(xd.shape)))+1).tolist() xl = [] yl = [] @@ -2062,14 +2068,14 @@ # if so, find x,y location of intersection and draw a label there. dx = (self.xmax-self.xmin)/1000. dy = (self.ymax-self.ymin)/1000. - if self.projection in ['moll','sinu','robin']: + if self.projection in _pseudocyl: lon_0 = self.projparams['lon_0'] xmin,ymin = self(lon_0-179.9,-90) xmax,ymax = self(lon_0+179.9,90) for dolab,side in zip(labels,['l','r','t','b']): if not dolab: continue # for cylindrical projections, don't draw meridians on left or right. - if self.projection in ['cyl','merc','mill','sinu','robin','moll'] and side in ['l','r']: continue + if self.projection in _cylproj + _pseudocyl and side in ['l','r']: continue if side in ['l','r']: nmax = int((self.ymax-self.ymin)/dy+1) yy = np.linspace(self.llcrnry,self.urcrnry,nmax) @@ -2085,7 +2091,10 @@ lons = [(lon+360) % 360 for lon in lons] else: nmax = int((self.xmax-self.xmin)/dx+1) - xx = np.linspace(self.llcrnrx,self.urcrnrx,nmax) + if self.projection in _pseudocyl: + xx = np.linspace(xmin,xmax,nmax) + else: + xx = np.linspace(self.llcrnrx,self.urcrnrx,nmax) if side == 'b': lons,lats = self(xx,self.llcrnry*np.ones(xx.shape,np.float32),inverse=True) lons = lons.tolist(); lats = lats.tolist() @@ -2141,7 +2150,7 @@ for i,n in enumerate([nl,nr]): lat = lats[n]/100. # no meridians > latmax for projections other than merc,cyl,miller. - if self.projection not in ['merc','cyl','mill'] and lat > latmax: continue + if self.projection not in _cylproj and lat > latmax: continue # don't bother if close to the first label. if i and abs(nr-nl) < 100: continue if n >= 0: @@ -2151,11 +2160,9 @@ elif side == 'r': t = ax.text(self.urcrnrx+xoffset,yy[n],lonlab,horizontalalignment='left',verticalalignment='center',**kwargs) elif side == 'b': - if self.projection != 'robin' or (xx[n] > xmin and xx[n] < xmax): - t = ax.text(xx[n],self.llcrnry-yoffset,lonlab,horizontalalignment='center',verticalalignment='top',**kwargs) + t = ax.text(xx[n],self.llcrnry-yoffset,lonlab,horizontalalignment='center',verticalalignment='top',**kwargs) else: - if self.projection != 'robin' or (xx[n] > xmin and xx[n] < xmax): - t = ax.text(xx[n],self.urcrnry+yoffset,lonlab,horizontalalignment='center',verticalalignment='bottom',**kwargs) + t = ax.text(xx[n],self.urcrnry+yoffset,lonlab,horizontalalignment='center',verticalalignment='bottom',**kwargs) if t is not None: linecolls[lon][1].append(t) # set axes limits to fit map region. @@ -2313,7 +2320,7 @@ if min(delon) < 0. or min(delat) < 0.: raise ValueError, 'lons and lats must be increasing!' # check that lons in -180,180 for non-cylindrical projections. - if self.projection not in ['cyl','merc','mill']: + if self.projection not in _cylproj: lonsa = np.array(lons) count = np.sum(lonsa < -180.00001) + np.sum(lonsa > 180.00001) if count > 1: @@ -2384,7 +2391,7 @@ if min(delon) < 0. or min(delat) < 0.: raise ValueError, 'lons and lats must be increasing!' # check that lons in -180,180 for non-cylindrical projections. - if self.projection not in ['cyl','merc','mill']: + if self.projection not in _cylproj: lonsa = np.array(lons) count = np.sum(lonsa < -180.00001) + np.sum(lonsa > 180.00001) if count > 1: @@ -2516,7 +2523,7 @@ ax.set_xlim((self.llcrnrx, self.urcrnrx)) ax.set_ylim((self.llcrnry, self.urcrnry)) # turn off axes frame for non-rectangular projections. - if self.projection in ['moll','robin','sinu']: + if self.projection in _pseudocyl: ax.set_frame_on(False) if self.projection in ['ortho','geos'] and self._fulldisk: ax.set_frame_on(False) @@ -2782,7 +2789,7 @@ # print warning suggesting that the data be shifted in longitude # with the shiftgrid function. # only do this check for global projections. - if self.projection in ['merc','cyl','mill','moll','robin','sinu']: + if self.projection in _cylproj + _pseudocyl: xx = x[x.shape[0]/2,:] condition = (xx >= self.xmin) & (xx <= self.xmax) xl = xx.compress(condition).tolist() @@ -2855,7 +2862,7 @@ # print warning suggesting that the data be shifted in longitude # with the shiftgrid function. # only do this check for global projections. - if self.projection in ['merc','cyl','mill','moll','robin','sinu']: + if self.projection in _cylproj + _pseudocyl: xx = x[x.shape[0]/2,:] condition = (xx >= self.xmin) & (xx <= self.xmax) xl = xx.compress(condition).tolist() @@ -3101,7 +3108,7 @@ 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']: + if self.projection in _pseudocyl: lons, lats = self(x, y, inverse=True) lon_0 = self.projparams['lon_0'] lats = lats[:,nx/2] @@ -3207,7 +3214,7 @@ self._bm_lats = np.arange(-90.+0.5*delta,90.,delta) # is it a cylindrical projection whose limits lie # outside the limits of the image? - cylproj = self.projection in ['mill','cyl','merc'] and \ + cylproj = self.projection in _cylproj and \ (self.urcrnrlon > self._bm_lons[-1] or \ self.llcrnrlon < self._bm_lons[0]) # if pil_to_array returns a 2D array, it's a grayscale image. @@ -3260,8 +3267,8 @@ ma.masked_array(self._bm_rgba_warped,mask=mask) # make points outside projection limb transparent. self._bm_rgba_warped = self._bm_rgba_warped.filled(0.) - # treat mollweide, robinson and sinusoidal. - elif self.projection in ['moll','robin','sinu']: + # treat pseudo-cyl projections such as mollweide, robinson and sinusoidal. + elif self.projection in _pseudocyl: lonsr,latsr = self(x,y,inverse=True) mask = ma.zeros((ny,nx,4),np.int8) lon_0 = self.projparams['lon_0'] Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py 2008-09-30 11:18:10 UTC (rev 6135) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py 2008-09-30 17:29:03 UTC (rev 6136) @@ -6,6 +6,9 @@ _dg2rad = math.radians(1.) _rad2dg = math.degrees(1.) +_cylproj = ['cyl','merc','mill','gall'] +_pseudocyl = ['moll','robin','sinu','mbtfpq'] + _upper_right_out_of_bounds = ( 'the upper right corner of the plot is not in the map projection region') @@ -67,7 +70,7 @@ self.esq = (self.rmajor**2 - self.rminor**2)/self.rmajor**2 self.llcrnrlon = llcrnrlon self.llcrnrlat = llcrnrlat - if self.projection not in ['cyl','ortho','geos','moll','robin','sinu']: + if self.projection not in ['ortho','geos','cyl'] + _pseudocyl: self._proj4 = pyproj.Proj(projparams) llcrnrx, llcrnry = self(llcrnrlon,llcrnrlat) elif self.projection == 'cyl': @@ -119,7 +122,7 @@ llcrnrx, llcrnry = self(llcrnrlon,llcrnrlat) if llcrnrx > 1.e20 or llcrnry > 1.e20: raise ValueError(_lower_left_out_of_bounds) - elif self.projection in ['moll','robin','sinu']: + elif self.projection in _pseudocyl: self._proj4 = pyproj.Proj(projparams) xtmp,urcrnry = self(projparams['lon_0'],90.) urcrnrx,xtmp = self(projparams['lon_0']+180.,0) @@ -140,7 +143,7 @@ if urcrnrislatlon: self.urcrnrlon = urcrnrlon self.urcrnrlat = urcrnrlat - if self.projection not in ['ortho','geos','moll','robin','sinu']: + if self.projection not in ['ortho','geos'] + _pseudocyl: urcrnrx,urcrnry = self(urcrnrlon,urcrnrlat) elif self.projection == 'ortho': if self._fulldisk: @@ -158,7 +161,7 @@ urcrnrx,urcrnry = self(urcrnrlon,urcrnrlat) if urcrnrx > 1.e20 or urcrnry > 1.e20: raise ValueError(_upper_right_out_of_bounds) - elif self.projection in ['moll','robin','sinu']: + elif self.projection in _pseudocyl: xtmp,urcrnry = self(projparams['lon_0'],90.) urcrnrx,xtmp = self(projparams['lon_0']+180.,0) else: @@ -216,7 +219,7 @@ else: outx,outy = self._proj4(x, y, inverse=inverse) if inverse: - if self.projection in ['merc','mill']: + if self.projection in ['merc','mill','gall']: if self.projection == 'merc': coslat = math.cos(math.radians(self.projparams['lat_ts'])) sinlat = math.sin(math.radians(self.projparams['lat_ts'])) @@ -234,7 +237,7 @@ except: # x a sequence outx = [_rad2dg*(xi/rcurv) + self.llcrnrlon for xi in x] else: - if self.projection in ['merc','mill']: + if self.projection in ['merc','mill','gall']: if self.projection == 'merc': coslat = math.cos(math.radians(self.projparams['lat_ts'])) sinlat = math.sin(math.radians(self.projparams['lat_ts'])) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |