Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
miili committed Oct 25, 2023
1 parent 6a724af commit 737655c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions lassie/apps/lassie.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def main() -> None:
subparsers = parser.add_subparsers(title="commands", required=True, dest="command")

run = subparsers.add_parser(
"run",
help="start a new detection run",
"search",
help="start a search 🐕",
description="detect, localize and characterize earthquakes in a dataset",
)
run.add_argument("config", type=Path, help="path to config file")
Expand Down
12 changes: 11 additions & 1 deletion lassie/waveforms/squirrel.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
PositiveFloat,
PositiveInt,
PrivateAttr,
field_validator,
model_validator,
)
from pyrocko.squirrel import Squirrel
Expand Down Expand Up @@ -95,13 +96,22 @@ class PyrockoSquirrel(WaveformProvider):
_stations: Stations = PrivateAttr()

@model_validator(mode="after")
def _validate_time_span(self) -> Self:
def _validate_model(self) -> Self:
if self.start_time and self.end_time and self.start_time > self.end_time:
raise ValueError("start_time must be before end_time")
if self.freq_min and self.freq_max and self.freq_min > self.freq_max:
raise ValueError("freq_min must be less than freq_max")
return self

@field_validator("waveform_dirs")
def check_dirs(self, dirs: list[Path]) -> list[Path]:
if not dirs:
raise ValueError("no waveform directories provided!")
for data_dir in dirs:
if not data_dir.exists():
raise ValueError(f"waveform directory {data_dir} does not exist")
return dirs

def get_squirrel(self) -> Squirrel:
if not self._squirrel:
logger.debug("initializing squirrel")
Expand Down

0 comments on commit 737655c

Please sign in to comment.