Debian Codegraph @

misc/getcycle

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 #
3 BASE_URL="http://weather.noaa.gov/pub/data/observations/metar/cycles"
4 ALL_CYCLES="00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23"
5
6 usagescip-shell shell shell-project 0.0.0 usage(). () {
7 echoscip-shell system . . echo. "Usage: $0 [-a|-all] <cycle> [ <cycle> ... ]"
8 exit 1
9 }
10
11 date=`datescip-shell system . . date. -u '+%y%m%d'`
12 hour=`datescip-shell system . . date. -u '+%H'`
13
14 cycles=""
15 while [scip-shell system . . `[`. "$#" -gt 0 ]; do
16 case $1 in
17 -a|-all)
18 cycles=$ALL_CYCLES
19 shift;;
20 -*)
21 echoscip-shell system . . echo. "unrecognized option: $1"
22 usagescip-shell shell shell-project 0.0.0 usage().;;
23 [0-9]*)
24 cycles="$cycles $1"
25 shift;;
26 esac
27 done
28
29 if [scip-shell system . . `[`. -z "$cycles" ]; then
30 usagescip-shell shell shell-project 0.0.0 usage().
31 fi
32
33 for name in $cycles; do
34 if [scip-shell system . . `[`. "$name" -lt "$hour" ]; then
35 file="${date}-${name}Z.TXT"
36 else
37 file="${date}Y-${name}Z.TXT"
38 fi
39 echoscip-shell system . . echo. "Downloading observations for cycle $name into $file"
40 curlscip-shell system . . curl. -s -S -R "$BASE_URL/${name}Z.TXT" | grepscip-shell system . . grep. "^[A-Z]" > "$file"
41 done
42