Skip to content

Commit 0ff5dac

Browse files
committed
Merge remote-tracking branch 'origin/main-dev' into stochastic-inundation-emulator that had final changes for paper
2 parents 7af97ef + f337dce commit 0ff5dac

56 files changed

Lines changed: 136 additions & 95 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.neptune
22
**/sacred_logs/
33
**/sbatch_logs/
4+
**/configs/
45

56
*.tar
67
*tar.gz

scripts/JGR/06_compare_depths_optimized.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ def cleanup_variables(*vars_to_delete):
6464
# plotting the below events
6565
ids = [
6666
'BS_manning003/E01267N3753E01646N3535-BS-M809_E01502N3737_D010_S112D70R270_A006995_S075',
67-
'BS_manning003/E01267N3753E01646N3535-BS-M809_E01502N3737_D144_S022D70R270_A006995_S075',
68-
'BS_manning003/E01267N3753E01646N3535-BS-M809_E01547N3670_D010_S337D70R270_A006995_S075',
69-
'BS_manning003/E01267N3753E01646N3535-BS-M809_E01495N3692_D010_S022D50R270_A006995_S075',
70-
'BS_4-8_manning003/E01267N3753E01646N3535-BS-M809_E01502N3737_D010_S067D90R090_A006995_S075',
71-
'BS_manning003/E01267N3753E01646N3535-BS-M809_E01523N3692_D010_S292D50R270_A006995_S075',
72-
'BS_4-8_manning003/E01267N3753E01646N3535-BS-M809_E01551N3692_D010_S112D90R090_A006995_S075',
73-
'PS_manning003/E02020N3739E02658N3366-PS-Str_PYes_Var-M895_E02351N3465_S003',
74-
'PS_manning003/E02020N3739E02658N3366-PS-Str_PYes_Var-M902_E02417N3454_S001',
67+
# 'BS_manning003/E01267N3753E01646N3535-BS-M809_E01502N3737_D144_S022D70R270_A006995_S075',
68+
# 'BS_manning003/E01267N3753E01646N3535-BS-M809_E01547N3670_D010_S337D70R270_A006995_S075',
69+
# 'BS_manning003/E01267N3753E01646N3535-BS-M809_E01495N3692_D010_S022D50R270_A006995_S075',
70+
# 'BS_4-8_manning003/E01267N3753E01646N3535-BS-M809_E01502N3737_D010_S067D90R090_A006995_S075',
71+
# 'BS_manning003/E01267N3753E01646N3535-BS-M809_E01523N3692_D010_S292D50R270_A006995_S075',
72+
# 'BS_4-8_manning003/E01267N3753E01646N3535-BS-M809_E01551N3692_D010_S112D90R090_A006995_S075',
73+
# 'PS_manning003/E02020N3739E02658N3366-PS-Str_PYes_Var-M895_E02351N3465_S003',
74+
# 'PS_manning003/E02020N3739E02658N3366-PS-Str_PYes_Var-M902_E02417N3454_S001',
7575
]
7676

7777
#dimensions and gauge numbers
@@ -151,7 +151,8 @@ def cleanup_variables(*vars_to_delete):
151151
print(f"Starting to process {total_events} events from index {start}")
152152
print_memory_usage(0)
153153

154-
for id in events_to_process:
154+
# for id in events_to_process:
155+
for id in ids:
155156
eve = np.where(eve_id==id)[0][0]
156157
processed_events += 1
157158

