Determining Relevant Aircraft

For a given day, I may have 6 million+ ads-b messages. Salem is located under the routes that jets from Portland and Seattle take to points south, so most of the traffic over Salem is caused by jets flying at altitudes over 30,000.  I'm not really interested in those flights.  My interests are in the flights that are close to my neighborhood.  So what I did was determine a rectangular area within Google earth by placing two placemarks (yellow thumbtacks): one at the northeast corner and one at the southwest corner.  I just picked areas which I felt would have aircraft flying at low altitudes of houses.

The two placemarks I selected have these coordinates:

Corners of Salem Airspace
Name Longitude
(decimal degrees)
Latitude
(decimal degrees)
Picture
Northeast 44.959274° -122.959463°
Southwest 44.877369° -123.070046°

If any aircraft has been flying, then there will be MSG,3 packets.  Using the Linux shell script "awk", I created a little program that looks at every packet and determines if the latitude and longitude packet is within my defined area and under an altitude of 1500 feet.  Then the results are "piped" [directed] to temporary memory after which I determine what are the unique values therein.  I do not need 100,000s of thousands of the same aircraft, just one.

Here is the awk script I use that gives me a list of all aircraft which transmitted at least one packet that qualifies for the three tests: longitude, latitude, and altitude.  (Note that I have the results contain a copy of the script at the top of the file that created the results file because I'm working and fast and loose and want to preserve just what the recipe was at the time I generated the file.)  The script below identifed (61 - 8 comment lines= ) 53 aircraft.

ryzdesk /home/jlpoole # date; cat -n /adsbwork/logs/2024/04/24/24/salem_uniq_adsb.txt
Sun Jun 2 03:54:19 PM PDT 2024
1 # Tue May 7 11:41:08 2024 by /home/jlpoole/adsb/tests/test_mining_2.pl
2 # cat /adsbwork/logs/2024/04/24/24/2024_04_24_1090.log.valid.MSG3 \
3 # | awk -F, '{hex=$5;alt=$12;lat=$15;lon=$16; \
4 # if (lat >= 44.877369 && lat <= 44.959274 \
5 # && lon >= -123.070046 && lon <= -122.959463 \
6 # && alt <= 1500) \
7 # print hex;}'|sort|uniq >> /adsbwork/logs/2024/04/24/24/salem_uniq_adsb.txt
8 #
9 A02412
10 A03733
11 A050D5
12 A06262
13 A0A996
14 A0B782
15 A0BD18
16 A0E72E
17 A10005
18 A127E1
19 A175FF
20 A1B7FC
21 A1DB8B
22 A1F4E4
23 A23E23
24 A25EFD
25 A2FCAB
26 A390D3
27 A40B26
28 A41151
29 A42142
30 A4DD19
31 A54E40
32 A57DD9
33 A63655
34 A67E59
35 A727D3
36 A7FCC5
37 A86805
38 A890C2
39 A8FAF9
40 A963F5
41 A9A27D
42 A9E6B2
43 A9F06B
44 AB2E8A
45 AB5F65
46 ABA8A0
47 ABE561
48 AC25C5
49 AC345F
50 AC6679
51 ACCE9E
52 AD30FD
53 AD3499
54 AD8F9A
55 ADF349
56 AE200B
57 AE47BA
58 AE5121
59 AE57A1
60 AE57A5
61 AE57A7
ryzdesk /home/jlpoole #

Here's how much computer time it takes (the time sink is in the reading of the file, not processor calculations): 5 seconds.  I have modified the end of the processing chain to show only the count ("wc -l" = count the lines of the output) of the aircraft rather than list them out since we already have that information above.

Time to identify Salem Airspace Packets: 5 seconds
ryzdesk /home/jlpoole # #
       # How long does this script take to process 2,197,302 packets?
       #
       date; time cat /adsbwork/logs/2024/04/24/24/2024_04_24_1090.log.valid.MSG3 \
       | awk -F, '{hex=$5;alt=$12;lat=$15;lon=$16; \
       if (lat >= 44.877369 && lat <= 44.959274 \
       && lon >= -123.070046 && lon <= -122.959463 \
       && alt <= 1500) \
       print hex;}'|sort|uniq|wc -l
       Sun Jun  2 04:01:52 PM PDT 2024
       53
real    0m5.025s
         user    0m4.896s
         sys     0m0.308s
     ryzdesk /home/jlpoole #

So, in file salem_uniq_adsb.txt I have a punch list of aircraft which I have defined by two placemarks and an altitude. These are the aircraft of interest. What is nifty about this approach is that if I change my mind, or want an alternative scenario, it's just a simple matter of redefining the paraemters in the awk script, e.g. altitude of 2,400' instead of 1,500', and re-running the scripts and isolating the output.