Skip to main content

A library which stores, loads and filters time-series-events and catalogues.

Project description

tscat — Time Series Catalogues

Test Status Coverage Status

tscat is a Python library for managing catalogues of time intervals (events). It is the catalogue backend for SciQLop and is designed for space physics workflows — storing event lists such as magnetopause crossings, ICMEs, or any user-defined intervals with arbitrary metadata.

Events are persisted in a local SQLite database. No server required.

Installation

pip install tscat

Quick start

from datetime import datetime
from tscat import create_event, create_catalogue, add_events_to_catalogue, save

catalogue = create_catalogue("Bow shock crossings", author="Alice",
                             tags=["MMS", "bow_shock"])

events = [
    create_event(datetime(2023, 1, 1, 10, 0), datetime(2023, 1, 1, 10, 30),
                 author="Alice", tags=["inbound"], Bz_max=12.5),
    create_event(datetime(2023, 1, 3, 14, 0), datetime(2023, 1, 3, 14, 45),
                 author="Alice", tags=["outbound"], Bz_max=8.3),
]

add_events_to_catalogue(catalogue, events)
save()

Any keyword argument beyond the fixed fields (start, stop, author, tags, products, rating) becomes a custom attribute stored alongside the event.

Filtering

Retrieve events matching conditions using a natural Python DSL:

from tscat import get_events
from tscat.filtering import event, In, Field

# Events after a date
get_events(event.start >= datetime(2023, 1, 2))

# Combine predicates with &, |, ~
get_events((event.author == "Alice") & In("inbound", Field("tags")))

# Filter on custom attributes
get_events(event.Bz_max > 10.0)

Dynamic catalogues

A catalogue with a predicate automatically includes all matching events:

from tscat import create_catalogue
from tscat.filtering import event

dynamic = create_catalogue(
    "High Bz events", author="Alice",
    predicate=event.Bz_max > 10.0,
)

Import / export

Share catalogues as JSON or VOTable (AMDA-compatible):

from tscat import export_json, import_json, export_votable_str

json_str = export_json(catalogue)
import_json(json_str)  # into another database

Documentation

Full usage guide: docs/usage.rst

Development

This project uses uv:

uv sync --extra test
uv run pytest
uv run flake8 tscat tests

License

GNU General Public License v3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tscat-0.5.1.tar.gz (58.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tscat-0.5.1-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

Details for the file tscat-0.5.1.tar.gz.

File metadata

  • Download URL: tscat-0.5.1.tar.gz
  • Upload date:
  • Size: 58.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tscat-0.5.1.tar.gz
Algorithm Hash digest
SHA256 1f7fb6750c05534f042542c754f5a6d5e92b38b184891e7c37952c593e9e8b5e
MD5 4949ba9206ba921d8a5a4bd345c76388
BLAKE2b-256 bde06629b9cee90954670bc093dc89922f93cb7c3f6b4776d3755c4fadf3e0f8

See more details on using hashes here.

File details

Details for the file tscat-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: tscat-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 31.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tscat-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5604b084c3f59a3fefbb20683403b87f03de42b635c95179f5fae31cce012c0e
MD5 8ab15841a3cea7e06e593854c6add90a
BLAKE2b-256 ae3c60c1b465f3cc4422284b01ce3c49a5a550aea96b896eca4bb9c1652b75c7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page