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
Examples
>>> from eumap.datasets import Catalogue >>> >>> cat = Catalogue() >>> results = cat.search('land-cover') >>> print(results)
Methods
Search the catalogue for resources by matching metadata with keywords.
Attributes
Geoharmonizer GeoNetwork CSW API endpoint.
Default separators used to tokenize keywords.
Access to the raw OWSLib CSW API.
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 (ifsplit_keywords=True
).
- csw = None¶
Access to the raw OWSLib CSW API.
If
Catalogue
is initialized withuse_csw=True
(the default) this becomes anowslib.csw.CatalogueServiceWeb
instance, and is otherwiseNone
.
- 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
, fromyears
, and excluding those matchin keywords inexclude
.For full usage examples please refer to the catalogue tutorial notebook.
- Parameters
*args –
Keywords 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 byCatalogue.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
.