Add AI4EPS event format reader - #846
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis change adds AI4EPS event HDF5 support. It defines event metadata, reads selected data, registers the formatter and sample dataset, and adds tests and changelog documentation. ChangesAI4EPS reader integration
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/test_io/test_ai4eps/test_ai4eps.py`:
- Around line 82-93: Update test_near_miss_not_claimed to add a valid end_time
attribute while keeping event_id absent, so the fixture satisfies other metadata
requirements and independently verifies that AI4EPSV1().get_format rejects files
without event metadata.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d12f2ec5-0658-4473-9bac-4579a02758f6
📒 Files selected for processing (8)
dascore/data_registry.txtdascore/io/ai4eps/__init__.pydascore/io/ai4eps/core.pydascore/io/ai4eps/utils.pydocs/changelog.qmdpyproject.tomltests/test_io/test_ai4eps/test_ai4eps.pytests/test_io/test_common_io.py
7ed746f to
a720bc6
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #846 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 167 170 +3
Lines 18290 18374 +84
=========================================
+ Hits 18290 18374 +84
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
a720bc6 to
987d939
Compare
|
✅ Documentation built: |
987d939 to
c80769d
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
dascore/io/ai4eps/utils.py (1)
44-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winNarrow the exception handling in
_safe_units.The handler catches every
Exceptionfromget_quantity. This prevents scans from failing on malformed units, but it can also hide unexpected failures and silently removedata_units. Catch only the unit-parse exceptions used by this project, or isolate the scan-only fallback from the read path. Verify the exact exception types before narrowing.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@dascore/io/ai4eps/utils.py` around lines 44 - 50, Update _safe_units to catch only the specific unit-parsing exception types raised by get_quantity in this project, verifying those types from the parser implementation or existing callers. Preserve returning None for malformed units, while allowing unexpected exceptions to propagate instead of silently dropping data_units.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@dascore/io/ai4eps/utils.py`:
- Around line 44-50: Update _safe_units to catch only the specific unit-parsing
exception types raised by get_quantity in this project, verifying those types
from the parser implementation or existing callers. Preserve returning None for
malformed units, while allowing unexpected exceptions to propagate instead of
silently dropping data_units.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2e6c0b1a-ab94-4b7b-a513-8ae4b8362a13
📒 Files selected for processing (2)
dascore/io/ai4eps/utils.pytests/test_io/test_ai4eps/test_ai4eps.py
c80769d to
1f479f9
Compare
|
Re the nitpick on |
b159930 to
3b9ef21
Compare
Adds a FiberIO reader for the AI4EPS earthquake DAS event HDF5 format (e.g. the quakeflow_das dataset): a single 'data' dataset whose attrs carry acquisition metadata (begin_time, dt_s, dx_m, unit) and event metadata, which lands on the patch as typed attrs (event_id, event_time, magnitude, hypocenter). Detection requires the full attr structure including event_id so generic files with timing attrs are not claimed.
The Carina reader (#849) now claims this file but merged without removing the skip entry, so its common IO tests were silently skipped.
3b9ef21 to
42419f8
Compare
Description
Second PR of the format-reader series (after #844). Adds a FiberIO reader for the AI4EPS earthquake DAS event HDF5 format, used by the quakeflow_das dataset (MIT licensed; the registered
ai4eps_1.h5test file is a trimmed excerpt of event ci37280444 windowed around the P arrival).Layout: a single
datadataset of shape (channel, time) whose attrs carry acquisition metadata (begin_time/end_timetz-aware ISO with an exclusive-stop convention,dt_s,dx_m,unit) and event metadata. Notes:event_id(viah5_matches_structure) so generic files that happen to carry timing attrs are not claimed; a near-miss negative test pins this.event_id,event_time,magnitude,magnitude_type,event_latitude/event_longitude/event_depth_km(prefixed to avoid colliding with instrument coordinates).end_timedisagrees withbegin_time + n * dt_s(beyond half a sample) instead of silently inventing timing.dx_m.Changelog
AI4EPSformat for AI4EPS earthquake DAS event files (e.g. quakeflow_das), including event id, time, magnitude, and hypocenter as patch attrs.Checklist
I have (if applicable):
Summary by CodeRabbit
New Features
Documentation