Skip to main content

Python SDK for the Sondio data platform — energy and environmental data as pandas DataFrames.

Project description

sondio

Python SDK for the Sondio data platform. Energy and environmental data as pandas DataFrames.

pip install sondio              # core
pip install 'sondio[geo]'       # adds geopandas for boundary polygons

Quickstart

import sondio

sondio.api_key = "sk_sondio_..."  # or set SONDIO_API_KEY

# Vertical-rule datasets — country is a parameter, not a prefix
wells    = sondio.oilgas.wells(country="US", state="TX", basin="permian")
prod     = sondio.oilgas.production(wells.iloc[0]["external_id"], months=120)
quakes   = sondio.earthquakes(state="TX", min_mag=3.0, days=30)
turbines = sondio.wind_turbines(state="TX", min_year=2020)
rails    = sondio.rail_lines(country="US", state="TX")

# Agency-rule datasets: sondio.<country>.<agency>.<resource>
ae     = sondio.us.epa.aquifer_exemptions(state="TX")
ghg    = sondio.us.ghg.facilities(state="TX")
pl     = sondio.us.phmsa.pipeline_incidents(state="TX")
npdes  = sondio.us.npdes.permits(state="TX")
svi    = sondio.us.cdc.svi_tracts(state="LA", min_rpl=0.9)

# Geographic reference data
states = sondio.geo.subdivisions(country="US")
states_geo = sondio.geo.subdivisions(country="US", with_geometry=True)  # GeoDataFrame

Every call returns a pandas.DataFrame — or a geopandas.GeoDataFrame when you ask for geometry.

Configuration

import sondio
sondio.api_key  = "sk_sondio_..."                   # explicit
sondio.base_url = "http://localhost:8791/api/v1"    # dev override

Resolution order: explicit attribute → SONDIO_API_KEY env var → ~/.sondio/config ([default] section, api_key = ...).

Pagination

Opt-in to protect against unintentional 3M-row walks:

# First page only (default). Emits a UserWarning if more pages exist.
wells = sondio.oilgas.wells(country="US", state="TX")

# Full iteration
wells = sondio.oilgas.wells(country="US", state="TX", all_pages=True)

# Specific page
wells = sondio.oilgas.wells(country="US", state="TX", page=3)

Auto-pagination is capped at 500 pages — hitting the cap raises a warning.

Type coercion

Several API columns come back as strings (magnitude, depth_ft, total_co2e). The SDK coerces known numeric/datetime columns per endpoint; unknown columns pass through untouched.

Errors

from sondio import SondioError, SondioAPIError

try:
    sondio.earthquakes()
except SondioAPIError as e:
    print(e.status_code, e.body)
except SondioError as e:
    print("config problem:", e)

Namespace shape

Matches the Sondio dataset naming convention:

Category Shape Example
Vertical-rule sondio.<vertical>.<resource>(country=...) sondio.oilgas.wells(country="US")
Vertical-rule, global sondio.<resource>(...) sondio.earthquakes(...)
Agency-rule sondio.<country>.<agency>.<resource>(...) sondio.us.epa.aquifer_exemptions(...)
Geographic reference sondio.geo.<resource>(...) sondio.geo.subdivisions(...)

License

MIT — see LICENSE.

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

sondio-0.1.1.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

sondio-0.1.1-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file sondio-0.1.1.tar.gz.

File metadata

  • Download URL: sondio-0.1.1.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for sondio-0.1.1.tar.gz
Algorithm Hash digest
SHA256 18c1edf9470ed3db055b645e39cd311f58750fe410a6f22c343c885ea0a1d6bb
MD5 0ad36b6ac19fa71a8ee4a80d169f1cc7
BLAKE2b-256 371cae3a58b003c9dd4d8a1e096e48a90f2aae08331121e599659d2a46d2174b

See more details on using hashes here.

File details

Details for the file sondio-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sondio-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for sondio-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4130abf6a59fda0feae8a2185ac2b91bef2b8718236bac657fe09b69f551e0f9
MD5 90e4ffd692bbae1d3ccace5d8f6c5d3e
BLAKE2b-256 4b7230d45b65d3270fcdebd33992e0d04809598a89ab2504b7ab47894eecf057

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