flowgo_terrain_condition.py 文件源码

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

项目:pyflowgo 作者: pyflowgo 项目源码 文件源码
def read_slope_from_file(self, filename=None):
        if filename == None:
            filename = '../MaunaUlu74/DEM_maunaulu74.txt'

        distance = []
        slope = []
        # here read the slope file (.txt) where each line represent the distance from the vent (first column) and
        # the corresponding slope in degree (second column) that is then converted in gradiant
        f_slope = open(filename, "r")
        f_slope.readline()
        for line in f_slope:
            split_line = line.strip('\n').split('\t')
            distance.append(float(split_line[0]))
            slope.append(math.radians(float(split_line[1])))
        f_slope.close()

        #slope = self.running_mean(slope, 15)

        # build the spline to interpolate the distance (k=1 : it is a linear interpolation)
        self._slope_spline = interpolate.InterpolatedUnivariateSpline(distance, slope, k=1.)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号