Skip to main content

Meru SDK

One API for Earth observation. Name a place, a date, and what you want.

pip install merulabs
export MERU_BASE_URL=https://app.merulabs.space   # the hosted API; see below
export MERU_API_KEY=meru_sk_...                   # create one in the dashboard's API panel

The package is merulabs on PyPI; the import and the command are both meru (import meru, meru --help).

MERU_BASE_URL is not set for you. If you leave it unset the SDK talks to http://127.0.0.1:8088, a local development server, and a call fails with a connection error. Set it to https://app.merulabs.space for the hosted API, or pass base_url=.

The SDK is free and open source (Apache-2.0). The hosted API needs an API key from MERU Labs: sign up at https://app.merulabs.space.

import meru

r = meru.get("ndvi", region="Gujarat, India", date="2026-06")
print(r.stats)        # {'mean': 0.62, 'min': -0.11, 'max': 0.89, 'valid_pct': 0.94}
print(r.tiles_url)    # XYZ tile template — drop into any map

# any data type, any source — see what's available:
meru.catalog()       # [{'source': 'sentinel-2', 'products': [...]}, ...]
meru.get("backscatter", region="Sundarbans", source="sentinel-1-rtc")
meru.get("landcover", aoi=[72.5, 22.9, 72.7, 23.1])

date accepts 'YYYY-MM', 'YYYY-MM-DD', 'start/end', or nothing (the last 100 days). Pass region= for a place name or aoi=[west, south, east, north] for a box. Both base_url= and api_key= can be given per call instead of via the environment.

What else a recipe can do

r = meru.get("ndvi", region="Nashik, India", date="2026-05")

r.series()                       # value over time, one point per scene
r.series(max_points=30)          # the whole timeline, not the default 12-point sample

r.download("tif", path="ndvi.tif")     # GeoTIFF of the real values (float NDVI, °C, dB…)
r.download("png", i=3)                 # the colorized image, scene 3 of the timeline
r.download_all("png", path="all.zip")  # every scene, one file per date

r.map_tiles_url()                # tiles URL a browser map can load by itself

Each series() point carries its index into the timeline, so it lines up with download(i=...).

Tiles in a map

r.tiles_url is authenticated by header, which a map library cannot send — Leaflet and Mapbox GL fetch tiles as images. r.map_tiles_url() asks the API for a short-lived token scoped to that one recipe and returns a URL that carries it:

tiles = r.map_tiles_url(ttl_seconds=3600)
# L.tileLayer(tiles).addTo(map)

The token expires, works only on that recipe's tiles, and is not a credential anywhere else — so it is safe in a page in a way the API key would not be.

Datasets

Bring your own data into your organisation's Datasphere. These need a key minted inside an organisation (the dashboard's API keys page); the zero-setup self-serve key belongs to none, so meru datasets never mints one and tells you so.

meru datasets upload fields.zip --terms owned --personal-data no [--name N] [--note TEXT]
meru datasets list [--before ds_…] [--json]
meru datasets show ds_…  [--json]
meru datasets confirm ds_… --layer fields/f.shp --crs EPSG:32643
meru datasets object-set ds_… [--layer x.gpkg::fields]
meru datasets download ds_… [--file original|cog|vectors] [--layer L0] [--out PATH]
meru datasets delete ds_…

--terms (owned, licensed or open) and --personal-data yes|no are required on upload; there is no default for either. upload sends the file straight to storage in parts, then polls until intake reaches a final status and prints the report. A coordinate system intake could not find is never guessed: the dataset waits in needs_confirmation until confirm names one. object-set turns a polygon layer into an obj_… handle that meru table accepts.

A layer has two names, and show prints both. Its key is the path inside the upload (fields/f.shp, or x.gpkg::fields for one of several layers in a file); confirm and object-set take it. Its output is L0, L1, …; download --layer takes that.

