wcs.model

Classes holding information about coverages on a WCS server.

Attributes

BoundType

Type for axis interval bounds.

Exceptions

WCSClientException

An exception thrown by this library.

Classes

BasicCoverage

Holds basic coverage information extracted from the WCS GetCapabilities

FullCoverage

Holds full coverage information extracted from the WCS DescribeCoverage.

Axis

An axis with a name, low/upper bounds, a CRS, uom, resolution, coefficients.

BoundingBox

The bounding box of a coverage, containing low/high limits of all its axes.

RangeType

Represents the range type of a coverage, indicating the structure of the data.

Field

A field (also known as band, or channel) in a coverage range type (RangeType)

NilValue

Represents a null value with an optional reason.

Crs

Utility class for handling CRS.

Module Contents

BoundType[source]

Type for axis interval bounds.

class BasicCoverage(name, subtype=None, bbox=None, lon_lat=None, size_bytes=None, additional_params=None)[source]

Holds basic coverage information extracted from the WCS GetCapabilities document, notably the WGS bounding box if provided.

Parameters:
  • name (str) – the coverage name.

  • subtype (str) – coverage subtype, e.g. ‘ReferenceableGridCoverage’

  • bbox (BoundingBox) – bounding box in native CRS

  • lon_lat (tuple[Axis, Axis]) – a tuple of longitude / latitude axes respresenting the WGS84 bounding box of the coverage

  • size_bytes (int) – coverage size in bytes; None if not reported by the server

  • additional_params (dict[str, str]) – additional key/value parameters

name[source]

Coverage name

subtype = None[source]

Coverage subtype, e.g. ReferenceableGridCoverage

bbox = None[source]

Bounding box of all coverage axes in native CRS

size_bytes = None[source]

Coverage size in bytes; None if not reported by the server

additional_params = None[source]

A dictionary of additional key/value parameters if reported by the server

is_local()[source]
Returns:

True if the coverage is local on the server, False if it’s remote.

Return type:

bool

is_remote()[source]
Returns:

True if the coverage is not local on the server, False otherwise.

Return type:

bool

class FullCoverage(name, bbox, grid_bbox, range_type, metadata=None)[source]

Holds full coverage information extracted from the WCS DescribeCoverage.

Parameters:
  • name (str) – the coverage name.

  • bbox (BoundingBox) – bounding box in native CRS

  • grid_bbox (BoundingBox) – grid bounding box

  • range_type (RangeType) – coverage range type

  • metadata (dict)

name[source]
bbox[source]
grid_bbox[source]
range_type[source]
metadata[source]
is_local()[source]
Returns:

True if the coverage is local on the server, False if it’s remote.

Return type:

bool

is_remote()[source]
Returns:

True if the coverage is not local on the server, False otherwise.

Return type:

bool

class Axis[source]

An axis with a name, low/upper bounds, a CRS, uom, resolution, coefficients.

A subset of the coefficients (axis coordinates) can be retrieved with the [] operator, e.g. for an irregular temporal axis: axis[“2024-01-01” : “2024-01-31”]. See __getitem__() for more details.

Parameters:
  • name – Name of the axis.

  • low – Lower bound of the axis.

  • high – Upper bound of the axis.

  • crs – Coordinate Reference System, e.g., “EPSG:4326”.

  • uom – Unit of measure, e.g., “degree”.

  • resolution – Axis resolution, for regular axes.

  • coefficients – Axis coefficients for irregular axes.

name: str[source]
low: BoundType[source]
high: BoundType[source]
crs: str | None = None[source]
uom: str | None = None[source]
resolution: BoundType | None = None[source]
coefficients: list[BoundType] | None = None[source]
is_temporal()[source]

Returns: True if this axis is a temporal axis (e.g. ansi), False otherwise.

Return type:

bool

is_spatial()[source]

Returns: True if this axis is a spatial axis (e.g. Lat, Lon, E, N), False otherwise.

Return type:

bool

is_irregular()[source]

Returns: True if this axis is an irregular axis, False otherwise.

Return type:

bool

is_regular()[source]

Returns: True if this axis is a regular axis, False otherwise.

Return type:

bool

get_coefficients()[source]
Returns:

a list of coefficients, automatically generated if this is a regular axis.

Return type:

list[BoundType]

class BoundingBox(axes, crs)[source]

The bounding box of a coverage, containing low/high limits of all its axes.

The axes can be accessed through the axes attribute, or through the subscript operator, e.g.

bbox[1]      # get the second axis
bbox['Lat']  # get the axis with name Lat
Parameters:
  • crs (Optional[str]) – native CRS of the axis coordinates

  • axes (list[Axis]) – a list of Axis objects

axes[source]
crs[source]
class RangeType(fields)[source]

Represents the range type of a coverage, indicating the structure of the data.

The range type consists of a list of field types (Field). The fields can be accessed through the fields attribute, or through the subscript operator, e.g.

range_type[1]      # get the second field
range_type['blue']  # get the field with name blue
Parameters:

fields – A list of Field objects describing the fields (also known as bands or channels) of a coverage.

fields: list[Field][source]

A list of Field objects corresponding to the bands of the coverage.

class Field[source]

A field (also known as band, or channel) in a coverage range type (RangeType)

It can be either a quantity or a category. It includes information about the field’s name, definition, label, description, codespace (only Category), unit of measure (only Quantity), and any nil values.

Parameters:
  • name – The name of the field. This can be used to subset bands in WCS GetCoverage requests or WCPS queries.

  • is_quantity – Indicates whether this field is a Quantity (True) or a Category (False). Defaults to True.

  • definition – A URI that can be resolved to the complete human-readable definition of the property that is represented by the data component.

  • label – Short human-readable information about the data component.

  • description – A human-readable description of the data.

  • codespace – A URL to an external dictionary, taxonomy, or ontology representing the code space. This attribute is only set for category data, i.e., when is_quantity is False.

  • uom – The unit of measure for this data.

  • nil_values – A list of nil values associated with this field.

name: str[source]

Field name that can be used to subset bands in WCS GetCoverage or WCPS queries.

is_quantity: bool = True[source]

True if this field is a Quantity, False if it’s a Category.

definition: str = None[source]

A URI that can be resolved to the complete human readable definition of the property that is represented by the data component.

label: str = None[source]

Short human readable information about the data component.

description: str = None[source]

Human-readable description of the data.

codespace: str = None[source]

URL to an external dictionary, taxonomy or ontology representing the code space. Only set for category data, i.e. is_quantity is False.

uom: str = None[source]

Unit of measure for this data.

nil_values: list[NilValue] = None[source]

A list of nil values.

class NilValue[source]

Represents a null value with an optional reason.

Parameters:
  • nil_value – The null value itself, represented as a string.

  • reason – An optional explanation for why the value is null. This is useful for providing context or documentation about the null value.

nil_value: str[source]
reason: str | None[source]
class Crs[source]

Utility class for handling CRS.

static to_short_notation(url)[source]

Parse CRS identifiers in this notation.

Parameters:

url (Optional[str]) –

a CRS identifier, e.g.

Returns:

Short CRS notation, e.g. EPSG:4326; None if input is None or the method fails to parse the url.

Return type:

Optional[str]

exception WCSClientException[source]

Bases: Exception

An exception thrown by this library.

Initialize self. See help(type(self)) for accurate signature.