Skip to main content

Python client library for the HERMES web service

Project description

pypi PyPI - License PyPI - Python Version test codecov Documentation Status

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hermes_client-1.0.1.tar.gz (259.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hermes_client-1.0.1-py3-none-any.whl (43.4 kB view details)

Uploaded Python 3

File details

Details for the file hermes_client-1.0.1.tar.gz.

File metadata

  • Download URL: hermes_client-1.0.1.tar.gz
  • Upload date:
  • Size: 259.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hermes_client-1.0.1.tar.gz
Algorithm Hash digest
SHA256 42611a78234c403657c0f528a3131613cd999ee294a2b6fbf645b13582341743
MD5 607697798f8c66a0fffbb83dd75e1ffe
BLAKE2b-256 2cd7c5999c18cbb70669d16de67d4cdf3c32b38a83fa5ec1e423e725fc669e3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for hermes_client-1.0.1.tar.gz:

Publisher: publish.yml on swiss-seismological-service/hermes-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hermes_client-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: hermes_client-1.0.1-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.13.7

File hashes

Hashes for hermes_client-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 053263f805fdf8ed0f25c35b8e69f97241245fcc6506f1a41a65636579a37fd2
MD5 8112730fb05782fa3fc8a6c950352446
BLAKE2b-256 b6c530321bdf4c087cc8a2296757238b134164bec78be04bf9acaf10fb992592

See more details on using hashes here.

Provenance

The following attestation bundles were made for hermes_client-1.0.1-py3-none-any.whl:

Publisher: publish.yml on swiss-seismological-service/hermes-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page