Add a h3 grid-lookup from hdf5-based GSIM adjustment utility class#11380
Open
CB-quakemodel wants to merge 31 commits intomasterfrom
Open
Add a h3 grid-lookup from hdf5-based GSIM adjustment utility class#11380CB-quakemodel wants to merge 31 commits intomasterfrom
CB-quakemodel wants to merge 31 commits intomasterfrom
Conversation
micheles
reviewed
Apr 15, 2026
mmpagani
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a utility GSIM class that applies h3-gridded location-based adjustments to the mean and sigma components of an underlying GSIM, resolved by either rupture hypocentre or site location.
This class can consider a h3-densifying grid, but the code works with only a single resolution too.
Configuration is stored at root level in the hdf5 as a
res_termsdict attribute. Each key is a residual term (e.g.dL2L,dS2S) mapping to:location:"hypo"(usesctx.hypo_lon/ctx.hypo_lat— e.g.dL2L) or"site"(usesctx.lon/ctx.lat— e.g.dS2S) to determine which correction to applysig_adjustment(optional, default"none"): whether to reduce ("sub"), inflate ("add"), or not modify the sigma component ("none")sig_comp_modified(required whensig_adjustmentis not"none"): which sigma component to adjust —"sig","tau", or"phi"(e.g. fordL2Lwe would map to an adjustment totauwithin this dict)When
sig_adjustmentis"none"(the default), only the mean correction is applied — the_sigdatasets in the hdf5 and thesig_comp_modifiedkey are not required for that term.The residual (corrective) terms stored in the
res_termsdict are not fixed — the user can specify as they wish (e.g. only includedS2S). Checks ensure that if a residual term is mapped in this dictionary that it also is contained within the grid.The corrections must be IMT-dependent, and if an IMT lacks corrections for a given residual term, it is simply skipped. The h3 cell IDs (i.e. the grids) are on an IMT-by-IMT basis because the availability of data used to derive the corrections might vary with both period and term.
Unit tests and a new QA test (
classical/case_11) are added for this capability.The user can refer to
oq-engine\openquake\hazardlib\tests\gsim\mgmpe\data\test_grid_adjustments.hdf5or the hdf5 inclassical/case_11for an example of how the grid information is stored in the hdf5.This class will evolve as we use it in real applications but right now it's highly experimental