Revision: 6705 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6705&view=rev Author: jswhit Date: 2008年12月28日 16:07:10 +0000 (2008年12月28日) Log Message: ----------- simplify calculation of geostationary limb Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py 2008年12月26日 23:20:56 UTC (rev 6704) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py 2008年12月28日 16:07:10 UTC (rev 6705) @@ -94,20 +94,21 @@ elif self.projection == 'geos': self._proj4 = pyproj.Proj(projparams) # find major and minor axes of ellipse defining map proj region. - delta = 0.01 - lats = np.arange(0,90,delta) - lon_0 = projparams['lon_0'] - lons = lon_0*np.ones(len(lats),'d') - x, y = self._proj4(lons, lats) - yi = (y > 1.e20).tolist() - ny = yi.index(1)-1 - height = y[ny] - lons = np.arange(lon_0,lon_0+90,delta) - lats = np.zeros(len(lons),'d') - x, y = self(lons, lats) - xi = (x > 1.e20).tolist() - nx = xi.index(1)-1 - width = x[nx] + # h is measured from surface of earth at equator. + h = projparams['h'] + self.rmajor + # latitude of horizon on central meridian + lonmax = 90.-(180./np.pi)*np.arcsin(self.rmajor/h) + # longitude of horizon on equator + latmax = 90.-(180./np.pi)*np.arcsin(self.rminor/h) + # truncate to nearest hundredth of a degree (to make sure + # they aren't slightly over the horizon) + latmax = int(100*latmax)/100. + lonmax = int(100*lonmax)/100. + # width and height of visible projection + P = pyproj.Proj(proj='geos',a=self.rmajor,\ + b=self.rminor,lat_0=0,lon_0=0,h=projparams['h']) + x1,y1 = P(0.,latmax); x2,y2 = P(lonmax,0.) + width = x2; height = y1 self._height = height self._width = width if (llcrnrlon == -180 and llcrnrlat == -90 and This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6721 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6721&view=rev Author: jswhit Date: 2008年12月31日 16:29:37 +0000 (2008年12月31日) Log Message: ----------- fix typo Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py 2008年12月31日 14:41:54 UTC (rev 6720) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py 2008年12月31日 16:29:37 UTC (rev 6721) @@ -101,8 +101,8 @@ full disk (whole world) Azimuthal Equidistant projection can only be drawn for a perfect sphere""") raise ValueError(msg) - llcrnrx = -0.5*(self.rmajor+self.rminor) - llcrnry = -0.5*(self.rmajor+self.rminor) + llcrnrx = -np.pi*self.rminor + llcrnry = -np.pi*self.rminor self._width = -llcrnrx self._height = -llcrnry urcrnrx = -llcrnrx This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6722 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6722&view=rev Author: jswhit Date: 2008年12月31日 17:00:34 +0000 (2008年12月31日) Log Message: ----------- add some comments Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py 2008年12月31日 16:29:37 UTC (rev 6721) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py 2008年12月31日 17:00:34 UTC (rev 6722) @@ -96,13 +96,17 @@ urcrnrlat == 90): self._fulldisk = True self._proj4 = pyproj.Proj(projparams) + # raise an exception for ellipsoids - there appears to be a bug + # in proj4 that causes the inverse transform to fail for points + # more than 90 degrees of arc away from center point for ellipsoids + # (works fine for spheres) if self.ellipsoid: msg = dedent(""" full disk (whole world) Azimuthal Equidistant projection can only be drawn for a perfect sphere""") raise ValueError(msg) - llcrnrx = -np.pi*self.rminor - llcrnry = -np.pi*self.rminor + llcrnrx = -np.pi*self.rmajor + llcrnry = -np.pi*self.rmajor self._width = -llcrnrx self._height = -llcrnry urcrnrx = -llcrnrx This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6723 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6723&view=rev Author: jswhit Date: 2008年12月31日 17:10:51 +0000 (2008年12月31日) Log Message: ----------- more comments added to document proj4 bug Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py 2008年12月31日 17:00:34 UTC (rev 6722) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/proj.py 2008年12月31日 17:10:51 UTC (rev 6723) @@ -99,7 +99,11 @@ # raise an exception for ellipsoids - there appears to be a bug # in proj4 that causes the inverse transform to fail for points # more than 90 degrees of arc away from center point for ellipsoids - # (works fine for spheres) + # (works fine for spheres) - below is an example + #from pyproj import Proj + #p1 = Proj(proj='aeqd',a=6378137.00,b=6356752.3142,lat_0=0,lon_0=0) + #x,y= p1(91,0) + #lon,lat = p1(x,y,inverse=True) # lon is 89 instead of 91 if self.ellipsoid: msg = dedent(""" full disk (whole world) Azimuthal Equidistant projection can This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.