Resources¶
Each endpoint group is a wrapper reached through
MermaidClient or, for the project-scoped
routes, through ProjectContext.
See Working with data and Project data for how
they are used.
Shared plumbing¶
base
¶
Shared plumbing for endpoint wrappers.
Classes:
| Name | Description |
|---|---|
BaseResource |
Anything reachable through the client: a path and a way to request it. |
Resource |
Base class for endpoints returning records of one model. |
ReadOnlyResource |
A read-only endpoint: a paginated list plus a |
Functions:
| Name | Description |
|---|---|
project_path |
Compose |
BaseResource
¶
BaseResource(client: MermaidClient)
Resource
¶
Resource(client: MermaidClient)
Bases: BaseResource, Generic[M]
Base class for endpoints returning records of one model.
Subclasses set path and
model and expose whatever public
methods make sense for the endpoint, built on _list and _get.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
type[M]
|
|
path |
str
|
|
ReadOnlyResource
¶
ReadOnlyResource(client: MermaidClient)
Bases: Resource[M]
A read-only endpoint: a paginated list plus a /<id>/ detail route.
Reference endpoints differ only in their path and model, so they subclass this and declare those two attributes.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
str
|
|
model |
type[M]
|
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
project_path
¶
Compose projects/<project_id>/<route>.
The id is percent-encoded, so a stray / or .. in it cannot send the
request to a different endpoint.
Projects¶
projects
¶
The /projects/ endpoints.
Classes:
| Name | Description |
|---|---|
ProjectsResource |
Read access to MERMAID projects. |
ProjectsResource
¶
ProjectsResource(client: MermaidClient)
Bases: ReadOnlyResource[Project]
Read access to MERMAID projects.
Filters: showall (include projects the credentials are not a member
of), name, country, tags, status.
Calling the resource with a project id (or a
Project) returns a
ProjectContext, the handle
on everything recorded under that project.
Example
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
model |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
Project-scoped collections¶
project_context
¶
The project-scoped endpoints, /projects/{project_id}/....
Call the projects resource with a project id (or a
Project) to get a
ProjectContext, the handle every nested route hangs off:
client.projects(project_id).sites.list()
client.projects(project_id).beltfish_methods.get(method_id)
Each collection behaves exactly like a top-level one: a lazy, filterable
PaginatedList from .list(**filters) and a
single record from .get(id). They differ only in their path, so each is a
ProjectResource declaring its route and model.
The context also carries the aggregated views of
datamermaid.resources.aggregated
(project.beltfishes.observations() and its siblings), which are list-only and answer
with flat rows rather than nested models.
Classes:
| Name | Description |
|---|---|
ProjectResource |
A read-only collection nested under one project. |
ProjectSitesResource |
The project's reef sites ( |
ProjectManagementsResource |
The project's management regimes ( |
ProjectObserversResource |
Who recorded the project's sample unit methods ( |
ProjectProfilesResource |
The project's members and their roles ( |
ProjectSampleEventsResource |
Site-and-date visits the project's sample units belong to ( |
ProjectFishBeltTransectsResource |
The project's fish belt transects ( |
ProjectBenthicTransectsResource |
The project's benthic transects ( |
ProjectBeltFishMethodsResource |
Fish belt surveys with their observations ( |
ProjectBenthicLITMethodsResource |
Benthic LIT surveys with their observations ( |
ProjectBenthicPITMethodsResource |
Benthic PIT surveys with their observations ( |
ProjectBenthicPQTMethodsResource |
Benthic photo quadrat surveys ( |
ProjectHabitatComplexityMethodsResource |
Habitat complexity surveys ( |
ProjectBleachingQCMethodsResource |
Bleaching quadrat collection surveys ( |
ProjectBeltInvertMethodsResource |
Macroinvertebrate belt surveys ( |
ProjectContext |
One project's data, as the collections nested under it. |
Functions:
| Name | Description |
|---|---|
project_path |
Compose |
Attributes:
| Name | Type | Description |
|---|---|---|
PROJECT_RESOURCES |
tuple[tuple[str, type[ProjectResource[Any]]], ...]
|
|
PROJECT_RESOURCES
module-attribute
¶
PROJECT_RESOURCES: tuple[
tuple[str, type[ProjectResource[Any]]], ...
] = (
("sites", ProjectSitesResource),
("managements", ProjectManagementsResource),
("observers", ProjectObserversResource),
("project_profiles", ProjectProfilesResource),
("sample_events", ProjectSampleEventsResource),
(
"fishbelt_transects",
ProjectFishBeltTransectsResource,
),
("benthic_transects", ProjectBenthicTransectsResource),
("beltfish_methods", ProjectBeltFishMethodsResource),
(
"benthiclit_methods",
ProjectBenthicLITMethodsResource,
),
(
"benthicpit_methods",
ProjectBenthicPITMethodsResource,
),
(
"benthicpqt_methods",
ProjectBenthicPQTMethodsResource,
),
(
"habitatcomplexity_methods",
ProjectHabitatComplexityMethodsResource,
),
(
"bleachingqc_methods",
ProjectBleachingQCMethodsResource,
),
(
"beltinvert_methods",
ProjectBeltInvertMethodsResource,
),
)
ProjectResource
¶
ProjectResource(client: MermaidClient, project_id: str)
Bases: ReadOnlyResource[M]
A read-only collection nested under one project.
Subclasses declare route and
model; the project id turns the route
into a path when the resource is built.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
str
|
|
project_id |
|
|
path |
|
|
model |
type[M]
|
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectSitesResource
¶
ProjectSitesResource(
client: MermaidClient, project_id: str
)
Bases: ProjectResource[Site]
The project's reef sites (sites/).
Filters: name, country, reef_type, reef_zone, exposure.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
model |
|
|
path |
|
|
project_id |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectManagementsResource
¶
ProjectManagementsResource(
client: MermaidClient, project_id: str
)
Bases: ProjectResource[Management]
The project's management regimes (managements/).
Filters: name, est_year, parties, compliance and the seven
rule flags (no_take, periodic_closure, ...).
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
model |
|
|
path |
|
|
project_id |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectObserversResource
¶
ProjectObserversResource(
client: MermaidClient, project_id: str
)
Bases: ProjectResource[Observer]
Who recorded the project's sample unit methods (observers/).
Filters: transectmethod, profile, rank.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
model |
|
|
path |
|
|
project_id |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectProfilesResource
¶
ProjectProfilesResource(
client: MermaidClient, project_id: str
)
Bases: ProjectResource[ProjectProfile]
The project's members and their roles (project_profiles/).
Filters: profile, role.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
model |
|
|
path |
|
|
project_id |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectSampleEventsResource
¶
ProjectSampleEventsResource(
client: MermaidClient, project_id: str
)
Bases: ProjectResource[SampleEvent]
Site-and-date visits the project's sample units belong to (sampleevents/).
Filters: site, management and the sample_date range
(sample_date_after / sample_date_before).
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
model |
|
|
path |
|
|
project_id |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectFishBeltTransectsResource
¶
ProjectFishBeltTransectsResource(
client: MermaidClient, project_id: str
)
Bases: ProjectResource[FishBeltTransect]
The project's fish belt transects (fishbelttransects/).
The transects alone, without the observations recorded on them; for those use
ProjectBeltFishMethodsResource. Filters:
sample_event, len_surveyed, width, depth.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
model |
|
|
path |
|
|
project_id |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectBenthicTransectsResource
¶
ProjectBenthicTransectsResource(
client: MermaidClient, project_id: str
)
Bases: ProjectResource[BenthicTransect]
The project's benthic transects (benthictransects/).
Shared by the benthic LIT, benthic PIT and habitat complexity protocols.
Filters: sample_event, len_surveyed, depth.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
model |
|
|
path |
|
|
project_id |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectBeltFishMethodsResource
¶
ProjectBeltFishMethodsResource(
client: MermaidClient, project_id: str
)
Bases: ProjectResource[BeltFishMethod]
Fish belt surveys with their observations (beltfishtransectmethods/).
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
model |
|
|
path |
|
|
project_id |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectBenthicLITMethodsResource
¶
ProjectBenthicLITMethodsResource(
client: MermaidClient, project_id: str
)
Bases: ProjectResource[BenthicLITMethod]
Benthic LIT surveys with their observations (benthiclittransectmethods/).
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
model |
|
|
path |
|
|
project_id |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectBenthicPITMethodsResource
¶
ProjectBenthicPITMethodsResource(
client: MermaidClient, project_id: str
)
Bases: ProjectResource[BenthicPITMethod]
Benthic PIT surveys with their observations (benthicpittransectmethods/).
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
model |
|
|
path |
|
|
project_id |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectBenthicPQTMethodsResource
¶
ProjectBenthicPQTMethodsResource(
client: MermaidClient, project_id: str
)
Bases: ProjectResource[BenthicPhotoQuadratTransectMethod]
Benthic photo quadrat surveys (benthicphotoquadrattransectmethods/).
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
model |
|
|
path |
|
|
project_id |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectHabitatComplexityMethodsResource
¶
ProjectHabitatComplexityMethodsResource(
client: MermaidClient, project_id: str
)
Bases: ProjectResource[HabitatComplexityMethod]
Habitat complexity surveys (habitatcomplexitytransectmethods/).
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
model |
|
|
path |
|
|
project_id |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectBleachingQCMethodsResource
¶
ProjectBleachingQCMethodsResource(
client: MermaidClient, project_id: str
)
Bases: ProjectResource[BleachingQuadratCollectionMethod]
Bleaching quadrat collection surveys (bleachingquadratcollectionmethods/).
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
model |
|
|
path |
|
|
project_id |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectBeltInvertMethodsResource
¶
ProjectBeltInvertMethodsResource(
client: MermaidClient, project_id: str
)
Bases: ProjectResource[BeltInvertMethod]
Macroinvertebrate belt surveys (beltinverttransectmethods/).
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
model |
|
|
path |
|
|
project_id |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectContext
¶
ProjectContext(
client: MermaidClient, project: str | Project
)
One project's data, as the collections nested under it.
Built by calling the projects resource with an id or a
Project. Nothing is requested when the context
is built, and each collection below it is a lazy list like every other
endpoint in the SDK.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
MermaidClient
|
The client the nested requests are made through. |
required |
project
|
str | Project
|
The project's id, or a |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the project id is empty. |
Attributes:
| Name | Type | Description |
|---|---|---|
project_id |
The id every route below this handle is built from. |
Example
sites
cached
property
¶
sites: ProjectSitesResource
The project's reef sites, /projects/{id}/sites/.
managements
cached
property
¶
managements: ProjectManagementsResource
The project's management regimes, /projects/{id}/managements/.
observers
cached
property
¶
observers: ProjectObserversResource
Observers credited on the project's surveys, /projects/{id}/observers/.
project_profiles
cached
property
¶
project_profiles: ProjectProfilesResource
The project's members, /projects/{id}/project_profiles/.
sample_events
cached
property
¶
sample_events: ProjectSampleEventsResource
The project's sample events, /projects/{id}/sampleevents/.
fishbelt_transects
cached
property
¶
fishbelt_transects: ProjectFishBeltTransectsResource
Fish belt transects, /projects/{id}/fishbelttransects/.
benthic_transects
cached
property
¶
benthic_transects: ProjectBenthicTransectsResource
Benthic transects, /projects/{id}/benthictransects/.
beltfish_methods
cached
property
¶
beltfish_methods: ProjectBeltFishMethodsResource
Fish belt surveys, /projects/{id}/beltfishtransectmethods/.
benthiclit_methods
cached
property
¶
benthiclit_methods: ProjectBenthicLITMethodsResource
Benthic LIT surveys, /projects/{id}/benthiclittransectmethods/.
benthicpit_methods
cached
property
¶
benthicpit_methods: ProjectBenthicPITMethodsResource
Benthic PIT surveys, /projects/{id}/benthicpittransectmethods/.
benthicpqt_methods
cached
property
¶
benthicpqt_methods: ProjectBenthicPQTMethodsResource
Benthic photo quadrat surveys, /projects/{id}/benthicphotoquadrattransectmethods/.
habitatcomplexity_methods
cached
property
¶
habitatcomplexity_methods: (
ProjectHabitatComplexityMethodsResource
)
Habitat complexity surveys, /projects/{id}/habitatcomplexitytransectmethods/.
bleachingqc_methods
cached
property
¶
bleachingqc_methods: ProjectBleachingQCMethodsResource
Bleaching surveys, /projects/{id}/bleachingquadratcollectionmethods/.
beltinvert_methods
cached
property
¶
beltinvert_methods: ProjectBeltInvertMethodsResource
Macroinvertebrate surveys, /projects/{id}/beltinverttransectmethods/.
beltfishes
cached
property
¶
beltfishes: AggregatedFamilyResource
Aggregated fish belt data, /projects/{id}/beltfishes/.
benthiclits
cached
property
¶
benthiclits: AggregatedFamilyResource
Aggregated benthic LIT data, /projects/{id}/benthiclits/.
benthicpits
cached
property
¶
benthicpits: AggregatedFamilyResource
Aggregated benthic PIT data, /projects/{id}/benthicpits/.
benthicpqts
cached
property
¶
benthicpqts: AggregatedFamilyResource
Aggregated benthic photo quadrat data, /projects/{id}/benthicpqts/.
habitatcomplexities
cached
property
¶
habitatcomplexities: AggregatedFamilyResource
Aggregated habitat complexity data, /projects/{id}/habitatcomplexities/.
bleachingqcs
cached
property
¶
bleachingqcs: BleachingQCFamilyResource
Aggregated bleaching data, /projects/{id}/bleachingqcs/.
Two observation views,
colonies_bleached
and
quadrat_benthic_percent.
beltinverts
cached
property
¶
beltinverts: AggregatedFamilyResource
Aggregated macroinvertebrate belt data, /projects/{id}/beltinverts/.
project_path
¶
Compose projects/<project_id>/<route>.
The id is percent-encoded, so a stray / or .. in it cannot send the
request to a different endpoint.
Aggregated observation views¶
aggregated
¶
The aggregated observation views, /projects/{project_id}/<family>/....
Every protocol publishes its data three times over, denormalized: one row per observation, one per sample unit, and one per sample event, each already joined to its site, management regime and project. These are the routes analysts pull into a DataFrame:
project = client.projects(project_id)
project.beltfishes.observations(sample_date_after="2018-01-01").to_df()
project.benthicpits.sample_events().to_df()
The seven families differ only in their route and their columns, so each is an
AggregatedViewFamily describing the former, and all of them
share one AggregatedFamilyResource and one light
AggregatedRecord, whose declared fields are the
few every view has in common. Bleaching is the exception: it publishes two observation
views, so it gets BleachingQCFamilyResource.
Sub-route names follow mermaid-api's src/api/urls.py (dev branch).
Classes:
| Name | Description |
|---|---|
AggregatedViewFamily |
One protocol's aggregated views, as route segments under a project. |
AggregatedFamilyResource |
One protocol's aggregated views for one project. |
BleachingQCFamilyResource |
The bleaching quadrat collections, which publish two observation views. |
Attributes:
| Name | Type | Description |
|---|---|---|
BELTFISHES |
|
|
BENTHICLITS |
|
|
BENTHICPITS |
|
|
BENTHICPQTS |
|
|
HABITATCOMPLEXITIES |
|
|
BLEACHINGQCS |
|
|
BELTINVERTS |
|
|
AGGREGATED_FAMILIES |
tuple[AggregatedViewFamily, ...]
|
|
BELTFISHES
module-attribute
¶
BELTFISHES = AggregatedViewFamily(
"beltfishes", "obstransectbeltfishes"
)
BENTHICLITS
module-attribute
¶
BENTHICLITS = AggregatedViewFamily(
"benthiclits", "obstransectbenthiclits"
)
BENTHICPITS
module-attribute
¶
BENTHICPITS = AggregatedViewFamily(
"benthicpits", "obstransectbenthicpits"
)
BENTHICPQTS
module-attribute
¶
BENTHICPQTS = AggregatedViewFamily(
"benthicpqts", "obstransectbenthicpqts"
)
HABITATCOMPLEXITIES
module-attribute
¶
HABITATCOMPLEXITIES = AggregatedViewFamily(
"habitatcomplexities", "obshabitatcomplexities"
)
BLEACHINGQCS
module-attribute
¶
BLEACHINGQCS = AggregatedViewFamily(
"bleachingqcs",
"obscoloniesbleacheds",
extra_observations=(
(
"quadrat_benthic_percent",
"obsquadratbenthicpercents",
),
),
)
BELTINVERTS
module-attribute
¶
BELTINVERTS = AggregatedViewFamily(
"beltinverts", "obstransectbeltinverts"
)
AGGREGATED_FAMILIES
module-attribute
¶
AGGREGATED_FAMILIES: tuple[AggregatedViewFamily, ...] = (
BELTFISHES,
BENTHICLITS,
BENTHICPITS,
BENTHICPQTS,
HABITATCOMPLEXITIES,
BLEACHINGQCS,
BELTINVERTS,
)
AggregatedViewFamily
dataclass
¶
AggregatedViewFamily(
family: str,
observations: str,
extra_observations: tuple[tuple[str, str], ...] = (),
sample_units: str = "sampleunits",
sample_events: str = "sampleevents",
)
One protocol's aggregated views, as route segments under a project.
family is both the first segment of the route and the attribute the
ProjectContext exposes it
as, e.g. beltfishes for /projects/{id}/beltfishes/.
Methods:
| Name | Description |
|---|---|
route |
|
Attributes:
| Name | Type | Description |
|---|---|---|
family |
str
|
|
observations |
str
|
|
extra_observations |
tuple[tuple[str, str], ...]
|
|
sample_units |
str
|
|
sample_events |
str
|
|
views |
dict[str, str]
|
Resource method name -> sub-route, for every view of the family. |
AggregatedFamilyResource
¶
AggregatedFamilyResource(
client: MermaidClient,
project_id: str,
family: AggregatedViewFamily,
)
Bases: Resource[AggregatedRecord]
One protocol's aggregated views for one project.
Each method returns the same lazy
PaginatedList as every other list route,
over AggregatedRecord rows. Keyword arguments
become query parameters, so the API's own filters pass straight through:
sample_date_before / sample_date_after, depth_min / depth_max,
site_id, management_id, label, observers, the protocol's own
filters, and the parameters every list route understands (limit,
ordering, fields). An argument whose value is None is left out.
Methods:
| Name | Description |
|---|---|
observations |
One row per observation, with its sample unit and site joined in. |
sample_units |
One row per sample unit, with the protocol's per-unit aggregates. |
sample_events |
One row per sample event, averaged over the event's sample units. |
Attributes:
| Name | Type | Description |
|---|---|---|
model |
|
|
project_id |
|
|
family |
|
|
path |
|
observations
¶
observations(
*,
limit: int | None = None,
offset: int | None = None,
ordering: str | None = None,
fields: str | None = None,
sample_date_after: str | None = None,
sample_date_before: str | None = None,
site_id: str | None = None,
**filters: Any,
) -> PaginatedList[AggregatedRecord]
One row per observation, with its sample unit and site joined in.
sample_units
¶
sample_units(
*,
limit: int | None = None,
offset: int | None = None,
ordering: str | None = None,
fields: str | None = None,
sample_date_after: str | None = None,
sample_date_before: str | None = None,
site_id: str | None = None,
**filters: Any,
) -> PaginatedList[AggregatedRecord]
One row per sample unit, with the protocol's per-unit aggregates.
sample_events
¶
sample_events(
*,
limit: int | None = None,
offset: int | None = None,
ordering: str | None = None,
fields: str | None = None,
sample_date_after: str | None = None,
sample_date_before: str | None = None,
site_id: str | None = None,
**filters: Any,
) -> PaginatedList[AggregatedRecord]
One row per sample event, averaged over the event's sample units.
BleachingQCFamilyResource
¶
BleachingQCFamilyResource(
client: MermaidClient,
project_id: str,
family: AggregatedViewFamily,
)
Bases: AggregatedFamilyResource
The bleaching quadrat collections, which publish two observation views.
colonies_bleached is the per-colony view and
quadrat_benthic_percent the per-quadrat benthic cover
view; observations is an alias of the former, so the family still
answers the same three methods as its siblings.
Methods:
| Name | Description |
|---|---|
colonies_bleached |
One row per bleached colony count ( |
quadrat_benthic_percent |
One row per quadrat's benthic percent cover ( |
observations |
The colonies bleached view; see |
sample_units |
One row per sample unit, with the protocol's per-unit aggregates. |
sample_events |
One row per sample event, averaged over the event's sample units. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
model |
|
|
project_id |
|
|
family |
|
colonies_bleached
¶
colonies_bleached(
*,
limit: int | None = None,
offset: int | None = None,
ordering: str | None = None,
fields: str | None = None,
sample_date_after: str | None = None,
sample_date_before: str | None = None,
site_id: str | None = None,
**filters: Any,
) -> PaginatedList[AggregatedRecord]
One row per bleached colony count (obscoloniesbleacheds/).
quadrat_benthic_percent
¶
quadrat_benthic_percent(
*,
limit: int | None = None,
offset: int | None = None,
ordering: str | None = None,
fields: str | None = None,
sample_date_after: str | None = None,
sample_date_before: str | None = None,
site_id: str | None = None,
**filters: Any,
) -> PaginatedList[AggregatedRecord]
One row per quadrat's benthic percent cover (obsquadratbenthicpercents/).
observations
¶
observations(
*,
limit: int | None = None,
offset: int | None = None,
ordering: str | None = None,
fields: str | None = None,
sample_date_after: str | None = None,
sample_date_before: str | None = None,
site_id: str | None = None,
**filters: Any,
) -> PaginatedList[AggregatedRecord]
The colonies bleached view; see
colonies_bleached.
sample_units
¶
sample_units(
*,
limit: int | None = None,
offset: int | None = None,
ordering: str | None = None,
fields: str | None = None,
sample_date_after: str | None = None,
sample_date_before: str | None = None,
site_id: str | None = None,
**filters: Any,
) -> PaginatedList[AggregatedRecord]
One row per sample unit, with the protocol's per-unit aggregates.
sample_events
¶
sample_events(
*,
limit: int | None = None,
offset: int | None = None,
ordering: str | None = None,
fields: str | None = None,
sample_date_after: str | None = None,
sample_date_before: str | None = None,
site_id: str | None = None,
**filters: Any,
) -> PaginatedList[AggregatedRecord]
One row per sample event, averaged over the event's sample units.
Reference and lookup endpoints¶
reference
¶
The top-level reference, lookup and summary endpoints.
Every endpoint here is a read-only, paginated list with a /<id>/ detail
route, so each wrapper is just a path and a model on top of
ReadOnlyResource. The filters named in
each docstring are the ones the API declares; any other keyword argument is
forwarded as a query parameter too, as are limit, search, ordering
and fields.
Most of these are public. /sites/ and /managements/ are the exception:
they hold project data and need credentials.
Classes:
| Name | Description |
|---|---|
SitesResource |
Reef sites across every project the credentials can see ( |
ManagementsResource |
Management regimes ( |
ProjectTagsResource |
Organisation tags projects can be labelled with ( |
FishSizesResource |
The bins of every fish size bin set ( |
FishFamiliesResource |
Fish families ( |
FishGeneraResource |
Fish genera ( |
FishSpeciesResource |
Fish species ( |
BenthicAttributesResource |
Benthic attributes ( |
InvertAttributesResource |
Macroinvertebrate attributes at every rank ( |
InvertSpeciesResource |
Macroinvertebrate species ( |
SummarySampleEventsResource |
Public per-sample-event summaries ( |
LabelMappingsResource |
Image classifier labels mapped onto MERMAID attributes. |
Attributes:
| Name | Type | Description |
|---|---|---|
REFERENCE_RESOURCES |
tuple[tuple[str, type[ReadOnlyResource[Any]]], ...]
|
|
REFERENCE_RESOURCES
module-attribute
¶
REFERENCE_RESOURCES: tuple[
tuple[str, type[ReadOnlyResource[Any]]], ...
] = (
("sites", SitesResource),
("managements", ManagementsResource),
("project_tags", ProjectTagsResource),
("fish_sizes", FishSizesResource),
("fish_families", FishFamiliesResource),
("fish_genera", FishGeneraResource),
("fish_species", FishSpeciesResource),
("benthic_attributes", BenthicAttributesResource),
("invert_attributes", InvertAttributesResource),
("invert_species", InvertSpeciesResource),
("summary_sample_events", SummarySampleEventsResource),
("label_mappings", LabelMappingsResource),
)
SitesResource
¶
SitesResource(client: MermaidClient)
Bases: ReadOnlyResource[Site]
Reef sites across every project the credentials can see (/sites/).
Requires authentication. Filters: project, country, reef_type,
reef_zone, exposure, exclude_projects, unique.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
model |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ManagementsResource
¶
ManagementsResource(client: MermaidClient)
Bases: ReadOnlyResource[Management]
Management regimes (/managements/).
Requires authentication. Filters: project, predecessor,
parties, compliance, est_year, the seven rule flags
(no_take, periodic_closure, open_access, size_limits,
gear_restriction, species_restriction, access_restriction),
unique and exclude_projects.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
model |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
ProjectTagsResource
¶
ProjectTagsResource(client: MermaidClient)
Bases: ReadOnlyResource[ProjectTag]
Organisation tags projects can be labelled with (/projecttags/).
Filters: name, status.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
model |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
FishSizesResource
¶
FishSizesResource(client: MermaidClient)
Bases: ReadOnlyResource[FishSize]
The bins of every fish size bin set (/fishsizes/).
Filters: val.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
model |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
FishFamiliesResource
¶
FishFamiliesResource(client: MermaidClient)
Bases: ReadOnlyResource[FishFamily]
Fish families (/fishfamilies/).
Filters: status, regions (a comma-separated list of region ids).
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
model |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
FishGeneraResource
¶
FishGeneraResource(client: MermaidClient)
Bases: ReadOnlyResource[FishGenus]
Fish genera (/fishgenera/).
Filters: family, status, regions.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
model |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
FishSpeciesResource
¶
FishSpeciesResource(client: MermaidClient)
Bases: ReadOnlyResource[FishSpecies]
Fish species (/fishspecies/).
Filters: genus, genus__family, status, regions.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
model |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
BenthicAttributesResource
¶
BenthicAttributesResource(client: MermaidClient)
Bases: ReadOnlyResource[BenthicAttribute]
Benthic attributes (/benthicattributes/).
Filters: parent (pass an empty string for the top-level attributes),
life_history, region.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
model |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
InvertAttributesResource
¶
InvertAttributesResource(client: MermaidClient)
Bases: ReadOnlyResource[InvertAttribute]
Macroinvertebrate attributes at every rank (/invertattributes/).
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
model |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
InvertSpeciesResource
¶
InvertSpeciesResource(client: MermaidClient)
Bases: ReadOnlyResource[InvertSpecies]
Macroinvertebrate species (/invertspecies/).
Filters: genus, genus__family, genus__group_of_interest,
status.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
model |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
SummarySampleEventsResource
¶
SummarySampleEventsResource(client: MermaidClient)
Bases: ReadOnlyResource[SummarySampleEvent]
Public per-sample-event summaries (/summarysampleevents/).
Records are keyed by sample_event_id,
which is also what get
takes. Filters: project_id, project_name, project_admins,
sample_date (as a range, sample_date_after / sample_date_before)
and the seven data_policy_* fields.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
model |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
LabelMappingsResource
¶
LabelMappingsResource(client: MermaidClient)
Bases: ReadOnlyResource[LabelMapping]
Image classifier labels mapped onto MERMAID attributes.
/classification/labelmappings/. Filters: benthic_attribute,
benthic_attribute__name, growth_form, growth_form__name,
provider, provider_id, provider_label.
Methods:
| Name | Description |
|---|---|
list |
List records, lazily fetching pages as they are consumed. |
get |
Fetch a single record by id. |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
model |
|
list
¶
list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
ordering: str | None = None,
fields: str | None = None,
**filters: Any,
) -> PaginatedList[M]
List records, lazily fetching pages as they are consumed.
Keyword arguments become query parameters, so anything the endpoint
filters on can be passed straight through, alongside the parameters
every list route understands: limit, search, ordering and
fields. An argument whose value is None is left out.
Choices¶
choices
¶
The /choices/ endpoint.
Unlike every other list route, /choices/ is not paginated: it answers with
a bare JSON array of {"name": ..., "data": [...]} objects, one per choice
set (countries, reeftypes, managementparties, ...). The detail
route, /choices/<name>/, returns a single one of those objects. So this
wrapper hands back plain dictionaries rather than models in a
PaginatedList.
Classes:
| Name | Description |
|---|---|
ChoicesResource |
The controlled vocabularies the API validates submissions against. |
ChoicesResource
¶
ChoicesResource(client: MermaidClient)
Bases: BaseResource
The controlled vocabularies the API validates submissions against.
Methods:
| Name | Description |
|---|---|
fetch |
Fetch every choice set, keyed by name ( |
get |
Fetch a single choice set by name ( |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
Profile¶
me
¶
The /me/ endpoint.
Classes:
| Name | Description |
|---|---|
MeResource |
The profile owning the credentials in use. |
MeResource
¶
MeResource(client: MermaidClient)
Zonal statistics¶
zonal_stats
¶
The Zonal Stats service, https://api.zonalstats.datamermaid.org/.
A separate FastAPI service, not a route of the MERMAID API: it lives on its own
host, resolved independently of the client's base_url (see
MermaidClient's zonal_stats_url), takes
no authentication, and its routes have no trailing slash. Each endpoint
takes a GeoJSON area of interest plus the URL of a data source and answers with
statistics keyed by band or column:
result = client.zonal_stats.raster.stats(
{"type": "Point", "coordinates": [178.4, -18.1]},
url="https://example.test/depth.tif",
stats=["mean", "count"],
radius=500,
)
result["band_1"]["mean"]
There are four routes, one per kind of source, listed in
ZONAL_STATS_ENDPOINTS:
| Property | Route | Source | Keys |
|---|---|---|---|
raster |
raster |
a Cloud Optimized GeoTIFF | band_1, ... |
raster_stac |
raster/stac |
a STAC Item whose asset is a GeoTIFF | band_1, ... |
vector |
vector |
a GeoParquet file | column names |
vector_stac |
vector/stac |
a STAC Item whose asset is GeoParquet | column names |
result = client.zonal_stats.raster_stac.stats(
aoi, url="https://example.test/item.json", asset="visual", bands=[1, 2]
)
result = client.zonal_stats.vector.stats(
aoi, url="https://example.test/habitat.parquet", columns=["depth"], weighting_method="ratio"
)
result["depth"]["mean"]
The statistic names and the vector weighting methods are fixed vocabularies,
Stat and
WeightingMethod. Plain
strings are accepted too; an unknown one raises ValueError before any request
is made.
The area of interest goes through to_aoi, so a
Site, a shapely geometry or a (lon, lat) tuple
work just as well as a GeoJSON mapping:
site = client.projects(project_id).sites.get(site_id)
result = client.zonal_stats.raster.stats(site, url="https://example.test/depth.tif", radius=500)
Many areas of interest go through batch, which returns a completed
Batch that issues one request per AOI on a
bounded thread pool and labels each result so to_df() gives one row per AOI:
batch = client.zonal_stats.raster.batch(sites, url="https://example.test/depth.tif")
frame = batch.to_df() # one wide row per site, keyed by `label` (the site id)
Because the requests go to another host, they are sent without the client's
auth and without the headers passed to it with headers=, so the MERMAID
credentials the client holds are never disclosed to it. Retries,
backoff and error mapping are the client's own.
Classes:
| Name | Description |
|---|---|
Stat |
A statistic the service can compute: the |
WeightingMethod |
How the vector routes weight each feature that intersects the AOI. |
BatchItem |
Legacy input tuple; current zonal batches expose ZonalTask inputs. |
ResponseCache |
A thread-safe, size-bounded, in-memory cache of zonal stats responses. |
BaseZonalStats |
One route of the Zonal Stats service. |
RasterStats |
|
RasterStacStats |
|
VectorStats |
|
VectorStacStats |
|
ZonalStats |
The Zonal Stats service, as |
Attributes:
| Name | Type | Description |
|---|---|---|
ZONAL_STATS_ENDPOINTS |
tuple[tuple[str, type[BaseZonalStats]], ...]
|
|
ZONAL_STATS_ENDPOINTS
module-attribute
¶
ZONAL_STATS_ENDPOINTS: tuple[
tuple[str, type[BaseZonalStats]], ...
] = (
("raster", RasterStats),
("raster_stac", RasterStacStats),
("vector", VectorStats),
("vector_stac", VectorStacStats),
)
Stat
¶
Bases: str, Enum
A statistic the service can compute: the StatType vocabulary.
Members compare equal to their wire value, so Stat.MEAN == "mean", and
stats= takes members and plain strings alike.
Attributes:
| Name | Type | Description |
|---|---|---|
MIN |
|
|
MAX |
|
|
MEAN |
|
|
COUNT |
|
|
SUM |
|
|
STD |
|
|
MEDIAN |
|
|
MAJORITY |
|
|
MINORITY |
|
|
UNIQUE |
|
|
RANGE |
|
|
NODATA |
|
|
AOI_AREA |
|
|
DATA_AREA |
|
|
FREQ_HIST |
|
|
DENSITY |
|
WeightingMethod
¶
BatchItem
¶
ResponseCache
¶
Bases: MutableMapping[str, Any]
A thread-safe, size-bounded, in-memory cache of zonal stats responses.
Each ZonalStats resource
holds one as client.zonal_stats.cache, and batch uses it unless told
otherwise. When full, the least recently used entry is dropped.
Methods:
| Name | Description |
|---|---|
clear |
|
Attributes:
| Name | Type | Description |
|---|---|---|
maxsize |
|
BaseZonalStats
¶
BaseZonalStats(resource: ZonalStats)
One route of the Zonal Stats service.
Subclasses set route (the segment after .../zonal-stats/) and
extend stats with the options that route accepts. Calling the
endpoint is the same as calling stats.
Methods:
| Name | Description |
|---|---|
prepare |
Resolve sources and count pairs without submitting statistics requests. |
stats |
Compute statistics for |
batch |
One statistics request per area of interest, run on a bounded thread pool. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
str
|
|
url |
str
|
The absolute URL POSTed to. No trailing slash: the service has none. |
prepare
¶
prepare(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
labels: Iterable[Any] | None = None,
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
**options: Any,
) -> ZonalJob
Resolve sources and count pairs without submitting statistics requests.
Supply exactly one of url, sources (URLs or STAC Items), or a pystac-client ItemSearch via search. Item assets resolve to data URLs; string URLs retain this endpoint's usual meaning. AOIs and sources are retained, but their Cartesian product is generated lazily at execution.
stats
¶
stats(
aoi: GeometryLike,
*,
url: str,
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
label: Any = None,
**options: Any,
) -> ZonalStatsResult
Compute statistics for aoi against the source at url.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aoi
|
GeometryLike
|
required | |
url
|
str
|
The data source the route reads, e.g. a Cloud Optimized GeoTIFF. |
required |
stats
|
Iterable[Stat | str] | None
|
|
None
|
radius
|
float | None
|
Buffer around a |
None
|
label
|
Any
|
An identifier carried onto the result unchanged. |
None
|
**options
|
Any
|
Route-specific body fields; a |
{}
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
ValueError
|
If |
MermaidAPIError
|
If the service rejects the request (422 for a validation error, 400 for an unreadable source). |
batch
¶
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[False] = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
**options: Any,
) -> Batch[ZonalTask, ZonalStatsResult]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[True],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
**options: Any,
) -> BatchStream[ZonalTask, ZonalStatsResult]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
**options: Any,
) -> (
Batch[ZonalTask, ZonalStatsResult]
| BatchStream[ZonalTask, ZonalStatsResult]
)
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[False] = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
**options: Any,
) -> Batch[
ZonalTask, ZonalStatsResult | BatchFailure[ZonalTask]
]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[True],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
**options: Any,
) -> BatchStream[
ZonalTask, ZonalStatsResult | BatchFailure[ZonalTask]
]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
**options: Any,
) -> (
Batch[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
| BatchStream[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
)
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
**options: Any,
) -> (
Batch[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
| BatchStream[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
)
One statistics request per area of interest, run on a bounded thread pool.
By default this call waits for all requests and returns a completed
Batch in input order. aois is read in
full, so a lazy list such as sites.list() fetches all its pages.
Each result carries a label, so batch.to_df() is one row per AOI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aois
|
Any
|
An iterable of areas of interest (anything
|
required |
url
|
str | None
|
The data source the route reads; exclusive with sources/search. |
None
|
sources
|
Iterable[SourceInput] | None
|
Iterable of source URLs or STAC Items. |
None
|
search
|
StacSearchLike | None
|
A pystac-client ItemSearch, resolved once before execution. |
None
|
stream
|
bool
|
Return a single-pass BatchStream instead of retaining results. Use as a context manager and keep the client open while iterating. |
False
|
labels
|
Iterable[Any] | None
|
One label per AOI, in order. Omitted, a
|
None
|
max_workers
|
int
|
Most requests in flight at once. |
DEFAULT_MAX_WORKERS
|
cache
|
MutableMapping[str, Any] | bool | None
|
Where successful responses are kept, keyed by a hash of the
route and the request body. A request already in the cache is
answered without calling the service, so a rerun only sends the
requests that failed or are new. |
True
|
errors
|
Literal['raise', 'return']
|
|
'raise'
|
stats
|
Iterable[Stat | str] | None
|
Statistic names, as for |
None
|
radius
|
float | None
|
Buffer around a |
None
|
**options
|
Any
|
Route-specific body fields; a |
{}
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
TypeError
|
If |
RasterStats
¶
RasterStats(resource: ZonalStats)
Bases: BaseZonalStats
POST .../zonal-stats/raster: statistics from a Cloud Optimized GeoTIFF.
Methods:
| Name | Description |
|---|---|
prepare |
Prepare source calculations using the same options as stats() and batch(). |
stats |
Compute statistics for |
batch |
One raster statistics request per area of interest, run in parallel. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
url |
str
|
The absolute URL POSTed to. No trailing slash: the service has none. |
prepare
¶
prepare(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
labels: Iterable[Any] | None = None,
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> ZonalJob
Prepare source calculations using the same options as stats() and batch().
stats
¶
stats(
aoi: GeometryLike,
*,
url: str,
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
label: Any = None,
) -> ZonalStatsResult
Compute statistics for aoi over the raster at url.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aoi
|
GeometryLike
|
required | |
url
|
str
|
URL of the Cloud Optimized GeoTIFF ( |
required |
stats
|
Iterable[Stat | str] | None
|
Statistic names. Omitted, the service returns |
None
|
radius
|
float | None
|
Buffer around a |
None
|
bands
|
Sequence[int] | None
|
1-based band indices to read. Omitted, the service reads band 1. |
None
|
approx_stats
|
bool
|
Read overviews for faster, approximate values. |
False
|
label
|
Any
|
An identifier carried onto the result unchanged. |
None
|
Returns:
| Type | Description |
|---|---|
ZonalStatsResult
|
The statistics keyed by band, |
batch
¶
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[False] = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> Batch[ZonalTask, ZonalStatsResult]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[True],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> BatchStream[ZonalTask, ZonalStatsResult]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> (
Batch[ZonalTask, ZonalStatsResult]
| BatchStream[ZonalTask, ZonalStatsResult]
)
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[False] = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> Batch[
ZonalTask, ZonalStatsResult | BatchFailure[ZonalTask]
]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[True],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> BatchStream[
ZonalTask, ZonalStatsResult | BatchFailure[ZonalTask]
]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> (
Batch[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
| BatchStream[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
)
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> (
Batch[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
| BatchStream[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
)
One raster statistics request per area of interest, run in parallel.
Takes the same options as stats; see
BaseZonalStats.batch
for how aois, labels, max_workers and errors behave. The
options are validated before any request is made.
RasterStacStats
¶
RasterStacStats(resource: ZonalStats)
Bases: RasterStats
POST .../zonal-stats/raster/stac: statistics from a raster asset of a STAC Item.
Methods:
| Name | Description |
|---|---|
prepare |
Prepare source calculations using the same options as stats() and batch(). |
stats |
Compute statistics for |
batch |
One STAC raster statistics request per area of interest, run in parallel. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
url |
str
|
The absolute URL POSTed to. No trailing slash: the service has none. |
prepare
¶
prepare(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
labels: Iterable[Any] | None = None,
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> ZonalJob
Prepare source calculations using the same options as stats() and batch().
stats
¶
stats(
aoi: GeometryLike,
*,
url: str,
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
label: Any = None,
) -> ZonalStatsResult
Compute statistics for aoi over a raster asset of the STAC Item at url.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aoi
|
GeometryLike
|
Anything |
required |
url
|
str
|
URL of the STAC Item JSON. |
required |
stats
|
Iterable[Stat | str] | None
|
|
None
|
radius
|
float | None
|
Buffer around a |
None
|
asset
|
str | None
|
Key of the asset to read. Omitted, the service reads the Item's first asset. |
None
|
bands
|
Sequence[int] | None
|
1-based band indices to read. Omitted, the service reads band 1. |
None
|
approx_stats
|
bool
|
Read overviews for faster, approximate values. |
False
|
label
|
Any
|
An identifier carried onto the result unchanged. |
None
|
Returns:
| Type | Description |
|---|---|
ZonalStatsResult
|
The statistics keyed by band, |
batch
¶
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[False] = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> Batch[ZonalTask, ZonalStatsResult]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[True],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> BatchStream[ZonalTask, ZonalStatsResult]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> (
Batch[ZonalTask, ZonalStatsResult]
| BatchStream[ZonalTask, ZonalStatsResult]
)
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[False] = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> Batch[
ZonalTask, ZonalStatsResult | BatchFailure[ZonalTask]
]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[True],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> BatchStream[
ZonalTask, ZonalStatsResult | BatchFailure[ZonalTask]
]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> (
Batch[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
| BatchStream[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
)
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
bands: Sequence[int] | None = None,
approx_stats: bool = False,
) -> (
Batch[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
| BatchStream[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
)
One STAC raster statistics request per area of interest, run in parallel.
Takes the same options as stats; see
BaseZonalStats.batch
for how aois, labels, max_workers and errors behave. The
options are validated before any request is made.
VectorStats
¶
VectorStats(resource: ZonalStats)
Bases: BaseZonalStats
POST .../zonal-stats/vector: area-weighted statistics from a GeoParquet file.
columns names the numeric columns to summarise and is required; the
result is keyed by those names.
Methods:
| Name | Description |
|---|---|
prepare |
Prepare source calculations using the same options as stats() and batch(). |
stats |
Compute statistics for |
batch |
One vector statistics request per area of interest, run in parallel. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
url |
str
|
The absolute URL POSTed to. No trailing slash: the service has none. |
prepare
¶
prepare(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
columns: Sequence[str],
labels: Iterable[Any] | None = None,
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> ZonalJob
Prepare source calculations using the same options as stats() and batch().
stats
¶
stats(
aoi: GeometryLike,
*,
url: str,
columns: Sequence[str],
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
label: Any = None,
) -> ZonalStatsResult
Compute statistics for aoi over the GeoParquet file at url.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aoi
|
GeometryLike
|
Anything |
required |
url
|
str
|
URL of the GeoParquet file. |
required |
columns
|
Sequence[str]
|
Numeric columns to summarise. Required and non-empty. |
required |
stats
|
Iterable[Stat | str] | None
|
|
None
|
radius
|
float | None
|
Buffer around a |
None
|
geometry_column
|
str | None
|
Name of the geometry column. Omitted, the service finds it from the file's metadata. |
None
|
weighting_method
|
WeightingMethod | str | None
|
How intersecting features are weighted, a
|
None
|
approx_stats
|
bool
|
Reserved by the service for a future optimisation. |
False
|
label
|
Any
|
An identifier carried onto the result unchanged. |
None
|
Returns:
| Type | Description |
|---|---|
ZonalStatsResult
|
The statistics keyed by column name. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
TypeError
|
If |
batch
¶
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[False] = False,
columns: Sequence[str],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> Batch[ZonalTask, ZonalStatsResult]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[True],
columns: Sequence[str],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> BatchStream[ZonalTask, ZonalStatsResult]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
columns: Sequence[str],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> (
Batch[ZonalTask, ZonalStatsResult]
| BatchStream[ZonalTask, ZonalStatsResult]
)
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[False] = False,
columns: Sequence[str],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> Batch[
ZonalTask, ZonalStatsResult | BatchFailure[ZonalTask]
]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[True],
columns: Sequence[str],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> BatchStream[
ZonalTask, ZonalStatsResult | BatchFailure[ZonalTask]
]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
columns: Sequence[str],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> (
Batch[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
| BatchStream[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
)
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
columns: Sequence[str],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> (
Batch[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
| BatchStream[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
)
One vector statistics request per area of interest, run in parallel.
Takes the same options as stats; see
BaseZonalStats.batch
for how aois, labels, max_workers and errors behave. The
options are validated before any request is made.
VectorStacStats
¶
VectorStacStats(resource: ZonalStats)
Bases: VectorStats
POST .../zonal-stats/vector/stac: statistics from a GeoParquet asset of a STAC Item.
The vector route's options plus asset, the key of the GeoParquet asset
to read.
Methods:
| Name | Description |
|---|---|
prepare |
Prepare source calculations using the same options as stats() and batch(). |
stats |
Compute statistics for |
batch |
One STAC vector statistics request per area of interest, run in parallel. |
Attributes:
| Name | Type | Description |
|---|---|---|
route |
|
|
url |
str
|
The absolute URL POSTed to. No trailing slash: the service has none. |
prepare
¶
prepare(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
columns: Sequence[str],
labels: Iterable[Any] | None = None,
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> ZonalJob
Prepare source calculations using the same options as stats() and batch().
stats
¶
stats(
aoi: GeometryLike,
*,
url: str,
columns: Sequence[str],
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
label: Any = None,
) -> ZonalStatsResult
Compute statistics for aoi over a GeoParquet asset of the STAC Item at url.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aoi
|
GeometryLike
|
Anything |
required |
url
|
str
|
URL of the STAC Item JSON. |
required |
columns
|
Sequence[str]
|
Numeric columns to summarise. Required and non-empty. |
required |
stats
|
Iterable[Stat | str] | None
|
|
None
|
radius
|
float | None
|
Buffer around a |
None
|
asset
|
str | None
|
Key of the GeoParquet asset to read. Omitted, the service reads the Item's first asset. |
None
|
geometry_column
|
str | None
|
Name of the geometry column. Omitted, the service
uses |
None
|
weighting_method
|
WeightingMethod | str | None
|
How intersecting features are weighted, a
|
None
|
approx_stats
|
bool
|
Reserved by the service for a future optimisation. |
False
|
label
|
Any
|
An identifier carried onto the result unchanged. |
None
|
Returns:
| Type | Description |
|---|---|
ZonalStatsResult
|
The statistics keyed by column name. |
batch
¶
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[False] = False,
columns: Sequence[str],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> Batch[ZonalTask, ZonalStatsResult]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[True],
columns: Sequence[str],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> BatchStream[ZonalTask, ZonalStatsResult]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
columns: Sequence[str],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> (
Batch[ZonalTask, ZonalStatsResult]
| BatchStream[ZonalTask, ZonalStatsResult]
)
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[False] = False,
columns: Sequence[str],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> Batch[
ZonalTask, ZonalStatsResult | BatchFailure[ZonalTask]
]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: Literal[True],
columns: Sequence[str],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> BatchStream[
ZonalTask, ZonalStatsResult | BatchFailure[ZonalTask]
]
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
columns: Sequence[str],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> (
Batch[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
| BatchStream[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
)
batch(
aois: Any,
*,
url: str | None = None,
sources: Iterable[SourceInput] | None = None,
search: StacSearchLike | None = None,
stream: bool = False,
columns: Sequence[str],
labels: Iterable[Any] | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
asset: str | None = None,
geometry_column: str | None = None,
weighting_method: WeightingMethod | str | None = None,
approx_stats: bool = False,
) -> (
Batch[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
| BatchStream[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
)
One STAC vector statistics request per area of interest, run in parallel.
Takes the same options as stats; see
BaseZonalStats.batch
for how aois, labels, max_workers and errors behave. The
options are validated before any request is made.
ZonalStats
¶
ZonalStats(client: MermaidClient)
Bases: BaseResource
The Zonal Stats service, as client.zonal_stats.
path is the absolute service
root, so the endpoints bypass the client's base_url altogether.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
cache |
MutableMapping[str, Any]
|
|
raster |
RasterStats
|
Statistics from a Cloud Optimized GeoTIFF, |
raster_stac |
RasterStacStats
|
Statistics from a raster asset of a STAC Item, |
vector |
VectorStats
|
Statistics from a GeoParquet file, |
vector_stac |
VectorStacStats
|
Statistics from a GeoParquet asset of a STAC Item, |
raster
cached
property
¶
raster: RasterStats
Statistics from a Cloud Optimized GeoTIFF, POST .../raster.
raster_stac
cached
property
¶
raster_stac: RasterStacStats
Statistics from a raster asset of a STAC Item, POST .../raster/stac.
vector_stac
cached
property
¶
vector_stac: VectorStacStats
Statistics from a GeoParquet asset of a STAC Item, POST .../vector/stac.
Covariates¶
covariates
¶
The MERMAID covariates catalog, a STAC API at https://mermaid.prescient.earth/stac/.
Covariates are the environmental and human-pressure datasets that sit next to
MERMAID survey data: daily sea surface temperature and heat stress, reef
habitat maps, market gravity, coastal population and more. Each dataset is a
STAC collection, and each collection holds one or more items whose data
asset is a Cloud Optimized GeoTIFF or a GeoParquet file.
The catalog is read with pystac-client,
installed by the covariates extra (pip install 'datamermaid[covariates]').
Collections wrap a pystac.Collection and searches are plain pystac-client
ItemSearch objects, so everything pystac offers is still there. The catalog
is a public host, resolved independently of the client's base_url (see
MermaidClient's covariates_url), and
pystac-client never sees the client's MERMAID credentials.
See what is available:
for collection in client.covariates.collections():
print(collection.id, collection.title)
client.covariates.search_collections("temperature") # matches id or title
sst = client.covariates.collection("daily_sst")
print(sst.describe())
Compute statistics for many sites without choosing a route, an asset or a geometry column yourself:
batch = sst.zonal_stats(sites, datetime="2026-05", stats=["mean"], radius=500)
frame = batch.to_df()
Values are never rescaled here. A band's scale, offset and nodata
are shown as metadata; the service reading the raster applies them.
Classes:
| Name | Description |
|---|---|
CovariateCollection |
One covariate dataset: a |
Covariates |
The covariates catalog, as |
PYSTAC_INSTALL_HINT
module-attribute
¶
PYSTAC_INSTALL_HINT = "client.covariates needs pystac-client; install it with `pip install 'datamermaid[covariates]'`"
CovariateCollection
¶
CovariateCollection(
resource: Covariates, collection: Collection
)
One covariate dataset: a pystac.Collection and what it holds.
Attributes of the underlying stac collection (title,
description, keywords, license, providers, extent,
summaries, ...) read straight through. The details of its data file
(band units and scaling, class labels, GeoParquet columns) are only on its
items, so sample_item fetches one item the first time any
of them is asked for.
Methods:
| Name | Description |
|---|---|
to_dict |
One summary row: id, title, kind, time range, keywords and licence. |
describe |
A readable summary of the dataset, its data file and its provenance. |
search |
A pystac-client |
prepare_zonal_stats |
Resolve the matching items and return a |
zonal_stats |
Statistics for every AOI against every matching item of this dataset. |
Attributes:
| Name | Type | Description |
|---|---|---|
stac |
|
|
id |
str
|
The collection id, e.g. |
temporal_extent |
tuple[datetime | None, datetime | None]
|
The first and last moments covered, |
citation |
str | None
|
The |
kind |
Kind | None
|
|
sample_item |
Item | None
|
The collection's first item, fetched once, or |
data_asset |
Asset | None
|
The sample item's asset with the |
bands |
list[dict[str, Any]]
|
|
classes |
dict[Any, str]
|
Class value to label, for a categorical raster such as habitat or land cover. |
columns |
list[dict[str, Any]]
|
|
temporal_extent
property
¶
The first and last moments covered, None for an open end.
kind
property
¶
kind: Kind | None
"raster" or "vector": which zonal stats route reads this dataset.
Read from the collection's asset descriptions when it has them, so
listing kinds needs no extra request; otherwise from
data_asset.
sample_item
cached
property
¶
The collection's first item, fetched once, or None if it has none.
bands
property
¶
raster:bands of the data asset: unit, scale, offset, nodata per band.
classes
property
¶
Class value to label, for a categorical raster such as habitat or land cover.
columns
property
¶
table:columns of a GeoParquet data asset: name, type, description.
to_dict
¶
One summary row: id, title, kind, time range, keywords and licence.
Built from the collection document alone, so a table of every dataset costs one request.
describe
¶
A readable summary of the dataset, its data file and its provenance.
Fetches one item (see sample_item) and counts the
items.
search
¶
A pystac-client ItemSearch over this collection's items.
Takes the keyword arguments of
Covariates.search.
prepare_zonal_stats
¶
prepare_zonal_stats(
aois: Any,
*,
datetime: DatetimeLike | None = None,
bbox: Sequence[float] | None = None,
ids: Sequence[str] | None = None,
max_items: int | None = None,
asset: str | None = None,
columns: Sequence[str] | None = None,
labels: Iterable[Any] | None = None,
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
**options: Any,
) -> ZonalJob
Resolve the matching items and return a ZonalJob to run.
Takes the same arguments as zonal_stats and sends no
statistics requests, so job.request_count can be checked first.
zonal_stats
¶
zonal_stats(
aois: Any,
*,
datetime: DatetimeLike | None = None,
bbox: Sequence[float] | None = None,
ids: Sequence[str] | None = None,
max_items: int | None = None,
asset: str | None = None,
columns: Sequence[str] | None = None,
labels: Iterable[Any] | None = None,
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stream: Literal[False] = False,
**options: Any,
) -> Batch[ZonalTask, ZonalStatsResult]
zonal_stats(
aois: Any,
*,
datetime: DatetimeLike | None = None,
bbox: Sequence[float] | None = None,
ids: Sequence[str] | None = None,
max_items: int | None = None,
asset: str | None = None,
columns: Sequence[str] | None = None,
labels: Iterable[Any] | None = None,
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise"] = "raise",
stream: Literal[True],
**options: Any,
) -> BatchStream[ZonalTask, ZonalStatsResult]
zonal_stats(
aois: Any,
*,
datetime: DatetimeLike | None = None,
bbox: Sequence[float] | None = None,
ids: Sequence[str] | None = None,
max_items: int | None = None,
asset: str | None = None,
columns: Sequence[str] | None = None,
labels: Iterable[Any] | None = None,
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stream: Literal[False] = False,
**options: Any,
) -> Batch[
ZonalTask, ZonalStatsResult | BatchFailure[ZonalTask]
]
zonal_stats(
aois: Any,
*,
datetime: DatetimeLike | None = None,
bbox: Sequence[float] | None = None,
ids: Sequence[str] | None = None,
max_items: int | None = None,
asset: str | None = None,
columns: Sequence[str] | None = None,
labels: Iterable[Any] | None = None,
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stream: Literal[True],
**options: Any,
) -> BatchStream[
ZonalTask, ZonalStatsResult | BatchFailure[ZonalTask]
]
zonal_stats(
aois: Any,
*,
datetime: DatetimeLike | None = None,
bbox: Sequence[float] | None = None,
ids: Sequence[str] | None = None,
max_items: int | None = None,
asset: str | None = None,
columns: Sequence[str] | None = None,
labels: Iterable[Any] | None = None,
stats: Iterable[Stat | str] | None = None,
radius: float | None = None,
max_workers: int = DEFAULT_MAX_WORKERS,
cache: MutableMapping[str, Any] | bool | None = True,
errors: Literal["raise", "return"] = "raise",
stream: bool = False,
**options: Any,
) -> (
Batch[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
| BatchStream[
ZonalTask,
ZonalStatsResult | BatchFailure[ZonalTask],
]
)
Statistics for every AOI against every matching item of this dataset.
Chooses the route from the data asset's type (raster for a GeoTIFF,
vector for GeoParquet), picks the asset with the data role, and
for GeoParquet fills geometry_column and, when columns is left
out, every numeric column from the item's table:columns. Each
result carries the item's id and datetime in result.stac.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aois
|
Any
|
One area of interest or many, as the zonal stats |
required |
datetime
|
DatetimeLike | None
|
Which items to use, in any form pystac-client accepts:
|
None
|
bbox
|
Sequence[float] | None
|
Only items intersecting |
None
|
ids
|
Sequence[str] | None
|
Only these item ids. |
None
|
max_items
|
int | None
|
Read at most this many items. |
None
|
asset
|
str | None
|
The asset key, when the |
None
|
columns
|
Sequence[str] | None
|
GeoParquet columns to summarise. Vector datasets only. |
None
|
labels
|
Iterable[Any] | None
|
One identifier per AOI; defaults as for
|
None
|
stats
|
Iterable[Stat | str] | None
|
Statistic names; the service picks defaults when omitted. |
None
|
radius
|
float | None
|
Buffer around each |
None
|
max_workers
|
int
|
Maximum concurrent requests. |
DEFAULT_MAX_WORKERS
|
cache
|
MutableMapping[str, Any] | bool | None
|
Response cache, as for the zonal stats |
True
|
errors
|
Literal['raise', 'return']
|
|
'raise'
|
stream
|
bool
|
|
False
|
**options
|
Any
|
Other route options, e.g. |
{}
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If no item matches, the asset is neither GeoTIFF nor GeoParquet, or a vector dataset has no numeric column to default to. |
Covariates
¶
Covariates(client: MermaidClient)
Bases: BaseResource
The covariates catalog, as client.covariates.
path is the absolute STAC
API root, and catalog is the pystac-client Client opened
on it. The list of collections is fetched once per client and kept; pass
refresh=True to fetch it again.
Methods:
| Name | Description |
|---|---|
collections |
Every dataset in the catalog, in the catalog's order. |
collection |
One dataset by its exact id, e.g. |
search_collections |
Datasets whose id or title contains |
to_df |
A table of datasets, one row per collection (optionally filtered by |
search |
A pystac-client |
Attributes:
| Name | Type | Description |
|---|---|---|
path |
|
|
catalog |
Client
|
The pystac-client |
catalog
cached
property
¶
The pystac-client Client for the catalog, opened on first use.
collections
¶
collections(
*, refresh: bool = False
) -> list[CovariateCollection]
Every dataset in the catalog, in the catalog's order.
collection
¶
collection(collection_id: str) -> CovariateCollection
One dataset by its exact id, e.g. "daily_sst".
Raises:
| Type | Description |
|---|---|
APIError
|
If the catalog has no such collection. |
search_collections
¶
search_collections(query: str) -> list[CovariateCollection]
Datasets whose id or title contains query, ignoring case.
search_collections("sst") finds daily_sst, and
search_collections("bleaching") finds the heat stress products by title.
to_df
¶
A table of datasets, one row per collection (optionally filtered by query).
search
¶
search(
collections: str
| CovariateCollection
| Sequence[str | CovariateCollection]
| None = None,
**parameters: Any,
) -> ItemSearch
A pystac-client ItemSearch, usable as search= on any zonal stats endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collections
|
str | CovariateCollection | Sequence[str | CovariateCollection] | None
|
A collection id or
|
None
|
**parameters
|
Any
|
The other keyword arguments of
|
{}
|