Synoptic's Weather API provides real-time and historical surface-based weather and environmental observations thousands of mesonet stations, and the open-access data is free. More data and enhanced services may be purchased (from Synoptic, not me).
I'm a Synoptic user. I wrote this package to conveniently request data from Synoptic in a Pythonic way and convert its returned JSON to a Polars DataFrame.
from datetime import timedelta
from synoptic import TimeSeries
df = TimeSeries(
stid="wbb",
recent=timedelta(minutes=30)
).df()
I'm sharing this package to improve my skills with Polars and gain more experience in building and maintaining open-source Python packages. If you came across this package, I hope you find it valuable.
Best of Luck 🍀
-Brian
🐍 Install
pip install SynopticPy
conda install -c conda-forge synopticpy
Configure Token
[!IMPORTANT]
There are three ways you can configure your Synoptic API token:
- Set an environment variable
SYNOPTIC_TOKEN
with your token. For example, in bash:
export SYNOPTIC_TOKEN="yourTokenHere123456789"
- Create a file
~/.config/SynopticPy/config.toml
with the following
token = "yourTokenHere123456789"
- Pass your token whenever you use one of SynopticPy's classes.
TimeSeries(
stid="wbb",
recent=30,
token="yourTokenHere123456789"
)
How to Cite and Acknowledge
If SynopticPy played an important role in your work, please tell me about it! Also, consider including a citation or acknowledgement in your article or product.
Suggested Citation
Blaylock, B. K. (YEAR). SynopticPy: Synoptic API for Python (Version 20??.?.?) [Computer software]. https://github.com/blaylockbk/SynopticPy
Suggested Acknowledgment
A portion of this work used code generously provided by Brian Blaylock's SynopticPy Python package (https://github.com/blaylockbk/SynopticPy)
[!TIP]
📈 See also my SynopticPy Web App which lets you plot station data in your browser powered by pyscript!