Rewrite bb-sim on dask and switch to the site-calculation models - #130
Open
lispandfound wants to merge 1 commit into
Open
Rewrite bb-sim on dask and switch to the site-calculation models#130lispandfound wants to merge 1 commit into
lispandfound wants to merge 1 commit into
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the broadband simulation pipeline to use the BA2018 + CB2014 site amplification models from the site-calculation package, while refactoring bb-sim to operate lazily with dask/xarray for lower memory usage and adding metadata to outputs.
Changes:
- Refactors broadband merging to dask/xarray, including station-chunked processing and per-chunk site amplification + filtering.
- Adds signal resampling to handle LF/HF mismatched sample rates and embeds Vs30 + site amp parameters in output metadata.
- Introduces
SiteAmpModelenum and extends broadband parameter schemas/defaults to support BA2018/CB2014 selection.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| workflow/scripts/bb_sim.py | Reworks broadband merge to dask/xarray, adds resampling/alignment, and applies BA2018/CB2014 amplification from site-calculation. |
| workflow/schemas.py | Adds SiteAmpModel and tightens broadband parameter validation (including new taper params). |
| workflow/realisations.py | Updates BroadbandParameters dataclass to include fhightop, fmax, and typed site_amp_version. |
| workflow/default_parameters/v24_2_2_4/defaults.yaml | Removes per-version bb defaults (now inherited from root). |
| workflow/default_parameters/v24_2_2_2/defaults.yaml | Removes per-version bb defaults (now inherited from root). |
| workflow/default_parameters/v24_2_2_1/defaults.yaml | Removes per-version bb defaults (now inherited from root). |
| workflow/default_parameters/root/defaults.yaml | Adds/updates broadband defaults including BA2018 model selection and taper frequencies. |
| uv.lock | Adds site-calculation and updates lock entries accordingly. |
| pyproject.toml | Declares dependency on site-calculation>=2026.7.1. |
| tests/test_realisation.py | Updates broadband parameter serialization test for new fields and enum. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lispandfound
force-pushed
the
ba18_bb_sim
branch
from
August 31, 2026 09:09
884767f to
cd47e92
Compare
lispandfound
force-pushed
the
ba18_bb_sim
branch
2 times, most recently
from
September 2, 2026 02:52
10b1ffb to
df1f207
Compare
lispandfound
force-pushed
the
ba18_bb_sim
branch
from
September 4, 2026 01:44
df1f207 to
3ea7ac6
Compare
lispandfound
force-pushed
the
ba18_bb_sim
branch
from
September 8, 2026 22:56
3ea7ac6 to
d31d016
Compare
lispandfound
force-pushed
the
ba18_bb_sim
branch
from
September 9, 2026 00:09
d31d016 to
cf2ea99
Compare
lispandfound
force-pushed
the
ba18_bb_sim
branch
2 times, most recently
from
September 10, 2026 20:58
720c102 to
fcd361b
Compare
Two changes to the same function body, which is why they are one commit. **Larger than memory.** `bb-sim` read both waveform files entirely into memory and looped over the three components in Python. Now LF and HF are opened lazily, the common stations are selected on the *backend* arrays before chunking -- selecting after chunking makes station reordering an all-to-all dask shuffle, which materialises the whole array -- and the recombination runs per chunk under `map_blocks`. Chunking is over stations only, so each chunk holds complete traces for resampling, alignment and filtering. `resample_signal` and `align_datasets` replace the old pad-and-align: the two legs no longer have to share a timestep, so an SW4 LF run at one dt can be combined with HF at another. `relabel_hf_components` maps HF's 090/000/ver onto LF's x/y/z once, up front. **Site amplification.** Replaces `qcore.siteamp_models.cb_amp_multi` with the `site-calculation` models, selected by `bb.site_amp_version`: CB2014 as before, or BA2018. The amplification is now constrained to an explicit [fmin, fmax] band with logarithmic tapers at both ends, which is what the two new `fhightop` and `fmax` parameters are for -- the old code had a lowpass taper only. `site_amp_version` becomes an enum rather than a free string. It was previously declared, defaulted to "2014", and read by nothing at all. The shared broadband parameters move from each defaults version into root; the versions now carry only `flo`, which is the one value that genuinely differs between them. Station-dimension coordinates -- `supergrid_depth` among them -- ride through `map_blocks` untouched, which is why the supergrid penetration is carried as a coordinate rather than a data variable. This changes broadband results: different site amplification model, and a highpass taper where there was none. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lispandfound
force-pushed
the
ba18_bb_sim
branch
from
September 10, 2026 21:09
fcd361b to
17d8dd1
Compare
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.
As described, but I took the opportunity to further refactor bb-sim: