Exemplo n.º 1
0
def test_plot_region_model():

    gdirs = random_for_plot()

    dfc = utils.compile_task_log(gdirs, task_names=['run_random_climate_plot'])
    assert np.all(dfc['run_random_climate_plot'] == 'SUCCESS')

    # We prepare for the plot, which needs our own map to proceed.
    # Lets do a local mercator grid
    g = salem.mercator_grid(center_ll=(10.86, 46.85), extent=(27000, 21000))
    # And a map accordingly
    sm = salem.Map(g, countries=False)
    sm.set_topography(get_demo_file('srtm_oetztal.tif'))

    # Give this to the plot function
    fig, ax = plt.subplots()
    graphics.plot_modeloutput_map(gdirs,
                                  smap=sm,
                                  ax=ax,
                                  filesuffix='_plot',
                                  vmax=250,
                                  modelyr=10,
                                  linewidth=1.5)

    fig.tight_layout()
    return fig
Exemplo n.º 2
0
def test_plot_region_model():

    gdirs = random_for_plot()

    dfc = utils.compile_task_log(gdirs,
                                 task_names=['run_random_climate_plot'])
    assert np.all(dfc['run_random_climate_plot'] == 'SUCCESS')

    # We prepare for the plot, which needs our own map to proceed.
    # Lets do a local mercator grid
    g = salem.mercator_grid(center_ll=(10.86, 46.85),
                            extent=(27000, 21000))
    # And a map accordingly
    sm = salem.Map(g, countries=False)
    sm.set_topography(get_demo_file('srtm_oetztal.tif'))

    # Give this to the plot function
    fig, ax = plt.subplots()
    graphics.plot_modeloutput_map(gdirs, smap=sm, ax=ax,
                                  filesuffix='_plot', vmax=250,
                                  modelyr=10, linewidth=1.5)

    fig.tight_layout()
    return fig
Exemplo n.º 3
0
                             output_filesuffix=fsuf)
log.info('Compiling output ' + fsuf + ' ...')
utils.compile_run_output(gdirs, filesuffix=fsuf)
task_names.append('run_random_climate' + fsuf)


# Inversion to rectangle
workflow.execute_entity_task(tasks.prepare_for_inversion, gdirs,
                             invert_all_rectangular=True)
workflow.execute_entity_task(tasks.mass_conservation_inversion, gdirs)
workflow.execute_entity_task(tasks.filter_inversion_output, gdirs)
workflow.execute_entity_task(tasks.init_present_time_glacier, gdirs)

fsuf = '_rect_rdn_tstar_noseed'
log.info('Start experiment ' + fsuf)
workflow.execute_entity_task(tasks.run_random_climate, gdirs,
                             nyears=nyears, bias=0,
                             output_filesuffix=fsuf)
log.info('Compiling output ' + fsuf + ' ...')
utils.compile_run_output(gdirs, filesuffix=fsuf)
task_names.append('run_random_climate' + fsuf)


# End
utils.compile_task_log(gdirs, filesuffix='_noseed', task_names=task_names)

# Log
m, s = divmod(time.time() - start, 60)
h, m = divmod(m, 60)
log.info("OGGM is done! Time needed: %02d:%02d:%02d" % (h, m, s))
Exemplo n.º 4
0
                             gdirs,
                             seed=2,
                             nyears=nyears,
                             y0=2000,
                             temperature_bias=0.5,
                             output_filesuffix=fsuf)
log.info('Compiling output ' + fsuf + ' ...')
utils.compile_run_output(gdirs, filesuffix=fsuf)
task_names.append('run_random_climate' + fsuf)

fsuf = '_rdn_2000_tbias_m05'
log.info('Start experiment ' + fsuf)
workflow.execute_entity_task(tasks.run_random_climate,
                             gdirs,
                             seed=3,
                             nyears=nyears,
                             y0=2000,
                             temperature_bias=-0.5,
                             output_filesuffix=fsuf)
log.info('Compiling output ' + fsuf + ' ...')
utils.compile_run_output(gdirs, filesuffix=fsuf)
task_names.append('run_random_climate' + fsuf)

# End
utils.compile_task_log(gdirs, filesuffix='_2000bf', task_names=task_names)

# Log
m, s = divmod(time.time() - start, 60)
h, m = divmod(m, 60)
log.info("OGGM is done! Time needed: %02d:%02d:%02d" % (h, m, s))
Exemplo n.º 5
0
utils.compile_run_output(gdirs, filesuffix=fsuf)
task_names.append('run_random_climate' + fsuf)

# Inversion to rectangle
workflow.execute_entity_task(tasks.prepare_for_inversion,
                             gdirs,
                             invert_all_rectangular=True)
workflow.execute_entity_task(tasks.mass_conservation_inversion, gdirs)
workflow.execute_entity_task(tasks.filter_inversion_output, gdirs)
workflow.execute_entity_task(tasks.init_present_time_glacier, gdirs)

fsuf = '_rect_rdn_tstar'
log.info('Start experiment ' + fsuf)
workflow.execute_entity_task(tasks.run_random_climate,
                             gdirs,
                             seed=0,
                             nyears=nyears,
                             bias=0,
                             output_filesuffix=fsuf)
log.info('Compiling output ' + fsuf + ' ...')
utils.compile_run_output(gdirs, filesuffix=fsuf)
task_names.append('run_random_climate' + fsuf)

# End
utils.compile_task_log(gdirs, task_names=task_names)

# Log
m, s = divmod(time.time() - start, 60)
h, m = divmod(m, 60)
log.info("OGGM is done! Time needed: %02d:%02d:%02d" % (h, m, s))