birdy.client.converters module

class birdy.client.converters.BaseConverter(output: owslib.wps.Output = None, path: str | Path | None = None, verify: bool = True)[source]

Bases: object

_check_import(name: str, package: str | None = None)[source]

Check if libraries can be imported.

Parameters:
  • name (str) – module name to try to import.

  • package (str) – package of the module.

check_dependencies()[source]
convert()[source]

To be subclassed.

property data

Return the data from the remote output in memory.

extensions = ()
property file

Return output Path object. Download from server if not found.

mimetypes = ()
nested = False
priority = None
class birdy.client.converters.GenericConverter(output: owslib.wps.Output = None, path: str | Path | None = None, verify: bool = True)[source]

Bases: BaseConverter

convert()[source]

Return raw bytes memory representation.

priority = 0
class birdy.client.converters.GeoJSONConverter(output: owslib.wps.Output = None, path: str | Path | None = None, verify: bool = True)[source]

Bases: BaseConverter

check_dependencies()[source]
convert()[source]

To be subclassed.

extensions = ['json', 'geojson']
mimetypes = ['application/geo+json', 'application/vnd.geo+json']
priority = 2
class birdy.client.converters.GeotiffGdalConverter(output: owslib.wps.Output = None, path: str | Path | None = None, verify: bool = True)[source]

Bases: BaseConverter

check_dependencies()[source]
convert()[source]

To be subclassed.

extensions = ['tiff', 'tif']
mimetypes = ['image/tiff; subtype=geotiff']
priority = 1
class birdy.client.converters.GeotiffRioxarrayConverter(output: owslib.wps.Output = None, path: str | Path | None = None, verify: bool = True)[source]

Bases: BaseConverter

check_dependencies()[source]
convert()[source]

To be subclassed.

extensions = ['tiff', 'tif']
mimetypes = ['image/tiff; subtype=geotiff']
priority = 3
class birdy.client.converters.ImageConverter(output: owslib.wps.Output = None, path: str | Path | None = None, verify: bool = True)[source]

Bases: BaseConverter

check_dependencies()[source]
convert()[source]

To be subclassed.

extensions = ['png']
mimetypes = ['image/png']
priority = 1
class birdy.client.converters.JSONConverter(output: owslib.wps.Output = None, path: str | Path | None = None, verify: bool = True)[source]

Bases: BaseConverter

convert()[source]

To be subclassed.

extensions = ['json']
mimetypes = ['application/json']
priority = 1
class birdy.client.converters.MetalinkConverter(output: owslib.wps.Output = None, path: str | Path | None = None, verify: bool = True)[source]

Bases: BaseConverter

check_dependencies()[source]
convert()[source]

To be subclassed.

extensions = ['metalink', 'meta4']
mimetypes = ['application/metalink+xml; version=3.0', 'application/metalink+xml; version=4.0']
nested = True
priority = 1
class birdy.client.converters.Netcdf4Converter(output: owslib.wps.Output = None, path: str | Path | None = None, verify: bool = True)[source]

Bases: BaseConverter

check_dependencies()[source]
convert()[source]

To be subclassed.

extensions = ['nc', 'nc4']
mimetypes = ['application/x-netcdf']
priority = 1
class birdy.client.converters.ShpFionaConverter(output: owslib.wps.Output = None, path: str | Path | None = None, verify: bool = True)[source]

Bases: BaseConverter

check_dependencies()[source]
convert()[source]

To be subclassed.

mimetypes = ['application/x-zipped-shp']
priority = 1
class birdy.client.converters.ShpOgrConverter(output: owslib.wps.Output = None, path: str | Path | None = None, verify: bool = True)[source]

Bases: BaseConverter

check_dependencies()[source]
convert()[source]

To be subclassed.

extensions = ['zip']
mimetypes = ['application/x-zipped-shp']
priority = 2
class birdy.client.converters.TextConverter(output: owslib.wps.Output = None, path: str | Path | None = None, verify: bool = True)[source]

Bases: BaseConverter

convert()[source]

Return text content.

extensions = ['txt', 'csv', 'md', 'rst']
mimetypes = ['text/plain']
priority = 1
class birdy.client.converters.XarrayConverter(output: owslib.wps.Output = None, path: str | Path | None = None, verify: bool = True)[source]

Bases: BaseConverter

check_dependencies()[source]
convert()[source]

To be subclassed.

extensions = ['nc', 'nc4']
mimetypes = ['application/x-netcdf']
priority = 2
class birdy.client.converters.ZipConverter(output: owslib.wps.Output = None, path: str | Path | None = None, verify: bool = True)[source]

Bases: BaseConverter

convert()[source]

To be subclassed.

extensions = ['zip']
mimetypes = ['application/zip']
nested = True
priority = 1
birdy.client.converters._find_converter(mimetype=None, extension=None, converters=())[source]

Return a list of compatible converters ordered by priority.

birdy.client.converters.all_subclasses(cls)[source]

Return all subclasses of a class.

birdy.client.converters.convert(output: owslib.wps.Output | Path | str, path: str | Path, converters: Sequence[BaseConverter] = None, verify: bool = True)[source]

Convert a file to an object.

Parameters:
  • output (owslib.wps.Output, Path, str) – Item to convert to an object.

  • path (str, Path) – Path on disk where temporary files are stored.

  • converters (sequence of BaseConverter subclasses) – Converter classes to search within for a match.

  • verify (bool) – Whether to perform verification. Default: True.

Returns:

Python object or file’s content as bytes.

Return type:

Any

birdy.client.converters.find_converter(obj: owslib.wps.Output | str | Path, converters: Sequence[BaseConverter]) list[source]

Find converters for a WPS output or a file on disk.

Parameters:
  • obj (owslib.wps.Output or str or Path) – Object to convert.

  • converters (sequence of BaseConverter subclasses) – Converter classes to search within for a match.

Returns:

A list of compatible converters ordered by priority.

Return type:

list