Source code for obsplus.datasets.default_test
"""
The default test dataset. This consists exclusively of obspy's default objects
saved to disk.
"""
from pathlib import Path
import obspy
import obsplus
from obsplus.datasets.dataset import DataSet
[docs]
class Default(DataSet):
"""
A dataset from obspy's default stream, catalog, and inventory.
Each object is simply saved to the appropriate directory.
"""
name = "default_test"
version = "0.0.0"
# Days of interest. The collapse occurred on Aug 6th
[docs]
def download_events(self):
"""Just copy the events into a directory."""
cat = obspy.read_events()
obsplus.EventBank(self.event_path).put_events(cat)
[docs]
def download_stations(self):
"""Copy the default inventory to a directory."""
inv = obspy.read_inventory()
path = Path(self.station_path) / "inventory.xml"
path.parent.mkdir(exist_ok=True, parents=True)
inv.write(str(path), "stationxml")