Python library to streamline interaction with the ENVRI-Hub APIs, providing a pythonic facade to data and service access.
Project description
ENVRI Hub's VRE Library
This is the official ENVRI-Hub Python library, its purpose is to streamline interaction with the ENVRI-Hub APIs, providing a pythonic facade to data and service access.
Quickstart
After installing the package with a quick
pip install envrihub
You can start using the ENVRI-HUB resorces right away through the Hub object:
from envrihub import Hub
hub = Hub()
You can query it to retrieve resources that match your needs:
for res in hub.search_catalogue('bacon'):
print(res.title)
You can specify free text queries, time boundaries, geographic boundaries, data providers and/or variables you expect in your data. Here is an example of geographical search with a WKT polygon:
geography = 'POLYGON((10.70 48.34,
28.98 48.34
28.98 36.17,
10.70 36.17,
10.70 48.34))'
for i in hub.search_catalogue(geography = geography):
print(i.title)
Just type help(hub.seach_catalogue) for the full details.
You can also access a resurce directly if you know its unique identifier in the Catalogue of Services:
res = hub.fetch_from_catalogue('https://doi.org/10.14284/wormswebservice_distRecByVernacular')
Retrieved resources have the following properties:
title: a human readable title for the resource;uid: the resource's identifier in the Catalogue of Services;description: a human readable description of the resource;metadata: the whole EPOS-DCAT-AP metadata of the resource;dao: the data access object that allows you to get the actual data. All DAOs have anaccessmethod.
DAO objects are auto-generated according to the resource's metadata and can have additional methods to access data, when in doubt check them out with the help function:
help(res.dao)
If the resource is a Web Service, the DAO object allows to query such a service with all due parameters:
res = hub.fetch_from_catalogue('https://doi.org/10.14284/wormswebservice_distDistByAphiaId')
res.dao.access(id='138228')
Or if the resource is a static file it lets you download it either as a bytes object or directly to your file system.
res = hub.fetch_from_catalogue('file:///software/notebook/1107/Dataset/001/seadatanet88/Distribution/001')
byte_stream = res.dao.access() # bytes object
res.dao.download('path-to.file') # local file download
Digital kleptomaniacs rejoice! This means that with a handful of lines you can now scrape the whole ENVRI-HUB!
for res in hub.search_catalogue():
if res.is_downloadable():
res.dao.download(res.id)
for more working examples data access check out the ENVRI-HUB notebooks.
Contributing
To contribute, you have to attend ENVRI-Hub Next's WP14 monthly meetings. For now, if we never saw you, your pull requests will be rejected.
Acknowledgements
This project is funded by the ENVRI-Hub Next project. The project received funding from the European Union’s Horizon Europe research and innovation programme under grant agreement No 101131141.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file envrihub-0.1.4.tar.gz.
File metadata
- Download URL: envrihub-0.1.4.tar.gz
- Upload date:
- Size: 26.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
943e93bfd20fa47aebdb5670b71ebd664e8aefa6c79a2ed950bc4ac76871878b
|
|
| MD5 |
9bce085b1d5d936ee9782a6983e9bb17
|
|
| BLAKE2b-256 |
25a6f9f5a3a81cb18394a1fcccd164fa86abe4887a9e196e630d39d8ce14329f
|
File details
Details for the file envrihub-0.1.4-py3-none-any.whl.
File metadata
- Download URL: envrihub-0.1.4-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aac6b9b265e3525769b04591e52aa104e8c298ecc52314d67bc0b37f71e21356
|
|
| MD5 |
fd422bf2d6bec9c389e06f803d57c330
|
|
| BLAKE2b-256 |
5b112e139887fddc7d353cbd428b3868081c2e856dcf4a4c5caad25b88aaafa0
|