View Single Post
  #6  
Old January 22nd 10, 03:59 AM posted to rec.aviation.soaring
Bob Gibbons[_2_]
external usenet poster
 
Posts: 120
Default IGC File / Flight-track Analysis

On Thu, 21 Jan 2010 06:01:40 -0800 (PST), Dave Nadler
wrote:

.... text deleted ...
Anybody got a decent open-source IGC-format parser
that reads a flight log file into a nice container ?

Mine is highly specific to SN10 features and wouldn't be
helpful here...

Best Regards, Dave "YO electric"


Pretty simple to use an awk script to parse through the IGC file.

See,
http://www.gnu.org/manual/gawk/gawk.html

Here's a simple script I have used to extract the IGC data in a more
user friendly format.

# Awk routine to filter out igc file
# Filename: igctest3.awk
substr($1,1,1) ~ /B/ {
time=substr($1,2,6);
Lat=substr($1,8,8);
Long=substr($1,16,9);
Press_Alt=substr($1,26,5);
GPS_Alt=substr($1,31,5)
TrueAS=substr($1,42,5)
GroundSpeed=substr($1,47,5)
TrueTrack=substr($1,52,3)
Netto=substr($1,55,5)
# Convert Airspeeds from km/hr to knots
print
time,Lat,Long,Press_Alt,GPS_Alt,TrueAS*(0.5399568)/100,GroundSpeed*(0.5399568)/100,TrueTrack,Netto
}

This script prints out a series of text lines, space separated, with
the following values.

Time, Lat, Long, Press_Alt, GPS_Alt, TrueAirspeed,GroundSpeed, Track
Direction, and Netto

Note that this particular example uses some IGC data extensions
particular to the LX8000, defined by the IGC header lines near the top
of the data file;
I063638FXA3941ENL4246TAS4751GSP5254TRT5559VAT
J020810WDI1115WVE

As an example of the script usage, the following command,

awk -f igctest3.awk 91VLJAL2.igc

operating on the following igc file (extracteding only the first few
lines;

ALXNJALFLIGHT:2
HFDTE310109
HFFXA035
HFPLTPILOT:
HFGTYGLIDERTYPE:Hph304s
HFGIDGLIDERID:N304AB
HFDTM100GPSDATUM:WGS-1984
HFRFWFIRMWAREVERSION:1.0
HFRHWHARDWAREVERSION:1
HFFTYFRTYPE:LXNAVIGATION,LX8000
HFGPS:uBLOX LEA-4P,16,max9000m
HFPRSPRESSALTSENSOR:INTERSEMA,MS5534A,max10000m
HFCIDCOMPETITIONID:AB
HFCCLCOMPETITIONCLASS:18-meter
HFTZNTIMEZONE:0
I063638FXA3941ENL4246TAS4751GSP5254TRT5559VAT
J020810WDI1115WVE
C310109173251310109000002
C0000000N00000000E
C3219463N09639711W10 ENNIS
C3136677N09713831WWACO
C3218123N09701055W25 MYPRL
C3222910N09700620W65 TSFns
C0000000N00000000E
LLXNOZ=1,Style=1,R1=1609m,A1=180,R2=0m,A2=0,A12=27 9.5,Maxa=0m,Autonext=1
LLXNTSK,TaskTime=7200s
B1732513222953N09700715WA0011400194036004018050000 116600005
B1732523222953N09700715WA0011400194036004018390000 116600000
B1732533222953N09700715WA0011400194036004018360000 316600000
B1732543222953N09700715WA0011400194036004017490000 316600000
B1732553222953N09700715WA0011400194036004016470000 216600000
B1732563222953N09700715WA0011400194036004016190000 416200005
B1732573222953N09700715WA0011400194036004016160000 116200003
B1732583222953N09700715WA0011400194036004016410000 216200002
B1732593222953N09700715WA0011400194036004016060000 316200003
B1733003222953N09700715WA0011400194036004016640000 116200001
B1733013222953N09700715WA0011400194036004017170000 2162-0002
B1733023222953N09700715WA0011400194036004017620002 9162-0001
B1733033222953N09700715WA0011500194036004018200017 916300000
B1733043222953N09700715WA0011400194036004019440040 118000004
B1733053222952N09700715WA0011400194036004021690072 018000000
..
..
..

The output (partial) of the script is,

173251 3222953N 09700715W 00114 00194 9.74622 0.00539957 166 00005
173252 3222953N 09700715W 00114 00194 9.92981 0.00539957 166 00000
173253 3222953N 09700715W 00114 00194 9.91361 0.0161987 166 00000
173254 3222953N 09700715W 00114 00194 9.44384 0.0161987 166 00000
173255 3222953N 09700715W 00114 00194 8.89309 0.0107991 166 00000
173256 3222953N 09700715W 00114 00194 8.7419 0.0215983 162 00005
173257 3222953N 09700715W 00114 00194 8.7257 0.00539957 162 00003
173258 3222953N 09700715W 00114 00194 8.86069 0.0107991 162 00002
173259 3222953N 09700715W 00114 00194 8.67171 0.0161987 162 00003
173300 3222953N 09700715W 00114 00194 8.98488 0.00539957 162 00001
173301 3222953N 09700715W 00114 00194 9.27106 0.0107991 162 -0002
173302 3222953N 09700715W 00114 00194 9.51404 0.156587 162 -0001
173303 3222953N 09700715W 00115 00194 9.82721 0.966523 163 00000
173304 3222953N 09700715W 00114 00194 10.4968 2.16523 180 00004
173305 3222952N 09700715W 00114 00194 11.7117 3.88769 180 00000
173306 3222950N 09700715W 00114 00194 13.6177 7.20842 181 00015
173307 3222948N 09700715W 00114 00194 15.8531 12.3812 181 00043
173308 3222943N 09700716W 00114 00194 19.1901 17.5486 181 00071
173309 3222938N 09700716W 00114 00194 24.0065 21.8521 181 00117
173310 3222931N 09700716W 00113 00194 29.6544 26.7657 181 00174
173311 3222922N 09700716W 00114 00194 34.5464 30.9611 181 00237
173312 3222913N 09700717W 00112 00194 38.3099 34.8812 184 00256
173313 3222902N 09700718W 00112 00193 44.1577 39.1469 184 00304
173314 3222891N 09700719W 00111 00193 49.1955 42.7052 184 00395
173315 3222878N 09700721W 00112 00193 51.7657 46.3985 185 00426
173316 3222864N 09700722W 00112 00193 55.108 49.2387 184 00409

This data file can be pulled into Excel or any other program desired
for futher analysis.

Awk is a very powerful tool, as is it's more sophisticated cousin,
Perl.

Bob