Skip to content

Commit

Permalink
wrap OQ z1p0 and z2pt5 functions for backward compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdicaprio committed Dec 16, 2024
1 parent fc59d3f commit 3c30750
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion nzshm_model/psha_adapter/openquake/hazard_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@
from .hazard_config_compat import check_invariants, compatible_hash_digest

try:
from openquake.hazardlib.site import calculate_z1pt0, calculate_z2pt5
import numpy as np
import openquake.hazardlib.site

def calculate_z1pt0(vs30: float) -> float:
"""wrap openquake calcualte_z1pt0 which accepts a numpy array of vs30 and list of countries"""
return openquake.hazardlib.site.calculate_z1pt0(np.array([vs30]), ['NZ'])[0]

def calculate_z2pt5(vs30: float) -> float:
"""wrap openquake calcualte_z2pt5 which accepts a numpy array of vs30 and list of countries"""
return openquake.hazardlib.site.calculate_z2pt5(np.array([vs30]), ['NZ'])[0]

except ImportError:
warnings.warn(

Check warning on line 37 in nzshm_model/psha_adapter/openquake/hazard_config.py

View check run for this annotation

Codecov / codecov/patch

nzshm_model/psha_adapter/openquake/hazard_config.py#L37

Added line #L37 was not covered by tests
"""warning openquake module dependency not available, maybe you want to install
Expand Down

0 comments on commit 3c30750

Please sign in to comment.