From: <js...@us...> - 2007-12-03 22:32:40
|
Revision: 4570 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4570&view=rev Author: jswhit Date: 2007-12-03 14:32:28 -0800 (Mon, 03 Dec 2007) Log Message: ----------- add default for altitude of geostationary orbit in 'geos' projection. Modified Paths: -------------- trunk/toolkits/basemap/examples/geos_demo.py trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/examples/geos_demo.py =================================================================== --- trunk/toolkits/basemap/examples/geos_demo.py 2007-12-03 19:16:17 UTC (rev 4569) +++ trunk/toolkits/basemap/examples/geos_demo.py 2007-12-03 22:32:28 UTC (rev 4570) @@ -3,12 +3,10 @@ # create Basemap instance for Geostationary (satellite view) projection. lon_0 = float(raw_input('enter reference longitude (lon_0):')) -#h = float(raw_input('enter satellite height above equator in meters (satellite_height):')) -h = 35785831.0 # map with land/sea mask plotted fig=figure() -m = Basemap(projection='geos',lon_0=lon_0,satellite_height=h,rsphere=(6378137.00,6356752.3142),resolution=None) +m = Basemap(projection='geos',lon_0=lon_0,rsphere=(6378137.00,6356752.3142),resolution=None) # plot land-sea mask. rgba_land = (0,255,0,255) # land green. rgba_ocean = (0,0,255,255) # ocean blue. @@ -18,11 +16,11 @@ m.drawparallels(arange(-90.,120.,30.)) m.drawmeridians(arange(0.,420.,60.)) m.drawmapboundary() -title('Geostationary Map Centered on Lon=%s, Satellite Height=%s' % (lon_0,h)) +title('Geostationary Map Centered on Lon=%s' % (lon_0)) # map with continents drawn and filled. fig = figure() -m = Basemap(projection='geos',lon_0=lon_0,satellite_height=h,rsphere=(6378137.00,6356752.3142),resolution='l') +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') @@ -31,5 +29,5 @@ m.drawparallels(arange(-90.,120.,30.)) m.drawmeridians(arange(0.,420.,60.)) m.drawmapboundary() -title('Geostationary Map Centered on Lon=%s, Satellite Height=%s' % (lon_0,h)) +title('Geostationary Map Centered on Lon=%s' % (lon_0)) show() Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007-12-03 19:16:17 UTC (rev 4569) +++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007-12-03 22:32:28 UTC (rev 4570) @@ -212,7 +212,7 @@ on the north or south pole. The longitude lon_0 is at 6-o'clock, and the latitude circle boundinglat is tangent to the edge of the map at lon_0. satellite_height - height of satellite (in m) above equator - - only relevant for geostationary projections ('geos'). + only relevant for geostationary projections ('geos'). Default 35,786 km. Here are the most commonly used class methods (see the docstring for each for more details): @@ -324,7 +324,7 @@ lat_0=None, lon_0=None, lon_1=None, lon_2=None, suppress_ticks=True, - satellite_height=None, + satellite_height=35786000, boundinglat=None, anchor='C', ax=None): @@ -362,7 +362,7 @@ _insert_validated(projparams, lon_0, 'lon_0', -360, 720) _insert_validated(projparams, lon_1, 'lon_1', -360, 720) _insert_validated(projparams, lon_2, 'lon_2', -360, 720) - if satellite_height is not None: + if projection == 'geos': projparams['h'] = satellite_height # check for sane values of projection corners. using_corners = (None not in [llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat]) @@ -488,8 +488,8 @@ if npy.abs(lat_0) < 1.e-2: lat_0 = 1.e-2 projparams['lat_0'] = lat_0 elif projection == 'geos': - if lon_0 is None and satellite_height is None: - raise ValueError, 'must specify lon_0 and satellite_height for Geostationary basemap' + if lon_0 is None: + raise ValueError, 'must specify lon_0 for Geostationary basemap' if width is not None or height is not None: print 'warning: width and height keywords ignored for %s projection' % self.projection if not using_corners: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |