summaryrefslogtreecommitdiff
path: root/bin/sat
blob: aa607e5858bf7b75b08e639970b9b4009207b253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/sh
#baseurl="https://aviationweather.gov/data/obs/sat/us"
baseurl="https://aviationweather-bldr.ncep.noaa.gov/data/obs/sat/us/"

viewurl() {
	mpv --no-osc --loop-file=inf $1 > /dev/null 2>&1 & exit
}

emitsites() {
cat << EOF
abq:Albuquerque, NM
ak:Alaska
alb:Albany, NY
aus:Austin, TX
bwi:Baltimore, MD
carib:Caribbean
clt:Charlotte, NC
cod:Yellowstone
den:Denver, CO
dtw:Detroit, MI
evv:Evansville, ID
gulf:Gulf of Mexico
hi:Hawaii
ict:Wichita, KS
las:Las Vegas, NV
lit:Little Rock, AR
lws:Leniston, ID
mgm:Montgomery, AL
msp:Minneapolis, MN
pir:Pierre, SD
tpa:Tampa, FL
wmc:Winnemacca, NV
us:Contiguous United States
EOF
}

emitproducts() {
cat << EOF
irbw:Infrared (black & white)
ircol:Infrared (color)
irnws:Infrared (NWS overlay)
vis:Visible light
wv:Water vapor
EOF
}

help() {
cat << EOF
sat.sh: view near-real-time NOAA GOES satellite imagery.

SYNOPSIS:
	$ sat [site] [imagery product]

OPTIONS:
	[site]
		abq	Albuquerque, NM
		ak	Alaska
		alb	Albany, NY
		aus	Austin, TX
		bwi	Baltimore, MD
		carib	Caribbean
		clt	Charlotte, NC
		cod	Yellowstone
		den	Denver, CO
		dtw	Detroit, MI
		evv	Evansville, ID
		gulf	Gulf of Mexico
		hi	Hawaii
		ict	Wichita, KS
		las	Las Vegas, NV
		lit	Little Rock, AR
		lws	Leniston, ID
		mgm	Montgomery, AL
		msp	Minneapolis, MN
		pir	Pierre, SD
		tpa	Tampa, FL
		wmc	Winnemacca, NV
		us	Contiguous United States

	[imagery product]
		irbw	Infrared (black & white)
		ircol	Infrared (color)
		irnws	Infrared (NWS overlay)
		vis	Visible light
		wv	Water vapor
EOF
}

interactive() {
	site=$(emitsites | dmenu | cut -f1 -d":")
	product=$(emitproducts | dmenu | cut -f1 -d":")
	main $site $product
}

constructurl() {
	echo "$baseurl/sat_$2_$1.jpg"
}

main() {
	case "$last" in
		-u|--url) constructurl $1 $2 ;;
		*) viewurl $(constructurl $1 $2) ;;
	esac
}

for last; do true; done

case "$#" in
	0) help ;;
esac

case "$1" in
	help) help ;;
	-i|--interactive) interactive ;;
	*) main $1 $2 ;;
esac