Schema

class motac.schema.Dataset(events, counts, meta=None)[source]

Bases: object

Canonical dataset bundle used across loaders, models, and evaluation.

Parameters:
  • events (EventTable) – Canonical event table (EventTable). Time is day-resolution.

  • counts (ndarray) – Count tensor. Shape (J, T) or (J, M, T) for marked events.

  • meta (Mapping[str, object] | None) – Free-form metadata (bbox, start_date, grid spec, mark mapping, etc.).

events: EventTable
counts: ndarray
meta: Mapping[str, object] | None
property n_cells: int
property n_steps: int
property n_marks: int | None
__init__(events, counts, meta=None)
motac.schema.Event

alias of EventRecord

class motac.schema.EventRecord(event_id=None, t='1970-01-01', lat=0.0, lon=0.0, cell_id=None, mark=None, value=1, meta=None)[source]

Bases: object

Canonical, dataset-agnostic event record.

This dataclass is the canonical per-event representation used by dataset loaders and conversion utilities.

Notes

  • Time is represented at day resolution.

  • Some workflows assign events into a spatial discretisation (e.g. a grid). When available, loaders can populate cell_id.

event_id: str | None
t: str | datetime64
lat: float
lon: float
cell_id: int | None
mark: str | None
value: int
meta: Mapping[str, Any] | None
__init__(event_id=None, t='1970-01-01', lat=0.0, lon=0.0, cell_id=None, mark=None, value=1, meta=None)
class motac.schema.EventTable(t, lat, lon, value, event_id=None, cell_id=None, mark=None, meta=None)[source]

Bases: object

Columnar representation of many events.

Times are stored as datetime64[D] and values are stored as non-negative integers.

Optional fields (event_id, cell_id, mark, meta) are stored as Python sequences to keep the schema lightweight and loader-friendly.

t: ndarray
lat: ndarray
lon: ndarray
value: ndarray
event_id: Sequence[str | None] | None
cell_id: ndarray | None
mark: Sequence[str | None] | None
meta: Sequence[Mapping[str, Any] | None] | None
property n_events: int
static from_records(records)[source]
Return type:

EventTable

to_records()[source]
Return type:

list[EventRecord]

validate()[source]

Validate this table (raises ValueError if invalid).

Return type:

None

__init__(t, lat, lon, value, event_id=None, cell_id=None, mark=None, meta=None)
motac.schema.validate_event_record(e)[source]

Raise ValueError if an event record is invalid.

Return type:

None

motac.schema.validate_event_table(tbl)[source]

Raise ValueError if an event table is invalid.

Return type:

None