import matplotlib.pyplot as plt
import numpy as np
import math

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, 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)
Beispiel #2
0
import matplotlib.pyplot as plt
import numpy as np

from glacier import Glacier

if __name__ == '__main__':
    ela_elevations = np.arange(4000, 5100, 100)
    ela_changes = np.arange(100, 510, 100)
    slopes = np.arange(0.05, 0.30, 0.05)

    glacier = Glacier(max_bed_height=5500)

    fig, ((ax1, ax2), (ax3, ax4), (ax5, ax6)) = plt.subplots(nrows=3,
                                                             ncols=2,
                                                             figsize=(14, 10))

    # Length change with varying ELA
    for slope in slopes:
        glacier.slope = slope
        length_change = [
            glacier.linear_equilibrium_length(elevation)
            for elevation in ela_elevations
        ]
        ax1.plot(ela_elevations, length_change, label=slope.round(2))
    ax1.set_title('Length change with varying ELA')
    ax1.legend(title='Slope')

    # Change of length over change of ELA
    for slope in slopes:
        lengths = [
            glacier.length_change(ela_change, slope)
Beispiel #3
0
parser = argparse.ArgumentParser()
parser.add_argument(
    '--blockpull',
    help=
    'Perform a blockpull prior to uploading, so that the resulting disk image is independent of prior snapshots.',
    action='store_true')
parser.add_argument('--connection',
                    help='Specify qemu:///system or qemu:///session',
                    action='store')
args = parser.parse_args()

from glacier import Glacier

if __name__ == '__main__':
    glacier = Glacier(access_key_id=ACCESS_KEY_ID,
                      secret_access_key=SECRET_ACCESS_KEY,
                      region_name=REGION_NAME)

    try:
        logging.debug("Connecting to libvirt")
        virsh = libvirt.open(args.connection)

        vault = glacier.create_vault()
        for domain in virsh.listAllDomains(
                flags=libvirt.VIR_CONNECT_LIST_DOMAINS_ACTIVE):
            logging.debug("Parsing XML for: %s" % domain.name())
            domXML = domain.XMLDesc()
            logging.debug(domXML)

            tree = ElementTree.fromstring(domXML)
            disks = tree.findall('./devices/disk[@type="file"]/source/[@file]')
Beispiel #4
0
# t_0: 0 to 90, change ELA every 10 years
# ELA = 2900, 3100, 2800, 2700, 3000, 2800, 3400, 3300, 3200, 3500
# Get to steady state length for ELA at 3500
# - How long is the glacier (length)
# - How long does it take to get there (time)

import math
import numpy as np
import matplotlib.pyplot as plt

from glacier import Glacier

if __name__ == '__main__':
    initial_length = 22000
    glacier = Glacier(max_bed_height=3900, length=initial_length, slope=0.1)
    elas = [2900, 3100, 2800, 2700, 3000, 2800, 3400, 3300, 3200, 3500]
    time = np.arange(0, 501, step=1)
    lengths = []
    ela_index = 0
    time_delta = 1

    e_folding = 1 / math.e
    e_year = None
    e_length = None

    for year in time:
        lengths.append(glacier.length_over_time(time_delta, elas[ela_index]))
        glacier.length = lengths[-1]

        if 1 < year < 99 and (year % 10 == 9):
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()
Beispiel #6
0
    'West': {
        'bed_height': 1127,
        'mean_ice_thickness': 2101,
        'max_surface': 3041,
        'min_surface': 0,
        'length_of_segment': 380000,
    },
}


def calc_slope(min_surface, max_surface, length):
    return (max_surface - min_surface) / length


if __name__ == '__main__':
    glacier = Glacier()

    measured_length = []
    linear_equilibrium_length = []

    max_surfaces = []
    ela = []
    critical_ela = []

    measured_thickness = []
    mean_thickness = []
    static_thickness = []

    for basin, data in BASINS.items():
        glacier.max_bed_height = data['bed_height']
        glacier.length = data['length_of_segment']