def test_qc(self, class_case_dir, monkeypatch): # Init cfg.initialize() cfg.PATHS['working_dir'] = class_case_dir cfg.PARAMS['border'] = 10 monkeypatch.setattr( rgitopo, 'DEMS_URL', 'https://cluster.klima.uni-br' 'emen.de/~oggm/test_gdirs/dem' 's_v1/default/') gd = rgitopo.init_glacier_directories_from_rgitopo( ['RGI60-09.01004'], keep_dem_folders=True) out = rgitopo.dem_quality_check(gd[0]) assert len(out) > 5 assert np.sum(list(out.values())) > 5
def test_from_dem(self, class_case_dir, monkeypatch): # Init cfg.initialize() cfg.PATHS['working_dir'] = class_case_dir cfg.PARAMS['border'] = 10 monkeypatch.setattr( rgitopo, 'DEMS_URL', 'https://cluster.klima.uni-br' 'emen.de/~oggm/test_gdirs/dem' 's_v1/default/') gd = rgitopo.init_glacier_directories_from_rgitopo(['RGI60-09.01004']) gd = gd[0] assert gd.has_file('dem') assert gd.has_file('dem_source') assert gd.has_file('outlines') assert gd.has_file('intersects') # we can work from here tasks.glacier_masks(gd)
df, _ = utils.get_geodetic_files(geodetic_folder_path=geo_folder_path, geodetic_filename=geo_file_name) #Check this file if needed by printing to a csv (troubleshooting) #df.to_csv('/exports/csce/datastore/geos/users/s0933963/oggm_mb_test/df.csv') in_bas = [ basin.geometry.contains(shpg.Point(x, y))[0] for (x, y) in zip(df.CenLon, df.CenLat) ] df = df.loc[in_bas] rids = df['RGI{}0_ID'.format(rgi_version[0])] #rids.to_csv('/exports/csce/datastore/geos/users/s0933963/oggm_mb_test/rids.csv') # We have to check which of them actually have enough mb data. # Let OGGM do it: from oggm.shop import rgitopo gdirs = rgitopo.init_glacier_directories_from_rgitopo(rids) # print(gdirs) # We need to know which period we have data for log.info('Process the climate data...') execute_entity_task(tasks.process_climate_data, gdirs, y1=2018) # Let OGGM decide which of these have enough data gdirs = utils.get_ref_mb_glaciers_geodetic( gdirs, temp_geodetic_folder_path=geo_folder_path, temp_geodetic_filename=geo_file_name) # Save the list of glaciers for later log.info('For RGIV{} and {} we have {} reference glaciers.'.format( rgi_version, baseline, len(gdirs)))