Python client library for the HERMES web service
Project description
HERMES Python Client
This Python client provides a simple interface to the HERMES API, allowing users to easily access and interact with the HERMES data.
Installation
You can install the client using pip:
pip install hermes-client
Generally, the client is compatible with the respective vMajor.minor version of the HERMES webservice. For example, the hermes-client version 0.1.x is compatible with the HERMES webservice version 0.1.x.
Usage
You will mainly interact with two client classes. The HermesClient as well as the ForecastSeriesClient. The former should mainly be used to explore the available Projects and Forecastseries, while the latter can be used to access the data linked to specific ForecastSeries, Forecasts and ModelRuns.
Find the correct ForecastSeries
To find the correct ForecastSeries, you can use the HermesClient to search for ForecastSeries by name or other attributes. For example:
from hermes_client import HermesClient
client = HermesClient(url="https://example.com/api/")
projects = client.list_projects()
projects
This will return a list of available projects.
[{'oid': 'c9d163c4-02ea-4d4d-9ef5-26e82c025c92',
'name': 'project_induced',
'starttime': '2022-04-21T00:00:00',
'endtime': '2022-04-21T23:59:59',
'description': 'This is a test project',
'creationinfo': {'creationtime': '2025-05-22T16:51:41'}},
...
Likewise, you can list all ForecastSeries within a project:
forecastseries = client.list_forecastseries(project="project_induced")
Which will again return a list of ForecastSeries
[{'oid': 'c9d163c4-02ea-4d4d-9ef5-26e82c025c92',
'name': 'forecastseries_induced',
...
},
...
]
Access ForecastSeries data
Once you have identified the correct ForecastSeries, you can use the ForecastSeriesClient to access the data. For example:
from hermes_client import ForecastSeriesClient
client = ForecastSeriesClient(
url="https://example.com/api/",
forecastseries="c9d163c4-02ea-4d4d-9ef5-26e82c025c92"
)
client.forecasts
Which will return a list of ForecastClient objects, each allowing you to access the data for a specific forecast:
[Forecast(COMPLETED, 2022-04-21 15:00:00, 2022-04-21 18:00:00),
Forecast(COMPLETED, 2022-04-21 16:00:00, 2022-04-21 18:00:00),
Forecast(COMPLETED, 2022-04-21 17:00:00, 2022-04-21 18:00:00)]
You can then access the data for a specific forecast by using the ForecastClient:
forecast = client.forecasts[0]
injectionplan_name = forecast.metadata.injectionplans[0]
model_name = forecast.metadata.modelconfigs[0]
results = forecast.get_results(injectionplan_name, model_name)
This will return a ForecastGRRateGrid object (or ForecastCatalog, depending on the model result types).
Further Information
For more information on the available methods and attributes, please refer to the API reference.
The documentation will be extended in the future to include more examples and use cases - The API Reference should however give a good overview of the available methods and attributes.
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 hermes_client-1.0.0.tar.gz.
File metadata
- Download URL: hermes_client-1.0.0.tar.gz
- Upload date:
- Size: 259.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f5ce596762c4b88e7d27d4980ef845df176af5888e5dcafac47f398f9137e6e
|
|
| MD5 |
df8897aa0cd3922d838d7e2155203385
|
|
| BLAKE2b-256 |
54d38cf8f213c0877fcac02756424e8c7ead8702b300d344b85d662f47fa3a26
|
Provenance
The following attestation bundles were made for hermes_client-1.0.0.tar.gz:
Publisher:
publish.yml on swiss-seismological-service/hermes-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hermes_client-1.0.0.tar.gz -
Subject digest:
4f5ce596762c4b88e7d27d4980ef845df176af5888e5dcafac47f398f9137e6e - Sigstore transparency entry: 222122756
- Sigstore integration time:
-
Permalink:
swiss-seismological-service/hermes-client@6d7b76c95a9e620cddca1268583f8122131ab75d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/swiss-seismological-service
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6d7b76c95a9e620cddca1268583f8122131ab75d -
Trigger Event:
push
-
Statement type:
File details
Details for the file hermes_client-1.0.0-py3-none-any.whl.
File metadata
- Download URL: hermes_client-1.0.0-py3-none-any.whl
- Upload date:
- Size: 43.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffc274f1aeaaca91e6c123720597758827f5c1f9f876d48b9bb4e75ce60e7798
|
|
| MD5 |
4a2b9b347812145f46eaa047cff3b26a
|
|
| BLAKE2b-256 |
44cc3076517de16ccaeb938cfa8ad7e5e455613251998a31eb492f63b0040474
|
Provenance
The following attestation bundles were made for hermes_client-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on swiss-seismological-service/hermes-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hermes_client-1.0.0-py3-none-any.whl -
Subject digest:
ffc274f1aeaaca91e6c123720597758827f5c1f9f876d48b9bb4e75ce60e7798 - Sigstore transparency entry: 222122770
- Sigstore integration time:
-
Permalink:
swiss-seismological-service/hermes-client@6d7b76c95a9e620cddca1268583f8122131ab75d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/swiss-seismological-service
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6d7b76c95a9e620cddca1268583f8122131ab75d -
Trigger Event:
push
-
Statement type: