Exemplo n.º 1
0
def inversion_tasks(gdirs):
    """Invert the bed topography."""

    # Init
    execute_entity_task(tasks.prepare_for_inversion, gdirs)

    # Global task
    tasks.optimize_inversion_params(gdirs)

    # Inversion for all glaciers
    execute_entity_task(tasks.volume_inversion, gdirs)
Exemplo n.º 2
0
]
if RUN_GIS_PREPRO:
    for task in task_list:
        execute_entity_task(task, gdirs)

if RUN_CLIMATE_PREPRO:
    # Climate related tasks
    # see if we can distribute
    workflow.execute_entity_task(tasks.process_cru_data, gdirs)
    tasks.compute_ref_t_stars(gdirs)
    tasks.distribute_t_stars(gdirs)

if RUN_INVERSION:
    # Inversion
    execute_entity_task(tasks.prepare_for_inversion, gdirs)
    tasks.optimize_inversion_params(gdirs)
    execute_entity_task(tasks.volume_inversion, gdirs)

if RUN_DYNAMICS:
    # Random dynamics
    execute_entity_task(tasks.init_present_time_glacier, gdirs)
    execute_entity_task(tasks.random_glacier_evolution, gdirs)

# Plots (if you want)
PLOTS_DIR = ''
if PLOTS_DIR == '':
    exit()
utils.mkdir(PLOTS_DIR)
for gd in gdirs:
    bname = os.path.join(PLOTS_DIR, gd.name + '_' + gd.rgi_id + '_')
    graphics.plot_googlemap(gd)
Exemplo n.º 3
0
    tasks.glacier_masks, tasks.compute_centerlines,
    tasks.compute_downstream_lines, tasks.catchment_area,
    tasks.initialize_flowlines, tasks.catchment_width_geom,
    tasks.catchment_width_correction
]
for task in task_list:
    execute_entity_task(task, gdirs)

# Climate related tasks - this will download
execute_entity_task(tasks.process_cru_data, gdirs)
tasks.compute_ref_t_stars(gdirs)
tasks.distribute_t_stars(gdirs)

# Inversion
execute_entity_task(tasks.prepare_for_inversion, gdirs)
tasks.optimize_inversion_params(gdirs)
execute_entity_task(tasks.volume_inversion, gdirs)

# Write out glacier statistics
df = utils.glacier_characteristics(gdirs)
fpath = os.path.join(cfg.PATHS['working_dir'], 'glacier_char.csv')
df.to_csv(fpath)

# Plots (if you want)
PLOTS_DIR = ''
if PLOTS_DIR == '':
    exit()
utils.mkdir(PLOTS_DIR)
for gd in gdirs:
    bname = os.path.join(PLOTS_DIR, gd.name + '_' + gd.rgi_id + '_')
    graphics.plot_googlemap(gd)
Exemplo n.º 4
0
         tasks.compute_downstream_bedshape
         ]

for task in list_talks:
    workflow.execute_entity_task(task, gdirs)

workflow.climate_tasks(gdirs)
workflow.execute_entity_task(tasks.prepare_for_inversion, gdirs)
from oggm.core.inversion import mass_conservation_inversion

# Select HEF out of all glaciers

glen_a = cfg.A
vol_m3, area_m3 = mass_conservation_inversion(gdir_hef, glen_a=glen_a)
print('With A={}, the mean thickness of HEF is {:.1f} m'.format(glen_a, vol_m3/area_m3))
optim_resuls = tasks.optimize_inversion_params(gdirs)

workflow.execute_entity_task(tasks.volume_inversion, gdirs)
workflow.execute_entity_task(tasks.filter_inversion_output, gdirs)
tasks.init_present_time_glacier(gdir_hef)
fls = gdir_hef.read_pickle('model_flowlines')

model = FluxBasedModel(fls)
surface_before=model.fls[-1].surface_h

today_model = ConstantMassBalance(gdir_hef, y0=1985)

commit_model = FluxBasedModel(fls, mb_model=today_model, glen_a=cfg.A)
pickle.dump(gdir_hef,open('gdir_hef.pkl','wb'))
pickle.dump(commit_model.fls,open('hef_y0.pkl','wb'))
plt.figure(0)