mapping.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:geonum 作者: jgliss 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号