Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjustments for US NSHM GMPEs #9894

Open
emthompson-usgs opened this issue Aug 7, 2024 · 6 comments
Open

Adjustments for US NSHM GMPEs #9894

emthompson-usgs opened this issue Aug 7, 2024 · 6 comments

Comments

@emthompson-usgs
Copy link

For the 2023 hazard map, the USGS created an AK-specific bias adjustment for the AG20 model (implementation in Java is here). We would like to use this adjustment for ShakeMap and so we would like to contribute this adjustment to OQ. Before we get to work on it, we'd like to check to see if you have any guidance on how this should be implemented. It looks like it is just a period-specific additive factor. Thanks.

@emthompson-usgs
Copy link
Author

Correction: this isn't specifically for the AG20. It is also for Keuhn and Parker NGA Sub models.

@emthompson-usgs emthompson-usgs changed the title Alaska bias adjustment for AG20 model Alaska bias adjustment for NGA Sub model Aug 7, 2024
@emthompson-usgs
Copy link
Author

A related modification to GMPEs for the NSHM is the M9 basin adjustment. Here's an initial implementation based on the example CY14 modifiable GMPE. We could do something very similar for the bias adjustments.

import numpy as np

from openquake.hazardlib import const
from openquake.hazardlib.gsim.base import GMPE, registry


class M9BasinTerm(GMPE):
    """
    Implements the NSHM "M9" basin term to be applied to other GMMs for
    Cascadia.
    """

    REQUIRES_SITES_PARAMETERS = {"z2pt5"}
    REQUIRES_DISTANCES = set()
    REQUIRES_RUPTURE_PARAMETERS = set()
    DEFINED_FOR_INTENSITY_MEASURE_COMPONENT = ""
    DEFINED_FOR_INTENSITY_MEASURE_TYPES = set()
    DEFINED_FOR_STANDARD_DEVIATION_TYPES = {const.StdDev.TOTAL}
    DEFINED_FOR_TECTONIC_REGION_TYPE = ""
    DEFINED_FOR_REFERENCE_VELOCITY = None

    def __init__(self, gmpe_name, **kwargs):
        self.gmpe = registry[gmpe_name]()
        self.set_parameters()

    def compute(self, ctx: np.recarray, imts, mean, sig, tau, phi):
        self.gmpe.compute(ctx, imts, mean, sig, tau, phi)
        fb_m9 = np.log(2.0)
        idx = ctx.z2pt5 > 6.0
        for m, imt in enumerate(imts):
            if imt.period > 1.9:
                mean[m][idx] += fb_m9

@emthompson-usgs emthompson-usgs changed the title Alaska bias adjustment for NGA Sub model Adjustments for US NSHM GMPEs Aug 9, 2024
@emthompson-usgs
Copy link
Author

Then, to make this something that can be imported just like other OQ GMMs, I am thinking of making a module like this:

from esi_shakelib.gmpe.modifiable_gmpes.m9_basin import M9BasinTerm


class AtkinsonMacias2009M9basin(M9BasinTerm):
    """
    Returns M9 modification of the Atkinson and Macias (2009) GSIM.
    """

    def __init__(self):
        super().__init__(gmpe_name="AtkinsonMacias2009")

Note that I put the M9BasinTerm in the esi-shakelib repository for testing purposes. Please let me know if this is misguided 😄

@mmpagani
Copy link
Member

Hi @emthompson-usgs, if I understood the problem well this is another case where the modifiable GMPE would work well. I just pushed a branch with a simple example and a test. Please check if this does what you were asking #9904

@emthompson-usgs
Copy link
Author

I think the issue is that I need to figure out how to integrate this implementation into ShakeMap. This may be a broader issue with our ability to use the "ModifiableGMPE" class. In ShakeMap, we have a config file that specifies the GMPE names that will be used and links them to OQ by providing a path to the module and the name of the class in that module. We then have a mapping between these GMPE names and how they are combined into GMPE sets for specific tectonic environments/regions.

So, to define a class that we can import within this framework with the implementation in your PR, I think we could define a GMPE class that simply does this:

from openquake.hazardlib.gsim.mgmpe.modifiable_gmpe import ModifiableGMPE

class AtkinsonMacias2009M9basin(ModifiableGMPE):
    """
    Returns M9 modification of the Atkinson and Macias (2009) GSIM.
    """

    def __init__(self):
        super().__init__(gmpe={gmm_name: "AtkinsonMacias2009"}, m9_basin_term={})

Is this something that you could add to OQ? If not, we can add it to the ShakeMap repository.

Tagging @cbworden so he sees this discussion.

@micheles
Copy link
Contributor

Instantiating a ModifiableGMPE correctly is surprisingly difficult, so we added a factory function to do that two months ago. It is in openquake.hazardlib.valid.modified_gsim. I cannot give you an example right now since I am writing from my phone, please have patience ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants