add ability to list MSDs by date

This commit is contained in:
Sierra 2020-06-02 22:05:02 -04:00
parent abf3df9483
commit a010f842f8
2 changed files with 29 additions and 7 deletions

View File

@ -17,7 +17,10 @@ The maps only include the contiguous United States.
- fire, fire2, fire3: Fire Weather forecasts
- msd: Mesoscale Discussions: Overview of current active storms. Use
`spcget msd <map number>` for a detailed map of one area.
- msdlist: Lists the numbers for active MSD maps issued currently.
- msdlist: Lists the numbers for active MSD maps issued currently. Use
`spcget msdlist today` to see all issued MSDs for today, including
expired ones. Use `spcget msdlist 20200101` to see MSDs from
2020-01-01
- tstm, tstm2, tstm3, tstm4, tstmnow: Severe Thunderstorm forecasts
- watch: NOAA's current severe thunderstorm and tornado watches
- warnings: current National Weather Service advisories, watches and warnings

31
spcget
View File

@ -21,7 +21,10 @@ msd <map number> - Mesoscale Discussions:
in progress with more detailed information on those maps. Add the map
number to see a detailed map for a given area.
msdlist - List of currently issued MSDs.
msdlist <Ymd> or <today> - List of currently issued MSDs.
Use spcget msdlist today to see all issued MSDs from today, including expired ones.
Use spcget msdlist <date> to see all issued MSDs for any day.
Ex: spcget msdlist 20200101 to see the MSDs issued on 2020-01-01.
tstm, tstm2, tstm3, tstm4 - Thunderstorm Outlooks:
Chance for thunderstorms on a 6 point scale on days 1, 2, 3 and 4-8.
@ -54,12 +57,28 @@ case "$1" in
echo "For more detailed info, look up the specific map with spcget msd <map number>"
fi
;;
# get list of currently issued mesoscale discussions
# get list of currently issued mesoscale discussions, or by date
msdlist)
echo "Current Mesoscale Discussion Maps"
curl -s "https://www.spc.noaa.gov/products/md/"\
| grep -oh "\w*md\w*.html" | sed 's/md//g ;; s/.html//g' | uniq -u
exit 0
if [ ! -z "$2" ]; then
case "$2" in
today)
DATE=`date "+%Y%m%d"`
curl -s "https://www.spc.noaa.gov/cgi-bin-spc/getmd.pl?target=$DATE"\
| grep -oh "\w*md\w*.html" | sed 's/md//g ;; s/.html//g' | uniq
exit 0
;;
*)
curl -s "https://www.spc.noaa.gov/cgi-bin-spc/getmd.pl?target=$2"\
| grep -oh "\w*md\w*.html" | sed 's/md//g ;; s/.html//g' | uniq
exit 0
;;
esac
else
echo "Current Mesoscale Discussion Maps"
curl -s "https://www.spc.noaa.gov/products/md/"\
| grep -oh "\w*md\w*.html" | sed 's/md//g ;; s/.html//g' | uniq -u
exit 0
fi
;;
# thunderstorm outlooks, day 1, 2, 3, 4-8
tstm) GETURL="https://www.spc.noaa.gov/products/outlook/day1otlk.gif";;