@@ -219,7 +220,7 @@ def cleanup_variables(*vars_to_delete):
219220
# Local Deformation
220221
DZ = axs[0].scatter(x_list,y_list, c=dz_smooth, s=0.0005, cmap=cmap_dz,
221222
vmin=-5, vmax=5,alpha=1)
222-
axs[0].text(xpos,ypos, f'max: {np.nanmax(dz_smooth):.3f},\\nmin: {np.nanmin(dz_smooth):.3f}',
223+
axs[0].text(xpos,ypos, f'max: {np.nanmax(dz_smooth):.3f},\nmin: {np.nanmin(dz_smooth):.3f}',
223224
horizontalalignment='center', verticalalignment='center',transform=axs[0].transAxes, fontsize=12)
224225
axs[0].set_title('Local Deformation')
225226

@@ -233,14 +234,14 @@ def cleanup_variables(*vars_to_delete):
233234
# Pred_mean
234235
PR_pretrain = axs[2].scatter(idx[:, 1], idx[:, 0], c=pred_mean, s=0.0005, cmap=cmap_depth,
235236
vmin=0, vmax=10,alpha=1)
236-
axs[2].text(xpos,ypos, f'max: {np.nanmax(pred_mean):.3f}\\nr^2: {eve_perf_mean["r2"].iloc[eve]:.3f}\\ng: {eve_perf_mean["g"].iloc[eve]:.3f}',
237+
axs[2].text(xpos,ypos, f'max: {np.nanmax(pred_mean):.3f}\nr^2: {eve_perf_mean["r2"].iloc[eve]:.3f}\ng: {eve_perf_mean["g"].iloc[eve]:.3f}',
237238
horizontalalignment='center', verticalalignment='center',transform=axs[2].transAxes, fontsize=12)
238239
axs[2].set_title('Mean')
239240

240241
# Error
241242
ER_pretrain = axs[3].scatter(idx[:, 1], idx[:, 0], c=error_mean, s=0.0005, cmap=cmap_error,
242243
vmin=-5,vmax=5,alpha=1)
243-
axs[3].text(xpos,ypos, f'max: {np.nanmax(error_mean):.3f},\\nmin: {np.nanmin(error_mean):.3f}',
244+
axs[3].text(xpos,ypos, f'max: {np.nanmax(error_mean):.3f},\nmin: {np.nanmin(error_mean):.3f}',
244245
horizontalalignment='center', verticalalignment='center',transform=axs[3].transAxes, fontsize=12)
245246
axs[3].set_title('Error Mean')
246247

@@ -254,7 +255,7 @@ def cleanup_variables(*vars_to_delete):
254255
# Error
255256
ER_direct = axs[5].scatter(idx[:, 1], idx[:, 0], c=error_sigmaminus, s=0.0005, cmap=cmap_error,
256257
vmin=-5,vmax=5,alpha=1)
257-
axs[5].text(xpos,ypos, f'max: {np.nanmax(error_sigmaminus):.3f},\\nmin: {np.nanmin(error_sigmaminus):.3f}',
258+
axs[5].text(xpos,ypos, f'max: {np.nanmax(error_sigmaminus):.3f},\nmin: {np.nanmin(error_sigmaminus):.3f}',
258259
horizontalalignment='center', verticalalignment='center',transform=axs[5].transAxes, fontsize=12)
259260
axs[5].set_title('Error Mean-2Sigma')
260261

@@ -268,7 +269,7 @@ def cleanup_variables(*vars_to_delete):
268269
#Error
269270
ER_pretrain = axs[7].scatter(idx[:, 1], idx[:, 0], c=error_sigmaplus, s=0.0005, cmap=cmap_error,
270271
vmin=-5,vmax=5,alpha=1)
271-
axs[7].text(xpos,ypos, f'max: {np.nanmax(error_sigmaplus):.3f},\\nmin: {np.nanmin(error_sigmaplus):.3f}',
272+
axs[7].text(xpos,ypos, f'max: {np.nanmax(error_sigmaplus):.3f},\nmin: {np.nanmin(error_sigmaplus):.3f}',
272273
horizontalalignment='center', verticalalignment='center',transform=axs[7].transAxes, fontsize=12)
273274
axs[7].set_title('Error Mean+2Sigma')
274275

@@ -299,7 +300,7 @@ def cleanup_variables(*vars_to_delete):
299300
plt.tight_layout()
300301

301302
# Save with lower DPI for large datasets to save space and time
302-
dpi_value = 50 if total_events > 1000 else 150
303+
dpi_value = 100 if total_events > 1000 else 150
303304
plt.savefig(output_file, dpi=dpi_value, bbox_inches='tight', pad_inches=0.1)
304305

305306
#close figure and clear memory
@@ -340,12 +341,12 @@ def cleanup_variables(*vars_to_delete):
340341
continue
341342

342343
# Final summary
343-
print(f"\\nProcessing complete!")
344+
print(f"\nProcessing complete!")
344345
print(f"Successfully processed: {processed_events - len(failed_events)}/{total_events}")
345346
print(f"Failed events: {len(failed_events)}")
346347

347348
if failed_events:
348-
print("\\nFailed events:")
349+
print("\nFailed events:")
349350
for event_id, error_msg in failed_events:
350351
print(f" {event_id}: {error_msg}")
351352

@@ -360,7 +361,7 @@ def cleanup_variables(*vars_to_delete):
360361
for id in ids:
361362
try:
362363
eve = np.where(eve_id==id)[0][0]
363-
print(id,'\\n',eve)
364+
print(id,'\n',eve)
364365
#cm to m
365366
pred_mean=pred_depths_mean[eve]/100
366367
pred_sigmaminus=pred_depths_sigmaminus[eve]/100

scripts/JGR/plots/03_plotPygmt_gridPTHA_hazCurves.ipynb

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": 3,
12+
"execution_count": 1,
1313
"metadata": {},
1414
"outputs": [
1515
{
@@ -446,7 +446,11 @@
446446
},
447447
{
448448
"cell_type": "code",
449+
<<<<<<< HEAD
449450
"execution_count": 26,
451+
=======
452+
"execution_count": 6,
453+
>>>>>>> origin/main-dev
450454
"metadata": {},
451455
"outputs": [
452456
{
@@ -465,7 +469,11 @@
465469
"xyz2grd [WARNING]: Encountered first invalid binary data record near/at line # 198127\n",
466470
"xyz2grd [WARNING]: Likely causes:\n",
467471
"xyz2grd [WARNING]: (1) Invalid x and/or y values, i.e. NaNs.\n",
472+
<<<<<<< HEAD
468473
"/tmp/ipykernel_651152/3219471298.py:129: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.\n",
474+
=======
475+
"/tmp/ipykernel_3809418/3219471298.py:129: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.\n",
476+
>>>>>>> origin/main-dev
469477
" ex_rate = np.reshape(ex_rate, (grid_SR.dims['y'], grid_SR.dims['x']))\n",
470478
"xyz2grd [WARNING]: (x_max-x_min) must equal (NX + eps) * x_inc), where NX is an integer and |eps| <= 0.0001.\n",
471479
"xyz2grd [WARNING]: (y_max-y_min) must equal (NY + eps) * y_inc), where NY is an integer and |eps| <= 0.0001.\n",
@@ -498,7 +506,11 @@
498506
"xyz2grd [WARNING]: Encountered first invalid binary data record near/at line # 165127\n",
499507
"xyz2grd [WARNING]: Likely causes:\n",
500508
"xyz2grd [WARNING]: (1) Invalid x and/or y values, i.e. NaNs.\n",
509+
<<<<<<< HEAD
501510
"/tmp/ipykernel_651152/3219471298.py:129: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.\n",
511+
=======
512+
"/tmp/ipykernel_3809418/3219471298.py:129: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.\n",
513+
>>>>>>> origin/main-dev
502514
" ex_rate = np.reshape(ex_rate, (grid_SR.dims['y'], grid_SR.dims['x']))\n",
503515
"xyz2grd [WARNING]: (x_max-x_min) must equal (NX + eps) * x_inc), where NX is an integer and |eps| <= 0.0001.\n",
504516
"xyz2grd [WARNING]: (y_max-y_min) must equal (NY + eps) * y_inc), where NY is an integer and |eps| <= 0.0001.\n",
@@ -531,7 +543,11 @@
531543
"xyz2grd [WARNING]: Encountered first invalid binary data record near/at line # 95070\n",
532544
"xyz2grd [WARNING]: Likely causes:\n",
533545
"xyz2grd [WARNING]: (1) Invalid x and/or y values, i.e. NaNs.\n",
546+
<<<<<<< HEAD
534547
"/tmp/ipykernel_651152/3219471298.py:129: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.\n",
548+
=======
549+
"/tmp/ipykernel_3809418/3219471298.py:129: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.\n",
550+
>>>>>>> origin/main-dev
535551
" ex_rate = np.reshape(ex_rate, (grid_SR.dims['y'], grid_SR.dims['x']))\n",
536552
"xyz2grd [WARNING]: (x_max-x_min) must equal (NX + eps) * x_inc), where NX is an integer and |eps| <= 0.0001.\n",
537553
"xyz2grd [WARNING]: (y_max-y_min) must equal (NY + eps) * y_inc), where NY is an integer and |eps| <= 0.0001.\n",
@@ -564,7 +580,11 @@
564580
"xyz2grd [WARNING]: Encountered first invalid binary data record near/at line # 59089\n",
565581
"xyz2grd [WARNING]: Likely causes:\n",
566582
"xyz2grd [WARNING]: (1) Invalid x and/or y values, i.e. NaNs.\n",
583+
<<<<<<< HEAD
567584
"/tmp/ipykernel_651152/3219471298.py:129: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.\n",
585+
=======
586+
"/tmp/ipykernel_3809418/3219471298.py:129: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.\n",
587+
>>>>>>> origin/main-dev
568588
" ex_rate = np.reshape(ex_rate, (grid_SR.dims['y'], grid_SR.dims['x']))\n",
569589
"xyz2grd [WARNING]: (x_max-x_min) must equal (NX + eps) * x_inc), where NX is an integer and |eps| <= 0.0001.\n",
570590
"xyz2grd [WARNING]: (y_max-y_min) must equal (NY + eps) * y_inc), where NY is an integer and |eps| <= 0.0001.\n",
@@ -599,7 +619,11 @@
599619
"xyz2grd [WARNING]: Encountered first invalid binary data record near/at line # 8127\n",
600620
"xyz2grd [WARNING]: Likely causes:\n",
601621
"xyz2grd [WARNING]: (1) Invalid x and/or y values, i.e. NaNs.\n",
622+
<<<<<<< HEAD
602623
"/tmp/ipykernel_651152/3219471298.py:129: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.\n",
624+
=======
625+
"/tmp/ipykernel_3809418/3219471298.py:129: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.\n",
626+
>>>>>>> origin/main-dev
603627
" ex_rate = np.reshape(ex_rate, (grid_SR.dims['y'], grid_SR.dims['x']))\n",
604628
"xyz2grd [WARNING]: (x_max-x_min) must equal (NX + eps) * x_inc), where NX is an integer and |eps| <= 0.0001.\n",
605629
"xyz2grd [WARNING]: (y_max-y_min) must equal (NY + eps) * y_inc), where NY is an integer and |eps| <= 0.0001.\n",

scripts/JGR/plots/07_plotFig_modelPerformance_misFit_modelArch.ipynb

Lines changed: 80 additions & 73 deletions
Large diffs are not rendered by default.

scripts/JGR/plots/08_plotFig_bias_variance_size.ipynb

Lines changed: 4 additions & 3 deletions
Large diffs are not rendered by default.
2.65 MB
3.02 MB
2.62 MB
2.67 MB
2.74 MB

0 commit comments

Comments
 (0)