本文整理汇总了Python中mpl_toolkits.basemap.Basemap.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Basemap.__init__方法的具体用法?Python Basemap.__init__怎么用?Python Basemap.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpl_toolkits.basemap.Basemap
的用法示例。
在下文中一共展示了Basemap.__init__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import __init__ [as 别名]
def __init__(self,lon=None,lat=None,xlint=None,ylint=None,nocoast=False,
grid=False,**keys):
if lon != None:
slon = keys.setdefault('llcrnrlon', lon[0])
elon = keys.setdefault('urcrnrlon', lon[1])
else:
slon = keys.setdefault('llcrnrlon', 0.)
elon = keys.setdefault('urcrnrlon', 360.)
if lat != None:
slat = keys.setdefault('llcrnrlat', lat[0])
elat = keys.setdefault('urcrnrlat', lat[1])
else:
slat = -90.
elat = 90.
projection = keys.setdefault('projection','cyl')
label = keys.pop('label', True)
# 地図に合わせたデフォルト値
if projection == 'npstere':
boundinglat = keys.setdefault('boundinglat',max(slat, 0.))
keys.setdefault('lon_0',0.5*(slon+elon))
keys.setdefault('suppress_ticks',True)
keys.setdefault('round',True)
elif projection == 'spstere':
keys.setdefault('boundinglat',min(elat, 0.))
keys.setdefault('lon_0',0.5*(slon+elon))
keys.setdefault('suppress_ticks',True)
keys.setdefault('round',True)
elif projection == 'lcc':
keys.setdefault('lon_0',0.5*(slon+elon))
# keys.setdefault('lat_0',0.5*(slat+elat))
keys.setdefault('suppress_ticks',True)
if not grid: keys.setdefault('suppress_ticks',False)
# draw map
Basemap.__init__(self,**keys)
self.drawmapboundary()
if not nocoast: self.drawcoastlines(linewidth=0.5)
ax = self.ax or self._check_ax()
if projection == 'npstere' or projection == 'lcc' or grid:
if xlint is None: xlint=60
if ylint is None: ylint=20
if label:
self.drawmeridians(np.arange(0,360,xlint),labels=[1,1,1,1],linewidth=0.5)
self.drawparallels(np.arange(0,90.1,ylint),labels=[1,0,0,0],linewidth=0.5)
else:
self.drawmeridians(np.arange(0,360,xlint),labels=[0,0,0,0],linewidth=0.5)
self.drawparallels(np.arange(0,90.1,ylint),labels=[0,0,0,0],linewidth=0.5)
else:
if label:
ax.xaxis.set_major_formatter(ticker.BasemapXaxisFormatter(self))
ax.yaxis.set_major_formatter(ticker.BasemapYaxisFormatter(self))
else:
ax.xaxis.set_major_formatter(matplotlib.ticker.NullFormatter())
ax.yaxis.set_major_formatter(matplotlib.ticker.NullFormatter())
if xlint != None:
self.set_xlint(xlint)
if ylint != None:
self.set_ylint(ylint)
ax.tick_params(direction='out', top='off', right='off')
示例2: __init__
# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import __init__ [as 别名]
def __init__(self, region, **kwargs):
"""Init basemap instance using data from config files"""
self.basedir = os.path.dirname(os.path.abspath(__file__))
self.region = region
self.inkwargs = kwargs
self.read_configfile()
for key in ['llcrnrlon', 'urcrnrlon']:
self.base_kwargs[key] = self.base_kwargs[key] + self.merid_offset
for key,val in six.iteritems(self.inkwargs):
setattr(self, key, val)
Basemap.__init__(self, **self.base_kwargs)
示例3: __init__
# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import __init__ [as 别名]
def __init__(self,pole,resolution='c',boundinglat=0,lon_0=0,**kargs):
if pole=='north': prj='npstere'
else: prj='spstere'
Basemap.__init__(self,resolution=resolution,
boundinglat=boundinglat,
lon_0=lon_0,projection=prj,
**kargs)
self._tasks_done=False
示例4: __init__
# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import __init__ [as 别名]
def __init__(
self,
projection="hammer",
lat_0=0.0,
lon_0=0.0,
suppress_ticks=True,
boundinglat=None,
fix_aspect=True,
anchor=str("C"),
ax=None,
):
if projection != "hammer" and projection != "moll":
raise ValueError("Only hammer and moll projections supported!")
# Use Basemap's init, enforcing the values of many parameters that
# aren't used or whose Basemap defaults would not be altered for all-sky
# celestial maps.
Basemap.__init__(
self,
llcrnrlon=None,
llcrnrlat=None,
urcrnrlon=None,
urcrnrlat=None,
llcrnrx=None,
llcrnry=None,
urcrnrx=None,
urcrnry=None,
width=None,
height=None,
projection=projection,
resolution=None,
area_thresh=None,
rsphere=1.0,
lat_ts=None,
lat_1=None,
lat_2=None,
lat_0=lat_0,
lon_0=lon_0,
suppress_ticks=suppress_ticks,
satellite_height=1.0,
boundinglat=None,
fix_aspect=True,
anchor=anchor,
celestial=True,
ax=ax,
)
# Keep a local ref to lon_0 for hemisphere checking.
self._lon_0 = self.projparams["lon_0"]
self._limb = None
示例5: __init__
# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import __init__ [as 别名]
def __init__(self,
projection='hammer',
lat_0=0., lon_0=0.,
llcrnrx=None, llcrnry=None,
urcrnrx=None, urcrnry=None,
suppress_ticks=True,
boundinglat=None,
fix_aspect=True,
anchor='C',
ax=None):
#if projection != 'hammer' and projection !='moll':
# raise ValueError('Only hammer and moll projections supported!')
# Use Basemap's init, enforcing the values of many parameters that
# aren't used or whose Basemap defaults would not be altered for all-sky
# celestial maps.
Basemap.__init__(self, llcrnrlon=None, llcrnrlat=None,
urcrnrlon=None, urcrnrlat=None,
llcrnrx=llcrnrx, llcrnry=llcrnry,
urcrnrx=urcrnrx, urcrnry=urcrnry,
width=None, height=None,
projection=projection, resolution=None,
area_thresh=None, rsphere=1.,
lat_ts=None,
lat_1=None, lat_2=None,
lat_0=lat_0, lon_0=lon_0,
suppress_ticks=suppress_ticks,
satellite_height=1.,
boundinglat=None,
fix_aspect=True,
anchor=anchor,
celestial=True,
ax=ax)
# Keep a local ref to lon_0 for hemisphere checking.
self._lon_0 = self.projparams['lon_0']
self._limb = None