Skip to main content

GFZ Helmholtz Centre for Geosciences Web Service API Client

Project description

GFZ Helmholtz Centre for Geosciences Web Service API Client

Description

Unofficial client for Helmholtz Centre for Geosciences Web Service API. For getting Geomagnetic Index (Kp, etc) Nowcast and Forecast data (https://spaceweather.gfz-potsdam.de/products-data/forecasts/forecast-kp-index). Kp is an important measure for the energy input from the solar wind to Earth and it is used by space weather services in near real-time. The geomagnetic Hpo index is a Kp-like index with a time resolution of half an hour, called Hp30, and one hour, called Hp60.

Official API description : https://kp.gfz-potsdam.de/en/data

Python 3.10+ requires

Features

  • Getting geomagnetic index forecast (as a Dict)
  • Getting geomagnetic three-hourly index for period (as a Dict)
  • Getting geomagnetic three-hourly index for period as a Tuple (like an official client by GFZ German Research Centre for Geosciences)

Classes

Library provides Classic and Asynchronous client classes for using in python applications:

GFZClient - Classic client class for Web Service API

GFZAsyncClient - Asynchronous client class for Web Service API

Methods

get_forecast(index)

Returns Dict with Index prediction dataset. Parameter index define index for data request. Should be in ('Kp','Hp30', 'Hp30')

get_nowcast(start_time, end_time, index, [data_state])

Returns Dict with geomagnetic three-hourly Index for period. Parameters start_time and end_time defines time period. Both should be string with UTC date/time, format: 'YYYY-MM-DD' or 'YYYY-MM-DDThh:mm:ss' Parameter index define index for data request. Should be in ('Kp', 'ap', 'Ap', 'Cp', 'C9', 'Hp30', 'Hp60', 'ap30', 'ap60', 'SN', 'Fobs', 'Fadj') Optional Parameter data_state define index state. Possible values: 'def', 'all'. Output of definitive values only (only for Kp, ap, Ap, Cp, C9, SN)

get_kp_index(starttime, endtime, index, [status])

Returns tuple with geomagnetic three-hourly Index for period or (0, 0, 0) in an Error case. Parameters starttime and endtime defines time period. Both should be string with UTC date/time, format: 'YYYY-MM-DD' or 'YYYY-MM-DDThh:mm:ss' Parameter index define index for data request. Should be in ('Kp', 'ap', 'Ap', 'Cp', 'C9', 'Hp30', 'Hp60', 'ap30', 'ap60', 'SN', 'Fobs', 'Fadj') Optional Parameter status define index state. Possible values: 'def', 'all'. Output of definitive values only (only for Kp, ap, Ap, Cp, C9, SN)

Method get_kp_index implements getKpindex method from official python client with same behaviour and added for compatibility purposes

How to use

Installation

pip install gfz-api-client

Classic client

from gfz_client import GFZClient

client = GFZClient()

# Get geomagnetic index forecast
data = client.get_forecast(index="Kp")

# Get geomagnetic three-hourly Kp index for period
data = client.get_nowcast(start_time="2011-11-04T00:05:23", end_time="2011-11-04T00:05:23", index="Kp")

# Get geomagnetic three-hourly Kp index for period as a tuple
data = client.get_kp_index(starttime="2011-11-04T00:05:23Z", endtime="2011-11-04T00:05:23Z", index="Kp")

Asynchronous client

from gfz_client import GFZAsyncClient

client = GFZAsyncClient()

# Get geomagnetic index forecast
data = await client.get_forecast(index="Kp")

# Get geomagnetic three-hourly Kp index for period
data = await client.get_nowcast(start_time="2011-11-04T00:05:23Z", end_time="2011-11-04T00:05:23Z", index="Kp")

# Get geomagnetic three-hourly Kp index for period as a tuple
data = await client.get_kp_index(starttime="2011-11-04T00:05:23", endtime="2011-11-04T00:05:23", index="Kp")

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

gfz_api_client-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

gfz_api_client-0.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file gfz_api_client-0.1.0.tar.gz.

File metadata

  • Download URL: gfz_api_client-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.11

File hashes

Hashes for gfz_api_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 55828faad1d89f3af0a9924bcdc19de190c4e9cdeaee7cfb685ad4fda445371b
MD5 7b3e499bd09d83e93db35bfb8c2040c8
BLAKE2b-256 55acfb7efe65db404c7fa27f7b6e17c375b785f6136ff86d61609c6239587c2e

See more details on using hashes here.

File details

Details for the file gfz_api_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gfz_api_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.11

File hashes

Hashes for gfz_api_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b591461d03e148269a52c4b48c6b211e2e573f67eac10fd6817209ab2cf8868
MD5 e372b0b9672caa13ef535b5f28629c13
BLAKE2b-256 2c55fd36b12d0692f8fa8835e439acc961ca3e90ec0c233fb783582f2ff2b575

See more details on using hashes here.

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