Repository navigation
Add a create-imdb stage collecting intensity measures into an IMDB - #230
Open
lispandfound wants to merge 3 commits into
Open
lispandfound wants to merge 3 commits into
lispandfound wants to merge 3 commits into
Conversation
create-imdb builds an IMDB (ucgmsim-imdb) from im-calc intensity measure files alone: simulated records per station and component, and gmm records per station, ground motion model and component. Observations are not included. Realisations named like clones (`<event>_R<n>`) are grouped into their event. Simulated records inside SW4's absorbing layer are left out. im-calc now records the component of each empirical estimate, always writes site parameters, and always writes the supergrid coordinates (NaN where the solver does not report them). Requires pandas 3 through ucgmsim-imdb, so velocity-modelling is raised to 2026.10.2, which drops its pandas<3 cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lispandfound
commented
Oct 23, 2026
Comment on lines
+139
to
+161
| def read_stations(dtree: xr.DataTree) -> pd.DataFrame: | ||
| """Read the per-station parameters `im-calc` attaches to every IM. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| dtree : xr.DataTree | ||
| The intensity measure tree. | ||
|
|
||
| Returns | ||
| ------- | ||
| pd.DataFrame | ||
| The station location, site parameters, distances and absorbing layer | ||
| penetration, indexed by station name. | ||
| """ | ||
| dataset = next(node.dataset for node in dtree.subtree if node.has_data) | ||
| return pd.DataFrame( | ||
| { | ||
| name: coordinate.values | ||
| for name, coordinate in dataset.coords.items() | ||
| if coordinate.dims == ("station",) and name != "station" | ||
| }, | ||
| index=pd.Index(dataset.station.values, name="station"), | ||
| ) |
Contributor
Author
There was a problem hiding this comment.
xarray has a builtin for this.
Contributor
Author
There was a problem hiding this comment.
Switched to dataset.coords.to_dataset().drop_dims(...).to_dataframe() in 4452e48.
…matting Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
create-imdb builds an IMDB (ucgmsim-imdb) from im-calc intensity measure files alone: simulated records per station and component, and gmm records per station, ground motion model and component. Observations are not included. Realisations named like clones (
<event>_R<n>) are grouped into their event. Simulated records inside SW4's absorbing layer are left out.im-calc now records the component of each empirical estimate, always writes site parameters, and always writes the supergrid coordinates (NaN where the solver does not report them).
Requires pandas 3 through ucgmsim-imdb, so velocity-modelling is raised to 2026.10.2, which drops its pandas<3 cap.