-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate to xarray for low-frequency waveforms input #37
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
base: pegasus
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
workflow/scripts/bb_sim.py:291
- [nitpick] Consider renaming 'station_file_v30' to 'station_vs30_df' to more clearly indicate that this variable holds a DataFrame.
station_file_v30 = pd.read_csv(
workflow/scripts/hf_sim.py:264
- [nitpick] Consider rephrasing the comment to clarify that 'dt' is directly obtained from hf_config rather than being calculated from duration and sample count.
dt = hf_config.dt # Calculate dt from duration and number of samples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new workflow stage for merging low-frequency waveform data into an xarray dataset while refactoring the high-frequency and broadband simulation stages to use xarray. Key changes include:
- Introduction of the new merge_lf stage in its own script.
- Refactoring of hf_sim to read and write data using xarray.
- Major updates in bb_sim to convert inputs from h5py files to xarray datasets and to better align station metadata.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| workflow/scripts/merge_lf.py | New script for merging low-frequency EMOD3D data into an xarray dataset. |
| workflow/scripts/hf_sim.py | Refactored HF simulation stage using xarray for dataset creation and file output. |
| workflow/scripts/bb_sim.py | Converted broadband simulation stage to use xarray datasets; adjusted station handling. |
| tests/test_cli.py | Updated CLI tests to include the new merge_lf command. |
| pyproject.toml | Added the merge-lf command entry to the project configuration. |
| }, | ||
| ) | ||
| # Ensure that LF and HF agree on station list | ||
| common_stations = list(set(hf_ds.station.values) & set(lf_ds.station.values)) |
Copilot
AI
Apr 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a set intersection to determine common_stations does not preserve a consistent order, which may lead to misalignment between station data and coordinate arrays. Consider sorting the list or using an intersection method that retains order to ensure consistency.
| common_stations = list(set(hf_ds.station.values) & set(lf_ds.station.values)) | |
| common_stations = [station for station in hf_ds.station.values if station in lf_ds.station.values] |
This pull request introduces a new workflow stage
merge-lfand refactors thehf-simandbb-simstages to usexarray. This is part of the ongoing project to standardise inputs and outputs on accepted industry standard file formats. Leaving as a draft for the time being until I can test it properly.