Skip to content

Commit 6ecc6bf

Browse files
authored
Merge pull request #425 from kuanshi/opensha_new
patches for opensha dependency upgrade (25.4.1)
2 parents c17530b + cacd358 commit 6ecc6bf

7 files changed

Lines changed: 22 additions & 8 deletions

File tree

modules/performRegionalEventSimulation/regionalGroundMotion/ComputeIntensityMeasure.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@
111111

112112
if 'stampede2' not in socket.gethostname():
113113
from FetchOpenQuake import get_site_rup_info_oq
114-
from FetchOpenSHA import * # noqa: F403
114+
#from FetchOpenSHA import * # noqa: F403
115+
from FetchOpenSHA_25_4_1 import * # noqa: F403
115116
import threading # noqa: E402
116117

117118
import ujson # noqa: E402

modules/performRegionalEventSimulation/regionalGroundMotion/CreateScenario.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
import pandas as pd
4949

5050
if 'stampede2' not in socket.gethostname():
51-
from FetchOpenSHA import * # noqa: F403
51+
#from FetchOpenSHA import * # noqa: F403
52+
from FetchOpenSHA_25_4_1 import * # noqa: F403
5253

5354

5455
def get_rups_to_run(scenario_info, user_scenarios, num_scenarios): # noqa: C901, D103

modules/performRegionalEventSimulation/regionalGroundMotion/CreateStation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def __call__(self, *args, **kwargs):
7878

7979

8080
if 'stampede2' not in socket.gethostname():
81-
from FetchOpenSHA import (
81+
#from FetchOpenSHA import (
82+
from FetchOpenSHA_25_4_1 import (
8283
get_site_vs30_from_opensha,
8384
get_site_z1pt0_from_opensha,
8485
get_site_z2pt5_from_opensha,

modules/performRegionalEventSimulation/regionalGroundMotion/FetchOpenSHA_25_4_1.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from org.opensha.commons.data import * # noqa: F403
3535
from org.opensha.commons.data.function import * # noqa: F403
3636
from org.opensha.commons.data.siteData import * # noqa: F403
37-
from org.opensha.commons.geo import * # noqa: F403
37+
#from org.opensha.commons.geo import * # noqa: F403
38+
from org.opensha.commons.geo import Location # noqa: F403
3839
from org.opensha.commons.param import * # noqa: F403
3940
from org.opensha.commons.param.constraint import * # noqa: F403
4041
from org.opensha.commons.param.event import * # noqa: F403
@@ -464,6 +465,7 @@ def get_PointSource_info_CY2014(source_info, siteList): # noqa: N802, N803, D10
464465
'dip': float(source_info['AverageDip']),
465466
'width': 0.0,
466467
'zTop': sourceDepth,
468+
'zHyp': sourceDepth,
467469
'aveRake': float(source_info['AverageRake']),
468470
}
469471
return site_rup_info, siteList

modules/performRegionalEventSimulation/regionalGroundMotion/HazardSimulation.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151

5252
R2D = True
5353

54+
OPENSHA_JAR = 'opensha-all.jar' # version 25.4.1 (invoked in 04/2026)
55+
5456

5557
def site_job(hazard_info): # noqa: C901, D103
5658
# Sites and stations
@@ -542,12 +544,14 @@ def hazard_job(hazard_info): # noqa: C901, D103, PLR0915
542544

543545
memory_total = psutil.virtual_memory().total / (1024.0**3)
544546
memory_request = int(memory_total * 0.75)
545-
jpype.addClassPath('./lib/OpenSHA-1.5.2.jar')
547+
#jpype.addClassPath('./lib/OpenSHA-1.5.2.jar') # not supported by opensha starting from 02/2026
548+
jpype.addClassPath('./lib/{}'.format(OPENSHA_JAR))
546549
try:
547550
jpype.startJVM(f'-Xmx{memory_request}G', convertStrings=False)
548551
except: # noqa: E722
549552
print( # noqa: T201
550-
f'StartJVM of ./lib/OpenSHA-1.5.2.jar with {memory_request} GB Memory fails. Try again after releasing some memory'
553+
#f'StartJVM of ./lib/OpenSHA-1.5.2.jar with {memory_request} GB Memory fails. Try again after releasing some memory'
554+
f'StartJVM of ./lib/{OPENSHA_JAR} with {memory_request} GB Memory fails. Try again after releasing some memory'
551555
)
552556
if oq_flag:
553557
# clear up old db.sqlite3 if any

modules/performRegionalEventSimulation/regionalGroundMotion/HazardSimulationEQ.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
R2D = True
5454

55+
OPENSHA_JAR = 'opensha-all.jar' # version 25.4.1 (invoked in 04/2026)
5556

5657
def hazard_job(hazard_info): # noqa: C901, D103, PLR0915
5758
from CreateScenario import load_ruptures_openquake
@@ -578,7 +579,8 @@ def hazard_job(hazard_info): # noqa: C901, D103, PLR0915
578579

579580
memory_total = psutil.virtual_memory().total / (1024.0**3)
580581
memory_request = int(memory_total * 0.75)
581-
jpype.addClassPath('./lib/OpenSHA-1.5.2.jar')
582+
#jpype.addClassPath('./lib/OpenSHA-1.5.2.jar') # not supported by opensha starting from 02/2026
583+
jpype.addClassPath('./lib/{}'.format(OPENSHA_JAR))
582584
jpype.startJVM(f'-Xmx{memory_request}G', convertStrings=False)
583585
if oq_flag:
584586
# clear up old db.sqlite3 if any

modules/performRegionalEventSimulation/regionalGroundMotion/ScenarioForecast.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747

4848
import psutil
4949

50+
OPENSHA_JAR = 'opensha-all.jar' # version 25.4.1 (invoked in 04/2026)
51+
5052
if __name__ == '__main__':
5153
# parse arguments
5254
parser = argparse.ArgumentParser()
@@ -112,7 +114,8 @@
112114

113115
memory_total = psutil.virtual_memory().total / (1024.0**3)
114116
memory_request = int(memory_total * 0.75)
115-
jpype.addClassPath('./lib/OpenSHA-1.5.2.jar')
117+
#jpype.addClassPath('./lib/OpenSHA-1.5.2.jar') # not supported by opensha starting from 02/2026
118+
jpype.addClassPath('./lib/{}'.format(OPENSHA_JAR))
116119
jpype.startJVM(f'-Xmx{memory_request}G', convertStrings=False)
117120
from CreateScenario import (
118121
create_earthquake_scenarios,

0 commit comments

Comments
 (0)