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.
  • 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.0

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.0
File Size Uploaded
atproto_sensorthings-0.2.0.tar.gz 13.6 kB Details

Built distribution (wheel)

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

Total release size: 26.5 kB

Release files / atproto_sensorthings-0.2.0.tar.gz

Download URL atproto_sensorthings-0.2.0.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a5658dfe463038471b1f75d020f718c1a9c5647949ebe0ca056911c4c445e6ea
BLAKE2b-256 checksum
How to use checksums
88fb3dc3da9054e81f83ff185eb23108d17638914f3fced33f59608828c5e41b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.0-py3-none-any.whl

Download URL atproto_sensorthings-0.2.0-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
015d2ae9648b09de978dca184fdd078a9efdb59f0d4f2f28c357bfc0640105c9
BLAKE2b-256 checksum
How to use checksums
5ec99673c4bae0c3d12676866f5d1b2b2aad30528f4d98716578cf37b36881c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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 history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

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