Skip to main content

agrigee_lite_client

Thin HTTP client for the agrigee_lite[api] server. Doesn't install Earth Engine, GDAL/PROJ, or DuckDB — it only knows how to build a request, upload/download bytes, and talk to /jobs. See SPECS.md for the full design and the reasoning behind it.

Install

pip install agrigee_lite_client

One fixed dependency set, always — geopolars, shapely, and httpx. There's no install variation (no [async], [shapely], etc. extras): the same install already covers both sync and async use.

Quickstart — sync

from agrigee_lite_client import AgriGEEClient
from shapely.geometry import Polygon

geometry = Polygon([(-56.42, -11.20), (-56.41, -11.20), (-56.41, -11.19)])

with AgriGEEClient("http://192.168.3.204:8100") as client:
    # a single geometry — naive: internally becomes a 1-row multiple_sits
    df = client.get.sits(geometry, "2023-01-01", "2023-06-01", satellite="Sentinel2")

    # multiple geometries — uploads a GeoParquet, polls the job, downloads the result parquet
    import polars as pl
    from agrigee_lite_client._geoparquet import encode_geometries

    gdf = pl.DataFrame({
        "start_date": ["2023-01-01", "2023-01-01"],
        "end_date": ["2023-06-01", "2023-06-01"],
        "geometry": encode_geometries([geometry, geometry]),
    })
    df = client.get.multiple_sits(gdf, satellite="Sentinel2", reducers=["mean", "std"])

    # geopandas.GeoDataFrame also works (geopandas is optional — only
    # imported if you actually pass one; it's not installed alongside the client)
    import geopandas as gpd

    gdf_geopandas = gpd.GeoDataFrame(
        {"start_date": ["2023-01-01"], "end_date": ["2023-06-01"]},
        geometry=[geometry],
        crs="EPSG:4326",
    )
    df = client.get.multiple_sits(gdf_geopandas, satellite="Sentinel2")

    # image — returns an in-memory zipfile.ZipFile, nothing decoded
    zf = client.get.image(geometry, "2023-01-01", "2023-06-01", satellite="Sentinel2")
    zf.extractall("out/")

Quickstart — async

Same surface, AsyncAgriGEEClient:

import asyncio
from agrigee_lite_client import AsyncAgriGEEClient

async def main():
    async with AsyncAgriGEEClient("http://192.168.3.204:8100") as client:
        df = await client.get.sits(geometry, "2023-01-01", "2023-06-01", satellite="Sentinel2")

asyncio.run(main())

Validation before anything leaves your machine

sits()/multiple_sits() check that the requested dates actually intersect the satellite's operating period — the same check the server does — and drop (with a warning) rows that don't, raising ValueError if none are left. All of this happens before building the GeoParquet or opening a connection, using a static table embedded in the client (no network call). An unknown satellite name is also caught here (AgriGEEUnknownSatelliteError).

Since that table is a copy of what the server knows, the client checks that it's running against the same server version (via GET /version) before trusting it — a mismatch raises AgriGEEVersionMismatchError instead of validating against possibly stale data.

What this client does NOT do (on purpose)

  • No CRS reprojection — input geometries must be in WGS84 (EPSG:4326 / OGC:CRS84). If you pass a geopandas.GeoDataFrame with a different CRS, the client rejects it with a clear error instead of reprojecting.
  • No local caching, no sophisticated retry/backoff — the cache already lives on the server; the only "retry" here is httpx's transport timeout and a simple poll loop against GET /jobs/{id}.
  • No image decoding — get.image(...) returns a raw zipfile.ZipFile, no numpy/tifffile/rasterio.
  • get.sits(...) isn't a separate fast path: it's sugar over get.multiple_sits(...) with a single row, so it pays the job+poll+ download cost even for one geometry. See SPECS.md §6.

Versioning

This package's version always matches agrigee_lite's (the server), same commit — they aren't versioned independently. A test (tests/test_version_matches_server.py) enforces this in CI.

Development

cd agrigee_lite_client
pip install -e ".[dev]"
pytest
ruff check .

tests/test_client_against_live_api.py only runs if AGRIGEE_TEST_API_URL is set — the rest (test_client_mocked.py, test_async_client_mocked.py) use httpx.MockTransport and need no network.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agrigee_lite_client-3.4.1.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

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

agrigee_lite_client-3.4.1-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file agrigee_lite_client-3.4.1.tar.gz.

File metadata

  • Download URL: agrigee_lite_client-3.4.1.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for agrigee_lite_client-3.4.1.tar.gz
Algorithm Hash digest
SHA256 92974787afaab455429280abce92048c9d82a27265080bc9e598a3653fcba42b
MD5 87286cc855e1d4e01bec87c0b35096d6
BLAKE2b-256 19d0ed6b9b2d246d123449403e3639904fa4965b65bc1dd36464806f6ee9b42f

See more details on using hashes here.

File details

Details for the file agrigee_lite_client-3.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for agrigee_lite_client-3.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ffa29423d111b7d745b1ac0dcfd0a06b32cf27acc2c9dc0b8f17e271bfdeacf1
MD5 4d8898ffd59d01098f93d6feec858c76
BLAKE2b-256 6d943838326ae6f0481711d3555ca714b5bae441a6dc7afdb2ce8289ad40ed7f

See more details on using hashes here.

Release history Release notifications | RSS feed

3.4.3

2 files

3.4.2

2 files

This release

3.4.1 This release

2 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