技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
formats-and-metadata【数据与研究】Choose, validate, convert, and inspect ObsPy waveform, event, and station-metadata formats while preserving metadata and reporting format-specific limits.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when a task is about file-format dispatch, waveform serialization,
MiniSEED/SAC/ASCII conversion, QuakeML events, StationXML inventories, RESP or
SEED/XSEED metadata, format validation, or ObsPy format command-line tools.
Keep generic filtering, trimming, merging, and other Stream transforms in
waveform-processing; keep FDSN/routing retrieval in data-access; keep
response removal and signal algorithms in signal-analysis.
format= when an extension is ambiguous, absent, or
misleading. A supplied format disables further waveform format checking.| Input | Read | Write | Explicit format examples |
|---|---|---|---|
| Waveform | obspy.read(path, format=...) | Stream.write(path, format=...) or Trace.write | MSEED, SAC, SLIST, TSPAIR, GSE2, WAV |
| Events | obspy.read_events(path, format=...) | Catalog.write(path, format=...) | QUAKEML, SCML, NDK, CMTSOLUTION, CSV |
| Inventory | obspy.read_inventory(path, format=..., level=...) | Inventory.write(path, format=...) | STATIONXML, RESP, XSEED, SEED |
read() accepts a path, pathlib.Path, URL, or open file-like object and
supports headonly, starttime, endtime, dtype, apply_calib, and
check_compression. Stream.write() can infer a format from the extension,
but explicit format is safer. Catalog.write() and Inventory.write() require
a format. Use level="network", "station", "channel", or "response"
when reading an inventory to control detail and cost.
The plugin registry determines the supported names and read/write directions; read and write support are not symmetric. See format-matrix.md. Do not infer support merely from a filename extension.
read(..., headonly=True) for waveforms), and record the
source format, target format, required metadata, and validation method.format="MSEED", format="STATIONXML",
format="QUAKEML", format="RESP", or another registered name when
dispatch is uncertain. For multiple waveform files, a glob may produce one
Stream; inspect each trace.tr.id, tr.stats.starttime,
endtime, sampling_rate, npts, dataquality, and format-specific
stats.mseed/stats.sac/stats.ascii. For inventories traverse
inv -> network -> station -> channel -> response; for catalogs inspect
event IDs, origins, magnitudes, picks, and extra.encoding and reclen; ensure the
data dtype is compatible. For XML, use validate=True where supported and
optionally nsmap for declared custom namespaces.For a deterministic tiny local check, use the bundled
format_roundtrip.py. It creates its own
small files in a caller-selected directory, refuses to overwrite by default,
and can test waveform, QuakeML, and StationXML round trips.
Inventory.select() can scope an output before
writing. level="response" retains response detail; lower levels intentionally
omit it. RESP and SEED/XSEED are response/station metadata formats and may
require the xseed parser and lxml.Catalog contains Event objects with Origin, Magnitude, picks, and
related objects. Formats such as NDK, CMTSOLUTION, CSV, or legacy bulletins
represent different subsets; validate and compare the fields relevant to the
task..extra mapping. Each entry uses value and namespace, with
optional type="attribute" and attrib; nested mappings are supported.
Pass nsmap={prefix: namespace} to XML writers for stable readable prefixes.
Values read back from XML are text strings, so normalize types explicitly.
See event-inventory.md.Use validate=True when writing QuakeML or StationXML. For an existing file,
use the public validation helpers where available: StationXML validation
returns (valid, errors) and QuakeML validation returns a boolean; inspect the
error log rather than suppressing it. A successful parse is not proof that all
optional metadata survived.
For local inspection, obspy-print reports waveform headers and can print
merged gaps; obspy-mseed-recordanalyzer reports MiniSEED record headers;
obspy-dataless2xseed, obspy-xseed2dataless, and obspy-dataless2resp are
conversion tools. Their options and safe output behavior are summarized in
cli-reference.md. The installed package may
expose these only after its console scripts are installed; if a command is not
on PATH, use the equivalent Python API or report the environment limitation.
Before declaring a conversion complete, report: