Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
multiweatherapi
Readme
Consistent Python bindings for select commercial weather station APIs, such as Zentra Cloud REST API v3, created for MSU EnviroWeather Project.
This is inspired by python bindings for v1 of the Zentra API from the Montana Climate office : MSU Agricultural Weather Office
The EnviroWeather system from the MSU Agricultural Weather Office will interface with weather stations (select list of vendors) deployed and owned privately. Since each vendor has a differrent REST/Web API to access station's weather data, this package aims to provide a consistent interface to all of those stations in order to make it easy for incoporating them into a data pipeline.
The Multi-Weather API is currently available on PyPI. Install using pip
:
pip install multiweatherapi
>>> from multiweatherapi import multiweatherapi
>>> param = {'sn': 'STATION_ID',
... 'apikey': 'API_KEY',
... 'apisec': 'API_SECRET'}
>>> resp = multiweatherapi.get_reading('davis', **param)
>>> resp.resp_raw # raw JSON response of the reading
>>> resp.resp_parsed # parsed JSON response into list of dict for EnviroWeather project
Refer to the respective link below for parameter and authentication requirements of weather station vendor APIs
Python 3.6 and higher are supported.
Currently following time zones are supported:
Name | Description |
---|---|
HT | US/Hawaii |
AT | US/Alaska |
PT | US/Pacific |
MT | US/Mountain |
CT | US/Central |
ET | US/Eastern |
API Response (JSON)
The (raw) API response is formatted in JSON and 0th element illustrates the metadata of the API call and 1st (and onward - Davis stations) element(s) depicts weather station measurements retrieved from the API call.
[
{
"vendor": "spectrum",
"station_id": "50400123",
"start_datetime": "2022-05-26 12:08:07",
"end_datetime": "2022-05-26 13:08:07",
"timezone": "ET",
"request_time": "2022-05-27 12:08:07",
"python_binding_version": "0.0.17"
},
{
"EquipmentRecords": [
{
"SerialNumber": "50400123",
"TimeStamp": "2022-05-26T16:10:00",
"SensorData": [
{
"ChannelNumber": 0,
"PortNumber": "A",
"SensorNumber": 0,
"SensorType": "Rainfall",
"TimeStamp": "2022-05-26T16:10:00",
"FormattedTimeStamp": "2022-05-26 16:10",
"Value": "0.00",
"AccumlatedValue": "0.00",
"DecimalValue": 0.0,
"AccumlatedDecimalValue": 0.0,
"Units": "inches",
"ValueType": "Average"
},
...
}
]
Transformed Response (List of Dict)
The transformed response is formatted in list
(array) of Python dict
object. Each dict
object consists of that measurements that stakeholders are interested in and the metadata that would be used to facilitate data loading into the backend.
[
{
"station_id": "50400123",
"request_datetime": "2022-05-27 12:08:07",
"pcpn": 0.0,
"data_datetime": "2022-05-26 16:10",
"atemp": 21.0,
"relh": "92.3"
},
...
]
Released under the MIT License
If you want to test without installing via PIP, there is a script
get_sample_data.py
in the main directory which requires a configuration file named '.env' in the root folder.
$ pip install -r requirements.txt
$ python get_sample_data.py rainwise /Users/jhp/Desktop/
Please refer to docs/get_sample_data.md for detail documentation of get_sample_data.py
see also docs/Test Suite Doco.py for more formal tests and how to provide station configuration file
FAQs
Python bindings to multiple weather station vendor APIs
We found that multiweatherapi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.