-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstats
More file actions
executable file
·84 lines (73 loc) · 2.02 KB
/
stats
File metadata and controls
executable file
·84 lines (73 loc) · 2.02 KB
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
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Usage: $0 YYYYMMDDHH"
exit
fi
date=$1
hh=`echo $date |cut -c9-10`
exe="../../../pbdump"
dir='../../../data'
declare -a messages
messages=(\
"ADPSFC" \
"AIRCAR" \
"AIRCFT" \
"ADPUPA" \
"MSONET" \
"SFCSHP" \
"SATWND" \
"PROFLR" \
"VADWND" \
"GOESND" \
"GPSIPW" \
"RASSDA" \
"ASCATW" \
)
#RASSDA (PREPBUFR: Radio Acoustic Sounding System (RASS) temp profile reports)
#ASCATW (PREPBUFR: ASCAT scatterometer data (reprocessed) wind speed and direction over the oceans)
#GOESND (PREPBUFR: GOES satellite data (soundings, retrievals, radiances))
tot_msg=${#messages[@]}
tot_msg=$(( $tot_msg - 1 ))
#seq1=`seq 0 $tot_msg`
seq1=`seq 0 5`
bufrtype0=(187 287) #ADPSFC
bufrtype1=(133 233 ) #AIRCAR
bufrtype2=(130 131 134 135 230 231 234 235) #AIRCFT
bufrtype3=(120 220) #ADPUPA
bufrtype4=(188 288 195 295) #MSONET
bufrtype5=(180 183 194 280 284 294) #SFCSHP
for min in 00 15 30 45
do
echo "=== $min ==="
mkdir -p $date/$min
cd $date/$min
#for message in ${messages[@]}
for i in $seq1; do
message=${messages[$i]}
echo "**$message**"
mkdir -p $message; cd $message
#extract given message and count its bufr types
$exe $dir/$date.rtma_ru.t$hh${min}z.prepbufr.tm00 $message > $message.txt
cat $message.txt | cut -c70-72 | sort | uniq > types_$message.txt
#generate stats for each bufrtype
eval mytypes=( \"\${bufrtype${i}[@]}\" )
for itype in "${mytypes[@]}"
do
echo "$itype"
eval "cat $message.txt | grep ' ${itype}$' > $itype.txt"
cat $itype.txt | cut -c31-34 | sort | uniq > ${itype}_timelists.txt
cat $itype.txt | cut -c10-20 | sort > ${itype}_stnid.txt
cat $itype.txt | cut -c10-20 | sort | uniq > ${itype}_stnid_unique.txt
echo > ${itype}_counts.txt
while read line; do
if [ ! -z "$line" ]; then
echo $line `cat $itype.txt | grep "_$line" | wc -l` >> ${itype}_counts.txt
fi
done < ${itype}_timelists.txt
done
#go above one level
cd ..
done
#go above two levels
cd ../..
done