Skip to main content

collekt

A library to facilitate spatio-temporal data collection across arbitrary datasources.

A dataset config names the products to fetch, and a request supplies the region, time window, and metadata. The selected products are fanned out to pluggable source adapters. Each adapter fetches source-native files (NetCDF, GRIB2, Parquet, product archives) and records what it did in a machine-readable manifest. Gridded results can then be assembled onto a common grid and time axis.

Installation

Requires Python 3.13+ and uv.

git clone https://github.com/ai4copsec/collekt.git
cd collekt
uv sync --all-groups  # or: just install

All provider clients and the gridded Assembler are installed by default, so every source works out of the box. Clients are imported lazily, so importing collekt stays fast.

To build the documentation locally, you will also need the quarto binary (quarto.org):

just docs
# or :
uv run quartodoc build --config docs/_quarto.yml
quarto render docs

We recommend using just (https://github.com/casey/just) with the make-like commands available in justfile.

Usage

Python

import collekt

config = collekt.DatasetConfig(
    collekt.CMEMS("cmems_glorys_my", variables=["uo", "vo"], depth=[1.0, 1.1]),
    collekt.CMEMS("cmems_duacs_my", variables=["ugos", "vgos"]),
    collekt.CMEMS("cmems_med_currents_my", variables=["uo", "vo"], depth=[1.0, 1.1]),
)
request = collekt.Request(
    region=collekt.Region.from_bbox((-6.0, 20.0, 35.0, 45.0)),
    start="2023-06-15",
)

fetcher = collekt.Fetcher(request=request, config=config, output_dir="data/collections")
result = fetcher.download()
print(result.manifest_path)

# Assemble gridded sources onto a common grid and time axis.
assembler = collekt.Assembler(result)
dataset = assembler.to_xarray(grid="lowest_resolution", time="lowest_resolution")

Region can also be built from a point and radius (Region.from_point_radius(lat, lon, radius_km)) or a GeoJSON file (Region.from_geojson(path)).

Command line

collekt config show       # inspect the bundled catalog
collekt doctor            # check the environment and configuration

cat > datasets.yaml <<'YAML'
datasets:
  - provider: cmems
    key: cmems_glorys_my
    variables: [uo, vo]
    depth: [1.0, 1.1]
  - provider: cmems
    key: cmems_duacs_my
    variables: [ugos, vgos]
  - provider: cmems
    key: cmems_med_currents_my
    variables: [uo, vo]
    depth: [1.0, 1.1]
YAML

collekt fetch --bbox -6 20 35 45 --start 2023-06-15 \
  --dataset-config datasets.yaml --output-dir data/collections

Use --dry-run to plan provider requests without downloading, and --strict to fail if any requested source is skipped.

Sources and configuration

collekt ships a curated catalog of datasets (CMEMS global + Mediterranean, ECMWF Open Data, ERA5, Skytruth, Copernicus Data Space, eOdyn). Select concrete dataset keys with DatasetConfig or its YAML form, and put provider parameters such as variable names and depth ranges directly on each selected dataset. See Products and Credentials.

Development

just lint    # format + lint with ruff
just test    # run the test suite
just docs    # build the Quarto documentation

The definition of done for any change: just lint and just test pass, with a test for any behavior changed.

Documentation

Built with Quarto and quartodoc from docs/; the rendered site is published to GitHub Pages.

License

BSD-3-Clause.

Copyright

Copyright (c) 2023-2026 Simula Research Laboratory, Oslo, Norway.

Acknowledgments

Part of the EU project AI4COPSEC, funded by the Horizon Europe framework programme under Grant Agreement N. 101190021.

Metadata

Release files for collekt 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 collekt 0.2.1
File Size Uploaded
collekt-0.2.1.tar.gz 68.8 kB Details

Built distribution (wheel)

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

Total release size: 165.8 kB

Release files / collekt-0.2.1.tar.gz

Download URL collekt-0.2.1.tar.gz
Size 68.8 kB
Tags Source
SHA-256 checksum
How to use checksums
340f59fb9fcdafe7dbafeef8051ee36b20fc172d1110e9db373b88509ac49da1
BLAKE2b-256 checksum
How to use checksums
49539e3fdaf3296c5990abeb55bd16c1cf81570cf61212070c99020d083f7d67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","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 / collekt-0.2.1-py3-none-any.whl

Download URL collekt-0.2.1-py3-none-any.whl
Size 97.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f674d69a9f7f80d387736c227a9512b35d34be9614bbdd4bba1886529e4f20c6
BLAKE2b-256 checksum
How to use checksums
03dfa1755118001a67c9c5037e56256d34c3bcd68bf709036cd1b536ce103a3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","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.1 This release

2 release files

0.2.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