def setup_cache(self): utils.mkdir(self.testdir, reset=True) self.cfg_init() hef_file = get_demo_file('Hintereisferner_RGI5.shp') entity = gpd.read_file(hef_file).iloc[0] gdir = oggm.GlacierDirectory(entity, base_dir=self.testdir) tasks.define_glacier_region(gdir, entity=entity) tasks.glacier_masks(gdir) tasks.compute_centerlines(gdir) tasks.initialize_flowlines(gdir) tasks.compute_downstream_line(gdir) tasks.compute_downstream_bedshape(gdir) tasks.catchment_area(gdir) tasks.catchment_intersections(gdir) tasks.catchment_width_geom(gdir) tasks.catchment_width_correction(gdir) tasks.process_custom_climate_data(gdir) tasks.glacier_mu_candidates(gdir) mbdf = gdir.get_ref_mb_data()['ANNUAL_BALANCE'] res = climate.t_star_from_refmb(gdir, mbdf=mbdf) tasks.local_t_star(gdir, tstar=res['t_star'], bias=res['bias']) tasks.mu_star_calibration(gdir) tasks.prepare_for_inversion(gdir) tasks.mass_conservation_inversion(gdir) return gdir
cfg.PATHS['working_dir'] = base_dir entity = gpd.read_file(get_demo_file('HEF_MajDivide.shp')).iloc[0] gdir = oggm.GlacierDirectory(entity, base_dir=base_dir, reset=True) tasks.define_glacier_region(gdir) tasks.glacier_masks(gdir) tasks.compute_centerlines(gdir) tasks.initialize_flowlines(gdir) tasks.compute_downstream_line(gdir) tasks.catchment_area(gdir) tasks.catchment_width_geom(gdir) tasks.catchment_width_correction(gdir) cfg.PARAMS['baseline_climate'] = 'HISTALP' cfg.PARAMS['baseline_y0'] = 1850 tasks.process_histalp_data(gdir) mu_yr_clim = tasks.glacier_mu_candidates(gdir) mbdf = gdir.get_ref_mb_data() res = t_star_from_refmb(gdir, mbdf=mbdf.ANNUAL_BALANCE) local_t_star(gdir, tstar=res['t_star'], bias=res['bias'], reset=True) mu_star_calibration(gdir, reset=True) # For flux plot tasks.prepare_for_inversion(gdir, add_debug_var=True) # For plots years, temp_yr, prcp_yr = mb_yearly_climate_on_glacier(gdir) # which years to look at selind = np.searchsorted(years, mbdf.index) temp_yr = np.mean(temp_yr[selind])
gdir = oggm.GlacierDirectory(entity, base_dir=base_dir) tasks.define_glacier_region(gdir, entity=entity) tasks.glacier_masks(gdir) tasks.compute_centerlines(gdir) tasks.initialize_flowlines(gdir) tasks.compute_downstream_line(gdir) tasks.catchment_area(gdir) tasks.catchment_width_geom(gdir) tasks.catchment_width_correction(gdir) data_dir = get_demo_file('HISTALP_precipitation_all_abs_1801-2014.nc') cfg.PATHS['cru_dir'] = os.path.dirname(data_dir) cfg.PARAMS['baseline_climate'] = 'HISTALP' cfg.PARAMS['baseline_y0'] = 1850 tasks.process_histalp_data(gdir) tasks.glacier_mu_candidates(gdir) mbdf = gdir.get_ref_mb_data() res = t_star_from_refmb(gdir, mbdf=mbdf.ANNUAL_BALANCE) local_t_star(gdir, tstar=res['t_star'], bias=res['bias'], reset=True) mu_star_calibration(gdir, reset=True) # For flux plot tasks.prepare_for_inversion(gdir, add_debug_var=True) # For plots mu_yr_clim = gdir.read_pickle('climate_info')['mu_candidates_glacierwide'] years, temp_yr, prcp_yr = mb_yearly_climate_on_glacier(gdir) # which years to look at selind = np.searchsorted(years, mbdf.index)
gdir = oggm.GlacierDirectory(entity, base_dir=base_dir) tasks.define_glacier_region(gdir, entity=entity) tasks.glacier_masks(gdir) tasks.compute_centerlines(gdir) tasks.initialize_flowlines(gdir) tasks.compute_downstream_line(gdir) tasks.catchment_area(gdir) tasks.catchment_width_geom(gdir) tasks.catchment_width_correction(gdir) data_dir = get_demo_file('HISTALP_precipitation_all_abs_1801-2014.nc') cfg.PATHS['cru_dir'] = os.path.dirname(data_dir) cfg.PARAMS['baseline_climate'] = 'HISTALP' cfg.PARAMS['baseline_y0'] = 1850 tasks.process_histalp_data(gdir) tasks.glacier_mu_candidates(gdir) mbdf = gdir.get_ref_mb_data() res = t_star_from_refmb(gdir, mbdf=mbdf.ANNUAL_BALANCE) local_t_star(gdir, tstar=res['t_star'], bias=res['bias'], reset=True) mu_star_calibration(gdir, reset=True) # For flux plot tasks.prepare_for_inversion(gdir, add_debug_var=True) # For plots mu_yr_clim = gdir.read_pickle('climate_info')['mu_candidates_glacierwide'] years, temp_yr, prcp_yr = mb_yearly_climate_on_glacier(gdir) # which years to look at selind = np.searchsorted(years, mbdf.index)