def test(work_path): process_path = work_path + "/process" if not os.path.exists(process_path): os.makedirs(process_path) result_path = work_path + "/result" if not os.path.exists(result_path): os.makedirs(result_path) print("Get Dir and Acc...") dem_tif = work_path + "/preprocess/n35e115_elv.tif" dir_tif = process_path + "/dir.tif" acc_tif = process_path + "/acc.tif" gda.get_dir_acc(process_path, dem_tif, dir_tif, acc_tif) print("Get Stream...") str_tif = process_path + "/stream.tif" str_th = 30000 re.get_river(process_path, acc_tif, str_th) print("Get Watershed...") we.get_watershed(process_path, dem_tif, dir_tif, acc_tif, str_tif) print("Get Watershed GeoJSON/SHP.") watershed_tif = process_path + "/watershed.tif" watershed_geoj = process_path + "/watersheds.geojson" watershed_shp = process_path + "/watersheds.shp" rp.polygonize_to_geojson(watershed_tif, watershed_geoj) rp.polygonize_to_shp(watershed_tif, watershed_shp) print("test")
def test(work_path): process_path = work_path + "/process" if not os.path.exists(process_path): os.makedirs(process_path) result_path = work_path + "/result" if not os.path.exists(result_path): os.makedirs(result_path) dem = work_path + "/data/dem.tif" dir_o = work_path + "/data/dir.tif" dir_reclass = work_path + "/data/dir_reclass.tif" acc = work_path + "/data/acc.tif" print("Update River&Dir...") trace_starts = work_path + "/data/trace_starts.tif" final_record = work_path + "/data/final_record.txt" raf.add_final_to_river(dir_reclass, final_record, trace_starts, acc) print("Get Watershed...") we.get_watershed(process_path, dem, dir_reclass, acc, trace_starts) print("Get Watershed GeoJSON/SHP.") watershed_tif = process_path + "/watershed.tif" watershed_geoj = process_path + "/watersheds.geojson" watershed_shp = process_path + "/watersheds.shp" rp.polygonize_to_geojson(watershed_tif, watershed_geoj) rp.polygonize_to_shp(watershed_tif, watershed_shp) # print("Split Basins.") # ss.split_geojson(result_path, watershed_geoj) print("test")
def test(work_path): process_path = work_path + "/process" if not os.path.exists(process_path): os.makedirs(process_path) result_path = work_path + "/result" if not os.path.exists(result_path): os.makedirs(result_path) dem_tif = work_path + "/data/af_dem.tif" dir_o_tif = work_path + "/data/af_dir.tif" acc_tif = work_path + "/data/af_acc.tif" print("Get Complete Watershed...") dt.get_drainage(work_path, dem_tif, dir_o_tif, acc_tif) print("Get Watershed GeoJSON/SHP.") watershed_tif = process_path + "/watershed.tif" watershed_geoj = process_path + "/watersheds.geojson" watershed_shp = process_path + "/watersheds.shp" rp.polygonize_to_geojson(watershed_tif, watershed_geoj) rp.polygonize_to_shp(watershed_tif, watershed_shp) # print("Split Basins.") # ss.split_geojson(result_path, watershed_geoj) print("test")
def test(work_path, filename): process_path = work_path + "/process" if not os.path.exists(process_path): os.makedirs(process_path) result_path = work_path + "/result" if not os.path.exists(result_path): os.makedirs(result_path) # catalog_path = '/usr/local/large_scale_hydro/catalog' # catalog_path = '/home/liujz/data/Large_Scale_Watershed/catalog' # json_path = work_path + '/' + filename + '.geojson' # dem_tif_path = process_path + '/dem.tif' # dir_tif_path = process_path + '/dir.tif' # acc_tif_path = process_path + '/acc.tif' # lake_tif_path = process_path + '/lake.tif' # ds.data_search(catalog_path, json_path, dem_tif_path, dir_tif_path, acc_tif_path, lake_tif_path) # print("Clip DEM/Dir/Acc") # dem_clip = process_path + "/dem_clip.tif" # dir_clip = process_path + "/dir_clip.tif" # acc_clip = process_path + "/acc_clip.tif" # ct.geojson_clip_tif(json_path, dem_tif_path, dem_clip) # ct.geojson_clip_tif(json_path, dir_tif_path, dir_clip) # ct.geojson_clip_tif(json_path, acc_tif_path, acc_clip) # dem_clip = work_path + "/dem.tif" # dir_clip = work_path + "/dir.tif" # acc_clip = work_path + "/acc.tif" dem = work_path + "/dem.tif" dir = work_path + "/dir_reclass.tif" acc = work_path + "/acc.tif" bound = work_path + "/boundary.tif" print("Get Watershed...") # dt.get_drainage(process_path, dem_clip, dir_clip, acc_clip) we.get_watershed(process_path, dem, dir, acc, bound) print("Get Watershed GeoJSON/SHP.") watershed_tif = process_path + "/watershed.tif" watershed_geoj = process_path + "/watersheds.geojson" watershed_shp = process_path + "/watersheds.shp" rp.polygonize_to_geojson(watershed_tif, watershed_geoj) rp.polygonize_to_shp(watershed_tif, watershed_shp) # print("Split Basins.") # ss.split_geojson(result_path, watershed_geoj) print("test")