コード例 #1
0
def _run_parallel_experiment(gdir):

    # read flowlines from pre-processing
    fls = gdir.read_pickle('model_flowlines')
    try:
        # construct searched glacier
        # TODO: y0 in random mass balance?
        random_climate1 = RandomMassBalance(gdir, y0=1850, bias=0, seed=[1])
        random_climate1.temp_bias = -0.75
        commit_model = FluxBasedModel(fls, mb_model=random_climate1,
                                      glen_a=cfg.A, y0=1850)
        commit_model.run_until_equilibrium()
        y_t0 = deepcopy(commit_model)

    # try different seed of mass balance, if equilibrium could not be found
    except:

        # construct searched glacier
        random_climate1 = RandomMassBalance(gdir, y0=1850, bias=0,seed=[1])
        commit_model = FluxBasedModel(fls, mb_model=random_climate1,
                                      glen_a=cfg.A, y0=1850)
        commit_model.run_until_equilibrium()
        y_t0 = deepcopy(commit_model)

    # construct observed glacier
    past_climate = PastMassBalance(gdir)
    commit_model2 = FluxBasedModel(commit_model.fls, mb_model=past_climate,
                                   glen_a=cfg.A, y0=1850)
    commit_model2.run_until(2000)
    y_t = deepcopy(commit_model2)

    # save output in gdir_dir
    experiment = {'y_t0': y_t0, 'y_t': y_t,
                  'climate': random_climate1}
    gdir.write_pickle(experiment, 'synthetic_experiment')
コード例 #2
0
def _run_parallel_experiment(gdir, t0, te):
    '''

    :param gdir:
    :param t0:
    :param te:
    :return:
    '''

    # read flowlines from pre-processing
    fls = gdir.read_pickle('model_flowlines')
    try:
        # construct searched glacier
        random_climate1 = RandomMassBalance(gdir, y0=t0, halfsize=14)

        #set temp bias negative to force a glacier retreat later
        random_climate1.temp_bias = -0.75
        commit_model = FluxBasedModel(fls,
                                      mb_model=random_climate1,
                                      glen_a=cfg.A,
                                      y0=t0)
        commit_model.run_until_equilibrium()
        y_t0 = deepcopy(commit_model)

    # try different seed of mass balance, if equilibrium could not be found
    except:

        # construct searched glacier
        random_climate1 = RandomMassBalance(gdir, y0=t0, halfsize=14)
        commit_model = FluxBasedModel(fls,
                                      mb_model=random_climate1,
                                      glen_a=cfg.A,
                                      y0=t0)
        commit_model.run_until_equilibrium()
        y_t0 = deepcopy(commit_model)

    # construct observed glacier
    past_climate = PastMassBalance(gdir)
    commit_model2 = FluxBasedModel(commit_model.fls,
                                   mb_model=past_climate,
                                   glen_a=cfg.A,
                                   y0=t0)
    commit_model2.run_until(te)
    y_t = deepcopy(commit_model2)

    # save output in gdir_dir
    experiment = {'y_t0': y_t0, 'y_t': y_t, 'climate': random_climate1}
    gdir.write_pickle(experiment, 'synthetic_experiment')
コード例 #3
0
                        y0=0., glen_a=glen_a,
                        ice_thick_filter=ice_thick_filter)
    dmodel.run_until_and_store(800, run_path=outf, grid=grid,
                               print_stdout=print_stdout)

# Multiprocessing
tasks = []

mbmod = RandomMassBalance(gdir, seed=0)
outf = db_dir + 'out_def_100m.nc'
tasks.append((run_task, {'grid': grid, 'mb_model': mbmod, 'outf': outf,
                         'ice_thick_filter':filter_ice_border,
                         'print_stdout':'Task1'}))

mbmod = RandomMassBalance(gdir, seed=0)
mbmod.temp_bias = 0.5
outf = db_dir + 'out_tbias_100m.nc'
tasks.append((run_task, {'grid': grid, 'mb_model': mbmod, 'outf': outf,
                         'ice_thick_filter':filter_ice_border,
                         'print_stdout': 'Task2'}))

mbmod = RandomMassBalance(gdir, seed=0)
outf = db_dir + 'out_filter_100m.nc'
tasks.append((run_task, {'grid': grid, 'mb_model': mbmod, 'outf': outf,
                         'ice_thick_filter':filter_ice_tributaries,
                         'print_stdout': 'Task3'}))

mbmod = RandomMassBalance(gdir, seed=0)
mbmod.temp_bias = 0.5
outf = db_dir + 'out_filter_bias_100m.nc'
tasks.append((run_task, {'grid': grid, 'mb_model': mbmod, 'outf': outf,