glacier = Glacier(length=glacier_length, isostatic=True) densities = dict([ (3410, dict(linestyle='solid', color='black')), (3350, dict(linestyle='dotted', color='red')), (3270, dict(linestyle='dashed', color='blue')), ]) plt.figure(figsize=(15, 8)) for density, line_style in densities.items(): glacier.mantel_density = density surface_height = [glacier.surface_height(value) for value in x] bed_depth = [glacier.bed_depth(value) for value in surface_height] plt.plot(x, surface_height, label='Density ' + str(density), **line_style) plt.plot(x, bed_depth, **line_style) max_height = max(surface_height) max_depth = min(bed_depth) print('\nStats for density ' + str(density) + ':\n') print(' Maximum surface height: ' + str(max_height)) print(' Minimum bed depth: ' + str(max_depth)) print(' Maximum glacier thickness: ' + str(max_height + math.fabs(max_depth)))
import matplotlib.pyplot as plt import numpy as np from glacier import Glacier if __name__ == '__main__': resolution = 100 glacier_length = 100000 x = np.arange(start=0, stop=glacier_length + 1, step=resolution) glacier = Glacier(length=glacier_length) y = [glacier.surface_height(value) for value in x] glacier.isostatic = True y_isostatic = [glacier.surface_height(value) for value in x] y_isostatic_b = [glacier.bed_depth(value) for value in y_isostatic] plt.plot(x, y, linestyle='solid') plt.plot(x, y_isostatic, linestyle='dashed', label='isostatic', color='orange') plt.plot(x, y_isostatic_b, linestyle='dashed', color='orange') plt.legend() plt.xlabel('Length of Glacier') plt.ylabel('Thickness of the Glacier') plt.show()