Python wrapper for the frost.met.no API
Project description
frost-client
This Python client wraps the Frost API. You should read up on those docs before using this client. And be sure to check out met.no's Terms of Use
The main purpose of this client is returns Pandas Dataframes from Frost API data.
This is an unofficial client. We have no relationship to met.no
Documentation: https://frost-client.readthedocs.io/en/latest/
Install
Requires Python 3.7
pip install frost-client
or
pipenv install frost-client
This will install the frost-client and Pandas.
Usage
The Frost API key should be exposed as a environment variable:
FROST_API_KEY=xxxxxx
or passed as a username parameter when creating and instance of the class.
Get weather data sources
Get all available observation sources (stations) for Hordaland county (12)
from frost.client import APIError, Frost
f = Frost()
res = f.get_sources(county='12')
# return as Pandas Dataframe
df = res.to_df()
# return IDs of sources as list
ids = res.to_ids_list()
Get available time series
Display available time series for a station (here Bergen - Florida)
from frost.client import APIError, Frost
f = Frost()
res = f.get_available_timeseries(sources=['SN50540'])
# return as Pandas Dataframe
df = res.to_df()
Get observations
Display observations for a station (here Bergen - Florida)
from frost.client import APIError, Frost
f = Frost()
res = f.get_observations(
sources=['SN50540'],
elements=['sum(precipitation_amount P1D)'],
timeoffsets=['PT6H'],
referencetime='2018-01-01/2018-02-01')
df = res.to_df()
See tests for more examples.
Local development
You should use pipenv
Tests
Enable the pipenv with
pipenv shell
Make sure to export env variable
FROST_API_KEY=xxxxxx
To run all tests:
nosetests
To run specific tests:
nosetests tests.test_requests:TestFrostRequests.test_get_sources
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
Built Distribution
Hashes for frost_client-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d78c84c3af31515699cc0807f4fca7d7e9a6db76de8d4a21740d4cd27bb28d47 |
|
MD5 | ea309a23731ae725b0a7886b23bd4968 |
|
BLAKE2b-256 | 619c566a389bcc7fdb4f8ee0dcbe5747c7572c3438f8b650c649efb8857cad95 |