Skip to content

TakeSnapshot.py

Anthony Fok edited this page Mar 2, 2023 · 1 revision

About

TakeSnapshot.py was written by Tiegan E. Hobbs and maintained by Damon Ulmi.

  • Run inside the "FINISHED" directory
  • Input:
    • s_shakemap_{NAME}_{SHAKE}.csv
    • s_dmgbyasset_{NAME}_b0_{DMGb0}_{EXPO}.csv
    • s_consequences_{NAME}_b0_{DMGb0}_{EXPO}.csv
    • s_lossesbyasset_{NAME}_b0_{LOSSb0}_{EXPO}.csv
    • s_dmgbyasset_{NAME}_r1_{DMGr1}_{EXPO}.csv
    • s_consequences_{NAME}_r1_{DMGr1}_{EXPO}.csv
    • s_lossesbyasset_{NAME}_r1_{LOSSr1}_{EXPO}.csv
    • s_Hazard_{NAME}.ini
    • s_Damage_{NAME}_b0_{EXPO}.ini
    • s_Risk_{NAME}_b0_{EXPO}.ini
  • Output:
    • {NAME}.md
    • {NAME}.png

Ideas

Try to auto-detect the exposure file type and OpenQuake run numbers to simplify command-line calls and to facilitate automation.

Sample runs

OpenDRR/earthquake-scenarios/FINISHED$ ../scripts/TakeSnapshot.py ACM7p4_DenaliFault b 181 182 183 184 185
OpenDRR/earthquake-scenarios/FINISHED/../scripts/TakeSnapshot.py:293: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
  rate = rate.append(
OpenDRR/earthquake-scenarios/FINISHED/../scripts/TakeSnapshot.py:325: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
  rate = rate.append(
OpenDRR/earthquake-scenarios/FINISHED/../scripts/TakeSnapshot.py:325: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
  rate = rate.append(
   srcWeight                           srcName  regWeight regName  maxMagCentral  N0Central  bCentral     betaC        NC             RP
0        1.0         DSR - DENALI SOUTH REGION        1.0       W           7.20  2382.9600    0.8164  1.879830 -0.000989   -1011.345976
1        0.5  EDF - EASTERN DENALI FAULT b=0.0        1.0       W           8.02     0.0106    0.0001  0.000230  0.000002  661999.644422
2        0.5  EDF - EASTERN DENALI FAULT b=0.8        1.0       W           8.02   949.1536    0.8000  1.842068  0.000777    1287.106470
The recurrence rate for W is -1667.8959827773792 years
Weighted recurrence rate is -1667.8959827773792
2023-03-02 14:35:13
OpenDRR/earthquake-scenarios/FINISHED$ ../scripts/TakeSnapshot.py ACM4p9_GeorgiaStraitFault b 1 2 3 4 5
OpenDRR/earthquake-scenarios/FINISHED/../scripts/TakeSnapshot.py:293: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
  rate = rate.append(
   srcWeight                                     srcName  regWeight regName  maxMagCentral  N0Central  bCentral     betaC       NC         RP
0        1.0  VICM  -   VANCOUVER ISLAND COAST MOUNTAINS        1.0       W            7.5     180.79    0.7418  1.708058  0.04142  24.143156
The recurrence rate for W is 24.14315592412507 years
Weighted recurrence rate is 24.14315592412507
OpenDRR/earthquake-scenarios/FINISHED$ ../scripts/TakeSnapshot.py SCM5p5_ConstanceBay b 118 119 120 121 122
OpenDRR/earthquake-scenarios/FINISHED/../scripts/TakeSnapshot.py:293: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
  rate = rate.append(
OpenDRR/earthquake-scenarios/FINISHED/../scripts/TakeSnapshot.py:293: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
  rate = rate.append(
OpenDRR/earthquake-scenarios/FINISHED/../scripts/TakeSnapshot.py:293: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
  rate = rate.append(
OpenDRR/earthquake-scenarios/FINISHED/../scripts/TakeSnapshot.py:293: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
  rate = rate.append(
OpenDRR/earthquake-scenarios/FINISHED/../scripts/TakeSnapshot.py:293: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
  rate = rate.append(
OpenDRR/earthquake-scenarios/FINISHED/../scripts/TakeSnapshot.py:293: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
  rate = rate.append(
   srcWeight                                        srcName  regWeight regName  maxMagCentral  N0Central  bCentral     betaC        NC           RP
0        1.0              IRB2    - Iapetan Rift Background        0.2   SE_R2            7.3  1187.3199    1.0972  2.526396  0.001085   921.844141
1        1.0                  IRM2    - Iapetan Rift Margin        0.2   SE_R2            7.8   102.4600    0.6335  1.458688  0.032424    30.840956
2        1.0                              PEM    - PEMBROKE        0.4   SE_H2            7.8   140.7300    0.9415  2.167884  0.000927  1078.550809
3        1.0                          PEMHY    - PEMHYBROKE        0.4   SE_HY            6.8   140.7300    0.9415  2.167884  0.000878  1139.204471
4        0.7         IRMC  - Iapetan Rift Margin Core (0.7)        0.4   SE_HY            7.8    49.1700    0.5950  1.370038  0.025130    39.792353
5        0.3  IRME    - Iapetan Rift Margin Extended  (0.3)        0.4   SE_HY            7.8    49.1700    0.5950  1.370038  0.025130    39.792353
The recurrence rate for SE_R2 is 29.842552484663322 years
The recurrence rate for SE_H2 is 1078.5508091689526 years
OpenDRR/earthquake-scenarios/FINISHED/../scripts/TakeSnapshot.py:349: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  dftemp['NC'] = dftemp['NC'] * dftemp['srcWeight']
The recurrence rate for SE_HY is 38.44931986903085 years
Weighted recurrence rate is 452.76856211212606