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.)
评论列表
文章目录