Skip to main content

insitukit

Python License: MIT

Fetch, summarise and publish in situ ocean observations: NOAA CO-OPS and ERDDAP clients, record statistics, and a compact JSON time-series format.

forcingkit prepares what drives a coastal model and topobathykit builds the ground it runs on; insitukit handles what the instruments in the water actually measured. It reads tide gauges and buoys from NOAA CO-OPS and any ERDDAP server with care for the provider: requests are paced, budgeted and identified, and an empty window is an empty result, not an error. It reduces long records to the summaries people read: daily means only where a day is at least half covered, exceedance curves, joint histograms, and marine heatwave climatologies after Hobday et al. (2016). And it writes them as small JSON series behind a guard that refuses unexpected object names or sizes, so a web page can draw years of data from a few files.

Install

pip install insitukit            # CO-OPS, ERDDAP, statistics, the JSON form, local and Workers KV storage
pip install "insitukit[gcs]"     # also Google Cloud Storage

Use

from datetime import datetime, timezone

import insitukit
from insitukit import coops, series, stats
from insitukit.erddap import Erddap

insitukit.identify("my-site/1.0 (+https://example.org; data@example.org)", application="my-site")

start, end = datetime(2026, 10, 1, tzinfo=timezone.utc), datetime(2026, 11, 1, tzinfo=timezone.utc)

# Observed water level and the station's own predictions; their difference is the surge.
level = coops.fetch("water_level", "8419870", start, end).set_index("time")["water_level"]
surge = level - coops.predictions("8419870", start, end).reindex(level.index)

# A buoy's temperature from an ERDDAP server, at most 20 requests this run.
server = Erddap("https://data.neracoos.org/erddap", budget=20)
temp = server.fetch("UNH_CML", start, end, ["temperature"]).set_index("time")["temperature"]

daily = stats.day_means(temp, per_day=24, digits=2, tz="America/New_York")
hourly = series.encode(surge.resample("h").mean(), unit="m", places=3)  # {"t0": ..., "step": 3600, ...}

Modules

Module Contents
insitukit.coops fetch (observations, including currents by bin; long windows split to the API's limits), predictions (6-minute or hourly tides), tide_events (highs and lows), current_predictions (speed along the flood axis, or MAX_SLACK events), and station metadata: metadata, datums, flood_levels, harcon, stations. DatumUnavailable when a station lacks the datum asked for. Metric units (current speeds in m/s) and UTC, with English units where the API offers them.
insitukit.erddap Erddap(base_url, budget, min_interval, retries, timeout): tabledap CSV into a DataFrame, variables of a dataset, and get for any other query, with a per-run request budget (or none), an unreachable flag and DatasetMissing.
insitukit.stats day_means (coverage rule), exceedance, joint (two series paired by nearest time), climatology (Hobday et al. 2016: 11-day window, 31-day smoothing, mean, SD, 90th percentile).
insitukit.series encode and decode for one series, encode_frame and decode_frame for several on one grid, iso.
insitukit.store Store(root, writable, max_bytes): JSON and bytes to a directory, kv://<account>/<namespace> (Cloudflare Workers KV, token in CLOUDFLARE_API_TOKEN) or gs://bucket/prefix, refusing names outside writable and objects over max_bytes.

Etiquette

CO-OPS requests are at least 1 s apart (across threads), and 403 and 429 answers are treated as throttling and retried with backoff. ERDDAP requests are at least min_interval apart and stop at the run's budget. Both send the User-Agent given to identify; include a way for the provider to reach you.

Reference

Hobday, A. J., et al. (2016). A hierarchical approach to defining marine heatwaves. Progress in Oceanography, 141, 227-238. doi:10.1016/j.pocean.2015.12.014

License

MIT. Copyright (c) 2026 Long Horizon Observatory.

Metadata

Release files for insitukit 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 insitukit 0.2.0
File Size Uploaded Provenance Actions
insitukit-0.2.0.tar.gz 92.0 kB With provenance Details for insitukit-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 111.5 kB

Release files / insitukit-0.2.0.tar.gz

Download URL insitukit-0.2.0.tar.gz
Size 92.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4512cf3e7d829de87da305c4f19a78cca711a64c4f04c7d47a7960f9bd168045
BLAKE2b-256 checksum
How to use checksums
fb61423e9c96684ca33c2b68c4bd397f0c04c56ceb7f46bebbb3d885f97a8f1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / insitukit-0.2.0-py3-none-any.whl

Download URL insitukit-0.2.0-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e081b5996096b7e70ff37594e244dedff4d6345a4a8c4d72c0ec8036f3f09959
BLAKE2b-256 checksum
How to use checksums
c1c1909423b4f2f428e7ca2f6e49228a0585637b921d7c569f4f9fbdb3896ac8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for insitukit 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for insitukit-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

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