コード例 #1
0
def time_1d_flux_simple_bed_adaptive_dt():

    fls = dummy_constant_bed()
    mb = massbalance.LinearMassBalance(2600.)

    model = flowline.FluxBasedModel(fls, mb_model=mb, y0=0.)
    model.run_until(800)
コード例 #2
0
def test_coxe():

    testdir = os.path.join(get_test_dir(), 'tmp_coxe')
    utils.mkdir(testdir, reset=True)

    # Init
    cfg.initialize()
    cfg.PARAMS['use_intersects'] = False
    cfg.PATHS['dem_file'] = get_demo_file('dem_RGI50-01.10299.tif')
    cfg.PARAMS['border'] = 40
    cfg.PARAMS['clip_tidewater_border'] = False
    cfg.PARAMS['use_multiple_flowlines'] = False
    cfg.PARAMS['use_kcalving_for_inversion'] = True
    cfg.PARAMS['use_kcalving_for_run'] = True
    cfg.PARAMS['trapezoid_lambdas'] = 1

    hef_file = get_demo_file('rgi_RGI50-01.10299.shp')
    entity = gpd.read_file(hef_file).iloc[0]

    gdir = oggm.GlacierDirectory(entity, base_dir=testdir, reset=True)
    gis.define_glacier_region(gdir)
    gis.glacier_masks(gdir)
    centerlines.compute_centerlines(gdir)
    centerlines.initialize_flowlines(gdir)
    centerlines.compute_downstream_line(gdir)
    centerlines.compute_downstream_bedshape(gdir)
    centerlines.catchment_area(gdir)
    centerlines.catchment_intersections(gdir)
    centerlines.catchment_width_geom(gdir)
    centerlines.catchment_width_correction(gdir)
    climate.apparent_mb_from_linear_mb(gdir)
    inversion.prepare_for_inversion(gdir)
    inversion.mass_conservation_inversion(gdir)
    inversion.filter_inversion_output(gdir)

    flowline.init_present_time_glacier(gdir)

    fls = gdir.read_pickle('model_flowlines')

    p = gdir.read_pickle('linear_mb_params')
    mb_mod = massbalance.LinearMassBalance(ela_h=p['ela_h'], grad=p['grad'])
    mb_mod.temp_bias = -0.3
    model = flowline.FluxBasedModel(fls,
                                    mb_model=mb_mod,
                                    y0=0,
                                    inplace=True,
                                    is_tidewater=True)

    # run
    model.run_until(200)
    assert model.calving_m3_since_y0 > 0

    fig, ax = plt.subplots()
    graphics.plot_modeloutput_map(gdir, ax=ax, model=model)
    fig.tight_layout()
    shutil.rmtree(testdir)
    return fig
コード例 #3
0
def time_1d_flux_simple_bed_fixed_dt():

    fls = dummy_constant_bed()
    mb = massbalance.LinearMassBalance(2600.)

    model = flowline.FluxBasedModel(fls,
                                    mb_model=mb,
                                    y0=0.,
                                    fixed_dt=10 * cfg.SEC_IN_DAY)
    model.run_until(800)
コード例 #4
0
def time_2d_sia_large():

    bed_2d = gkern(kernlen=51) * 5e5
    mb = massbalance.LinearMassBalance(450., grad=3)
    sdmodel = Upstream2D(bed_2d, dx=200, mb_model=mb, y0=0.)
    sdmodel.run_until(2000)
コード例 #5
0
def time_2d_sia_small():

    bed_2d = gkern() * 1e5
    mb = massbalance.LinearMassBalance(450., grad=3)
    sdmodel = Upstream2D(bed_2d, dx=200, mb_model=mb, y0=0.)
    sdmodel.run_until(2000)