Skip to content

API reference

Everything below is generated from the source, so it is always in step with the installed version.

The public surface is small. Almost everything is reachable from one object:

from datamermaid import MermaidClient

with MermaidClient() as client:
    ...
Page What is in it
Client MermaidClient, the base URL constants and the transport helpers
Authentication The Auth seam, API keys, the OAuth grants, the token cache
Resources One wrapper per endpoint group, including the project handle, the aggregated views and the zonal statistics endpoints
Models The frozen dataclasses records are parsed into
Pagination PaginatedList and the DataFrame export
Batches Batch, one request per area of interest on a thread pool
Geometry to_aoi, which turns a Site, a shapely geometry or a tuple into the GeoJSON the Zonal Stats service accepts
Exceptions The MermaidError hierarchy

Package

Python SDK for the MERMAID coral reef monitoring API.

Every endpoint is reached through MermaidClient, and every list route answers with a lazy, filterable collection that can be exported to a DataFrame.

Example
from datamermaid import MermaidClient

with MermaidClient(api_key="mmd_abc.def") as client:
    print(client.me().full_name)
    for project in client.projects.list():
        print(project.name, project.num_sites)

Without an API key, log in through the browser once and the token is reused by every later client:

import datamermaid

datamermaid.login()
with datamermaid.MermaidClient() as client:
    print(client.me().full_name)

See the guides at https://data-mermaid.github.io/py-datamermaid/ for the rest.

Everything named in datamermaid.__all__ is importable straight from the package, whatever module it is defined in:

from datamermaid import APIKeyAuth, MermaidClient, NotFoundError, Project, login

The version is available as datamermaid.__version__.