def _prep_topo_data(self, grid_points=100):
"""Prepare topography data for map
This function prepares high resolution topography for plotting, i.e.
it reduces the resolution based on the map size
:param int grid_points: number of plotted grid points (default: 100)
"""
if not isinstance(self.topo_data, TopoData):
try:
self.load_topo_data()
except:
raise
topo = self.topo_data
# determine the nu
pyr_steps = int(ceil(log2(float(len(topo.lons)) / grid_points)))
z_max = float(topo.max)
z_min = float(topo.min)
z_order = floor(log10(topo.alt_range))
X,Y = meshgrid(topo.lons, topo.lats)
x, y = self(X, Y)
z = topo.data
if not CV2_AVAILABLE:
print ("Could not reduce resolution of topographic data, opencv "
"library is not available")
else:
if pyr_steps > 0:
for k in range(pyr_steps):
x = pyrDown(x)
y = pyrDown(y)
z = pyrDown(z)
return (x, y, z, z_min, z_max, z_order)
评论列表
文章目录