Skip to content

Instantly share code, notes, and snippets.

@amiel
Created August 19, 2022 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amiel/58a840d6a76a0df71efb50daa73e7289 to your computer and use it in GitHub Desktop.
Save amiel/58a840d6a76a0df71efb50daa73e7289 to your computer and use it in GitHub Desktop.
Aurora Forecast for Fairbanks, AK
#!/bin/bash
# This takes the maximum forecast between four points surrounding Fairbanks, AK.
# Paste this in to https://geojson.io/#map=9/64.5053/-147.4997 to see what those points are.
# { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ -147, 65 ]}, "properties": {} }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ -147, 64 ]}, "properties": {} }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ -148, 65 ]}, "properties": {} }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ -148, 64 ]}, "properties": {} } ] }
JQ=$(cat <<-JQ
{
forecast_time: ."Forecast Time" | fromdateiso8601 | strflocaltime("%H:%M (%Z)"),
aurora: [
.coordinates[]
| select((.[1] == 64 or .[1] == 65) and (.[0] == (360 - 147) or .[0] == (360 - 148)))
| .[2]
] | max
}
JQ
)
curl https://services.swpc.noaa.gov/json/ovation_aurora_latest.json |jq "$JQ"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment