|
94 | 94 | # ********************************************* |
95 | 95 | # Model deploy |
96 | 96 | # ********************************************* |
| 97 | +#all_glacier_ids = ['AntPen_0', 'AntPen_1', 'AntPen_2', 'AntPen_3', 'AntPen_4', 'AntPen_5', 'AntPen_6', |
| 98 | +# 'AntPen_7', 'AntPen_8', 'AntPen_9', 'AntPen_10', 'AntPen_11', 'AntPen_12', 'AntPen_13', |
| 99 | +# 'AntPen_14', 'AntPen_15', 'AntPen_16', 'AntPen_17', 'AntPen_18', 'AntPen_19', |
| 100 | +# 'AntPen_20', 'AntPen_21', 'AntPen_22'] |
97 | 101 | run_deploy_from_csv_list = True |
98 | 102 | if run_deploy_from_csv_list: |
99 | 103 | for n, glacier_name_for_generation in enumerate(tqdm(all_glacier_ids)): |
100 | 104 |
|
101 | | - glacier_name_for_generation = get_random_glacier_rgiid(name='RGI60-11.01450', rgi=4, version='70G', area=0, seed=None) |
102 | | - #print(n, glacier_name_for_generation) |
| 105 | + #glacier_name_for_generation = get_random_glacier_rgiid(name='RGI60-11.01450', rgi=4, version='70G', area=0, seed=None) |
| 106 | + glacier_name_for_generation = get_random_glacier_rgiid(name='AntPen_19', rgi=4, version='70G', area=0, seed=None) |
| 107 | + print(n, glacier_name_for_generation) |
103 | 108 |
|
104 | 109 | #if f"{glacier_name_for_generation}.png" in os.listdir(f"{config.model_output_results_dir}"): |
105 | 110 | # print(f"{glacier_name_for_generation} already in there.") |
106 | 111 | # continue |
107 | 112 |
|
108 | | - test_glacier_rgi, version = get_version_and_rgi_from_id(glacier_name_for_generation) |
109 | | - rgi_products = get_rgi_products(test_glacier_rgi, version=version) |
| 113 | + #test_glacier_rgi, version = get_version_and_rgi_from_id(glacier_name_for_generation) |
| 114 | + test_glacier_rgi, version = '19', '62' |
| 115 | + gdf_shp = '/media/maffe/nvme/Antarctic_peninsula_geometries/final_product/antarctic_peninsula.shp' |
| 116 | + gdf_intersects_shp = '/media/maffe/nvme/Antarctic_peninsula_geometries/final_product/antarctic_peninsula_intersects.shp' |
| 117 | + rgi_products = get_rgi_products(test_glacier_rgi, version=version, gdf_shp=gdf_shp, gdf_intersects_shp=gdf_intersects_shp) |
110 | 118 | coastline_dataframe = get_coastline_dataframe(config.coastlines_gshhg_dir) |
111 | 119 | link_ids_rgi6_rgi7 = pd.read_csv(config.link_ids_rgi6_rgi7_csv, index_col='rgi_id_7') |
112 | 120 |
|
|
133 | 141 | h_egm2008 = calc_geoid_heights(lons=lons, lats=lats, h_wgs84=h_wgs84) |
134 | 142 |
|
135 | 143 | # Begin to extract all necessary things to plot the result |
136 | | - oggm_rgi_glaciers, oggm_rgi_intersects, rgi_graph, mbdf_rgi = rgi_products |
| 144 | + oggm_rgi_glaciers, rgi_graph, mbdf_rgi = rgi_products |
| 145 | + #oggm_rgi_glaciers, oggm_rgi_intersects, rgi_graph, mbdf_rgi = rgi_products |
137 | 146 | if version == '62': name_column_id = 'RGIId' |
138 | 147 | elif version == '70G': name_column_id = 'rgi_id' |
139 | 148 |
|
|
172 | 181 | # ensemble |
173 | 182 | y_preds_glacier = 0.5 * (y_preds_glacier_xgb + y_preds_glacier_cat) |
174 | 183 |
|
175 | | - #fig, (ax1,ax2,ax3) = plt.subplots(1,3) |
176 | | - #s1 = ax1.scatter(x=data['lons'], y=data['lats'], c=y_preds_glacier, s=1, vmin=y_preds_glacier.min(), vmax=y_preds_glacier.max(),cmap='turbo') |
177 | | - #s2 = ax2.scatter(x=data['lons'], y=data['lats'], c=y_preds_glacier_xgb, s=1, vmin=y_preds_glacier.min(), vmax=y_preds_glacier.max(), cmap='turbo') |
178 | | - #s3 = ax3.scatter(x=data['lons'], y=data['lats'], c=y_preds_glacier_cat, s=1, vmin=y_preds_glacier.min(), vmax=y_preds_glacier.max(), cmap='turbo') |
179 | | - #cb1 = plt.colorbar(s1) |
180 | | - #cb2 = plt.colorbar(s2) |
181 | | - #cb3 = plt.colorbar(s3) |
182 | | - #plt.show() |
183 | | - |
184 | 184 | # Do you want to see the features ? |
185 | 185 | #plot_feature_scatter(config, data) |
186 | 186 |
|
|
201 | 201 | vmin = min(y_preds_glacier) |
202 | 202 | vmax = max(y_preds_glacier) |
203 | 203 |
|
| 204 | + #fig, (ax1,ax2,ax3) = plt.subplots(1,3) |
| 205 | + #s1 = ax1.scatter(x=data['lons'], y=data['lats'], c=y_preds_glacier, s=1, vmin=vmin, vmax=vmax,cmap='turbo') |
| 206 | + #s2 = ax2.scatter(x=data['lons'], y=data['lats'], c=y_preds_glacier_xgb, s=1, vmin=vmin, vmax=vmax, cmap='turbo') |
| 207 | + #s3 = ax3.scatter(x=data['lons'], y=data['lats'], c=y_preds_glacier_cat, s=1, vmin=vmin, vmax=vmax, cmap='turbo') |
| 208 | + #cb1 = plt.colorbar(s1) |
| 209 | + #cb2 = plt.colorbar(s2) |
| 210 | + #cb3 = plt.colorbar(s3) |
| 211 | + #plt.show() |
| 212 | + |
204 | 213 | plot_for_gif = False |
205 | 214 | if plot_for_gif: |
206 | 215 |
|
|
255 | 264 | plt.tight_layout() |
256 | 265 | plt.show() |
257 | 266 |
|
258 | | - plot_fancy_ML_prediction = True |
| 267 | + plot_fancy_ML_prediction = False |
259 | 268 | if plot_fancy_ML_prediction: |
260 | 269 |
|
261 | 270 | resolution = 1. / 3600 |
|
349 | 358 | # transparent=False) |
350 | 359 | plt.show() |
351 | 360 |
|
352 | | - plot_fancy_ML_Mil_Far_prediction = False |
| 361 | + plot_fancy_ML_Mil_Far_prediction = True |
353 | 362 | if plot_fancy_ML_Mil_Far_prediction: |
354 | 363 | fig = plt.figure(figsize=(15, 6)) |
355 | 364 | #fig = plt.figure(figsize=(10, 6)) |
|
439 | 448 | ax3.axis('off') |
440 | 449 |
|
441 | 450 | plt.tight_layout() |
| 451 | + #plt.savefig(f"/home/maffe/Downloads/peninsula/{glacier_name_for_generation}.png", dpi=100) |
| 452 | + #plt.close() |
442 | 453 |
|
443 | 454 | if config.deploy_save_figs: |
444 | 455 | from PIL import Image |
@@ -899,11 +910,10 @@ def process_glacier(split_IDS, process_idx=None, processed_ids=None, lock=None): |
899 | 910 |
|
900 | 911 | print(f"Begin regional simulation for region {rgi}, version {version}") |
901 | 912 |
|
902 | | - rgi_products = get_rgi_products(rgi, version=version) |
| 913 | + oggm_rgi_glaciers, rgi_graph, mbdf_rgi = get_rgi_products(rgi, version=version) |
903 | 914 | coastline_dataframe = get_coastline_dataframe(config.coastlines_gshhg_dir) |
904 | 915 | link_ids_rgi6_rgi7 = pd.read_csv(config.link_ids_rgi6_rgi7_csv, index_col='rgi_id_7') |
905 | 916 |
|
906 | | - oggm_rgi_glaciers, oggm_rgi_intersects, rgi_graph, mbdf_rgi = rgi_products |
907 | 917 | if version == '62': |
908 | 918 | name_column_id = 'RGIId' |
909 | 919 | name_column_area = 'Area' |
|
0 commit comments