d = meru.upload_dataset("fields.zip", terms="owned", personal_data=False)
d["status"]                                   # 'ready' | 'needs_confirmation' | 'rejected' | …
meru.confirm_dataset(d["id"], {"fields/f.shp": "EPSG:32643"})   # the layer key
obj = meru.dataset_object_set(d["id"], layer="fields/f.shp")     # then meru.table(…) with obj["id"]
path = meru.download_dataset(d["id"], file="original", path="fields.zip")
Function Returns
upload_dataset(path, *, terms, personal_data, name=None, note=None, wait=True, poll=3.0, timeout=None) the dataset with its intake report (wait=False: the queued dataset)
datasets(before=None) {"datasets": […], "storage": {"used", "limit"}, "next"}
dataset(dataset_id) one dataset, with its report
wait_for_dataset(dataset_id, poll=3.0, timeout=None) the dataset once its status is final
confirm_dataset(dataset_id, crs) the dataset, re-queued; crs is {"<layer key>": "EPSG:…"}
dataset_object_set(dataset_id, layer=None) the object-set manifest; layer is a layer key, needed when several can convert
download_dataset(dataset_id, file="original", layer=None, path=None) layer is an output stem (L0). The path it wrote, not bytes: streamed to disk, and an existing file is refused
delete_dataset(dataset_id) None

Every function also takes base_url= and api_key=.

Starting an upload and finishing one each count against your organisation's compute rate limit (20 a minute by default), so a batch runs at about ten files a minute. A batch script should catch rate_limited on upload_dataset and wait e.retry_after. Finishing is the one step that waits by itself: by then every part is stored, so it waits rather than throwing the upload away.

Errors

Everything raises, and every exception descends from meru.MeruError:

try:
    r = meru.get("ndvi", region="Reykjavík", date="2026-01")
except meru.NoDataError as e:
    # valid request, nothing published for it
    print(e.reason)           # 'too_cloudy' | 'out_of_range' | 'no_coverage'
    print(e.suggested_time)   # a window that would resolve, when we can name one
    r = meru.get("ndvi", region="Reykjavík", date=e.suggested_time)
except meru.MeruAPIError as e:
    # the API refused the request; e.detail is its own explanation
    print(e.status, e.detail)
    if e.code == "rate_limited":
        time.sleep(e.retry_after)
    elif e.code in ("allowance_exhausted", "spend_cap_reached", "pilot_units_exhausted"):
        raise                 # 402: nothing ran, nothing was charged
except meru.MeruConnectionError:
    # the API could not be reached — check MERU_BASE_URL
    raise

e.code is set only where a client is expected to branch on it (rate_limited, and the 402s allowance_exhausted, spend_cap_reached, pilot_units_exhausted; quota_exceeded is retired); e.detail is prose meant for a person and may be reworded.

meru.billing() returns your plan, units used, allowance, remaining, reset time and, on pay-as-you-go, the estimated charge (GET /v1/billing). meru usage prints the same.

Notes

Stdlib-only, no dependencies. Place names are geocoded through the API rather than straight to OpenStreetMap, so a region means the same thing here as on the dashboard. A cold resolve reads live from remote COGs and can take a minute — MERU_TIMEOUT (seconds, default 180) or timeout= per call.

Without MERU_BASE_URL (or base_url=), the SDK uses http://127.0.0.1:8088, a local development server. The CLI also reuses the base URL it stored the first time it minted a key.

Metadata

Release files for merulabs 0.3.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 merulabs 0.3.0
File Size Uploaded Provenance Actions
merulabs-0.3.0.tar.gz 47.2 kB Without provenance Details for merulabs-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 92.8 kB

Release files / merulabs-0.3.0.tar.gz

Download URL merulabs-0.3.0.tar.gz
Size 47.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4a96aeed9054d26090c1cf24b15baa2c4d4bd85e118e90d12f1c1a1ad0bea86a
BLAKE2b-256 checksum
How to use checksums
d9f5f630905d5052c7cdbdeb0c4a9adf87f3049110cc141c7bcc50160fcc31d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / merulabs-0.3.0-py3-none-any.whl

Download URL merulabs-0.3.0-py3-none-any.whl
Size 45.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8dea4c841a17bf43279984f06f1cd1d5f64d3b796fa746a93950317ab8b78d38
BLAKE2b-256 checksum
How to use checksums
8afb4e124715f6d314a42a6f3bd1cc463151146897e9bf9672422c67d51bb065
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for merulabs 0.3.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

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