Created
September 18, 2019 19:50
-
-
Save marcusrussi/a68aac0353a89b942c1864783f341fe3 to your computer and use it in GitHub Desktop.
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
| TOKEN='ATreGoqkKeGhBrqAHVbNNTychduhSkdg' | |
| TWEED='USW00014758' | |
| # Print header, then pull daily weather summary from Tweed's station | |
| echo 'date,daily_hi' && | |
| curl -sGH "token:$TOKEN" \ | |
| -d "stationid=GHCND:$TWEED" \ | |
| -d 'datasetid=GHCND' \ | |
| -d 'startdate=2019-09-10' \ | |
| -d 'enddate=2020-01-15' \ | |
| -d 'limit=1000' \ | |
| 'https://www.ncdc.noaa.gov/cdo-web/api/v2/data' | \ | |
| # Select the daily maximum temperature for each date, convert to ˚F, output as CSV | |
| jq -r '.results | map(select(.datatype == "TMAX")) | map([.date,(32+.18*.value)]) | map(join(",")) | join("\n")' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment