Last active
August 3, 2019 07:24
-
-
Save lyoshenka/8472a31c60b6ba0c778c to your computer and use it in GitHub Desktop.
Probability that it will rain near you in the next half-hour
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires python, jq | |
# get your API key from https://developer.forecast.io/ | |
API_KEY= | |
# enter the latitude and longitude for your location | |
LAT= | |
LNG= | |
CHANCE=$( curl -s https://api.forecast.io/forecast/API_KEY/LAT,LNG?exclude=hourly,daily,alerts,flags | jq .minutely.data[].precipProbability | head -n 30 | python -c 'import sys; print(max(float(x) for x in sys.stdin.readlines()))' ) | |
if [[ $CHANCE > .6 ]]; then | |
# alert somehow | |
# save the fact that we alerted, then don't do it for the next X minutes | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment