Skip to content

Add a h3 grid-lookup from hdf5-based GSIM adjustment utility class#11380

Open
CB-quakemodel wants to merge 31 commits intomasterfrom
ergo_mgmpe
Open

Add a h3 grid-lookup from hdf5-based GSIM adjustment utility class#11380
CB-quakemodel wants to merge 31 commits intomasterfrom
ergo_mgmpe

Conversation

@CB-quakemodel
Copy link
Copy Markdown
Contributor

@CB-quakemodel CB-quakemodel commented Apr 14, 2026

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_terms dict attribute. Each key is a residual term (e.g. dL2L, dS2S) mapping to:

  • location: "hypo" (uses ctx.hypo_lon/ctx.hypo_lat — e.g. dL2L) or "site" (uses ctx.lon/ctx.lat — e.g. dS2S) to determine which correction to apply
  • sig_adjustment (optional, default "none"): whether to reduce ("sub"), inflate ("add"), or not modify the sigma component ("none")
  • sig_comp_modified (required when sig_adjustment is not "none"): which sigma component to adjust — "sig", "tau", or "phi" (e.g. for dL2L we would map to an adjustment to tau within this dict)

When sig_adjustment is "none" (the default), only the mean correction is applied — the _sig datasets in the hdf5 and the sig_comp_modified key are not required for that term.

The residual (corrective) terms stored in the res_terms dict are not fixed — the user can specify as they wish (e.g. only include dS2S). 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.hdf5 or the hdf5 in classical/case_11 for 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

@CB-quakemodel CB-quakemodel changed the title [WIP] Add a h3 grid-lookup from hdf5-based GSIM adjustment utility class Add a h3 grid-lookup from hdf5-based GSIM adjustment utility class Apr 14, 2026
Comment thread openquake/hazardlib/gsim/mgmpe/grid_adjusted_gmpe.py
@CB-quakemodel CB-quakemodel requested a review from micheles April 17, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants