Skip to main content

atproto-sensorthings

Flatten a dev.sensorthings ATProto repo export into tidy, geo-referenced tables for analysis.

Sensor networks on sensorthings.dev publish their observations to an ATProto repository. You can download that repository as a single CAR file (from sensorthings.dev/yourdata, or via com.atproto.sync.getRepo). This package turns that CAR into three tables:

Table One row per Geometry
stations Thing (station) station point
datastreams Datastream station point
observations reading (long / tidy) station point, or the observed position for a GPS fix

Everything is derived from the CAR: no network access, no repo checkout, and the lexicons are not needed at runtime.

Install

The base install (parsing, the summary, and CSV output) depends only on atproto and click. Install as a command-line tool:

uv tool install atproto-sensorthings         # or: pipx install atproto-sensorthings

or add it to a project as a library:

uv add atproto-sensorthings                  # or: pip install atproto-sensorthings

GeoDataFrame and GeoJSON output need the geo extra (geopandas / shapely / pandas); GeoParquet also needs parquet:

uv add "atproto-sensorthings[geo]"           # or: pip install "atproto-sensorthings[geo]"
uv add "atproto-sensorthings[geo,parquet]"   # or: pip install "atproto-sensorthings[geo,parquet]"

Command line

# record counts and reading time span
atproto-sensorthings summary export.car

# write stations.csv, datastreams.csv, observations.csv to ./sensorthings_export
atproto-sensorthings flatten export.car

# GeoJSON (needs the geo extra); one layer at a time is also supported
atproto-sensorthings flatten export.car --format geojson --out export
atproto-sensorthings flatten export.car --format geoparquet --layer observations

CSV rows carry longitude / latitude columns, so they load as points in any GIS without the geo extra.

Library

import atproto_sensorthings as ast

repo = ast.read_car("export.car")

# pure core: plain dicts, streamed; no geopandas required
for row in ast.observation_rows(repo):
    ...

# with the geo extra: GeoDataFrames (imported lazily on first use)
stations = ast.stations_gdf(repo)        # 1 row / station
observations = ast.observations_gdf(repo)  # 1 row / reading, sorted, typed

Data notes

  • Coordinates are decoded from the lexicon's integer latE7 / lonE7 (degrees times 1e7) to WGS84 degrees; altitude from altMm to metres. Exactly (0, 0) is a placeholder that some sources publish for a station without coordinates: it decodes to no position (null longitude and latitude, no geometry). A zero latitude or longitude alone is a position.
  • Numeric results are scaled integers: the real value is value * 10**-resultScaleFactor, applied automatically. In the observations table, value holds the decoded native result (float, string, boolean or list) and value_num is a nullable float for the numeric and boolean cases.
  • Result types covered: numeric, category, boolean, array, geoPoint.
  • Record types covered: observationBatch, observationFrame, observation and multiObservation, so every network's export flattens the same way.
  • Frames hold each collector tick's new or changed readings until the day is sealed into observationBatch records, about two days later. A reading can be in both; it appears once, with the value from the latest frame.
  • The whole export is read into memory; for the largest agency repositories prefer GeoParquet output over GeoJSON.

Licence

MIT. See LICENSE.

Metadata

Release files for atproto-sensorthings 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for atproto-sensorthings 0.2.1
File Size Uploaded Provenance Actions
atproto_sensorthings-0.2.1.tar.gz 13.9 kB Without provenance Details for atproto_sensorthings-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for atproto-sensorthings 0.2.1
File Interpreter ABI Platform Actions
atproto_sensorthings-0.2.1-py3-none-any.whl Python 3 none any Details for atproto_sensorthings-0.2.1-py3-none-any.whl

Total release size: 27.0 kB

Release files / atproto_sensorthings-0.2.1.tar.gz

Download URL atproto_sensorthings-0.2.1.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f7a2c7247c6d877e3b3c138f7ce1bb04dfe38a3cd6146424fcf43fd856cb7e60
BLAKE2b-256 checksum
How to use checksums
84ed6a525559e91d35eb37d0b87e55233e992f9f937ea8dbe1d8e98af3e683b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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}

Release files / atproto_sensorthings-0.2.1-py3-none-any.whl

Download URL atproto_sensorthings-0.2.1-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a71d6f33e920925b38315d4d628bad2dd4ff04100941243fa0c2224f547a81a9
BLAKE2b-256 checksum
How to use checksums
d3678a745a159f7962bf599087b2f872fef899b1b3dceac7c3e8e36fa792f814
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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}

Security for atproto-sensorthings 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page