eumap.datasets.catalogue.Catalogue

class Catalogue(use_csw=True)[source]

Bases: object

Quick access to all Geoharmonizer data products catalogued on the project’s GeoNetwork server.

Provides resources with metadata either live from GeoNetwork [1, 2] (with included access to the raw OWSLib API [3] through Catalogue.csw) or from a local copy of the record included in the package (which might not always be up to date).

Parameters

use_csw (bool) – Indicates wheather to use live GeoNetwork access via CSW (the default) or to fall back to the local copy of the record (faster but might not be up to date).

For full usage examples please refer to the catalogue tutorial notebook [4].

References

[1] Geoharmonizer GeoNetwork server

[2] GeoNetwork

[3] OWSLib CSW API

[4] Catalogue tutorial

Examples

>>> from eumap.datasets import Catalogue
>>>
>>> cat = Catalogue()
>>> results = cat.search('land-cover')
>>> print(results)

Methods

search

Search the catalogue for resources by matching metadata with keywords.

Attributes

GEONETWORK_URL

Geoharmonizer GeoNetwork CSW API endpoint.

KEYWORD_SEPARATORS

Default separators used to tokenize keywords.

csw

Access to the raw OWSLib CSW API.

themes

Provides a list of all themes in the catalogue.

GEONETWORK_URL = 'https://data.opendatascience.eu/geonetwork/srv/eng/csw?service=csw&version=2.0.2'

Geoharmonizer GeoNetwork CSW API endpoint.

KEYWORD_SEPARATORS = ' _-,;\t\n'

Default separators used to tokenize keywords.

The Catalogue.search method splits both e.g. 'land-cover' and 'land cover' into ['land', 'cover'] and maches the tokens individually (if split_keywords=True).

csw = None

Access to the raw OWSLib CSW API.

If Catalogue is initialized with use_csw=True (the default) this becomes an owslib.csw.CatalogueServiceWeb instance, and is otherwise None.

search(*args, years=[], exclude=[], frmt=[], split_keywords=True, key='title')[source]

Search the catalogue for resources by matching metadata with keywords.

Returns a list of resources with key matching *args, from years, and excluding those matchin keywords in exclude.

For full usage examples please refer to the catalogue tutorial notebook.

Parameters
  • *args

    Keywords to match.

  • years (Iterable[int]) – Years to match.

  • exclude (Iterable[str]) – Keywords to match for exclusion of resources.

  • frmt (Iterable[str]) – Formats to match (default: [“GeoTIFF”]). Supported formats: “GeoTIFF”, “OGC WMS”, “OGC WFS”. Only supported by CSW implementation.

  • split_keywords (bool) – Wheather or not to split keywords by Catalogue.KEYWORD_SEPARATORS and match tokens individually.

  • key (str) – Which metadata field to match with *args. Can be 'title', 'theme', 'abstract', 'url' (case insensitive).

Returns

List of resources (URL strings) with attached metadata (see tutorial)

Return type

_ResourceCollection

property themes

Provides a list of all themes in the catalogue.

Accessing for the first time might take up to several seconds if use_csw=True.