CroatiaControlLtd / asterix

Asterix is utility used to read and parse EUROCONTROL ASTERIX protocol data from stdin, file or network multicast stream and print it to standard output in text, XML or JSON format. Source can be used to generate Wireshark dissector for ASTERIX protocol. All ASTERIX categories are defined through XML definition file.
GNU General Public License v2.0
169 stars 90 forks source link

Convert .ast to any plain text format #192

Open marius190 opened 2 years ago

marius190 commented 2 years ago

Hello Damir Salantić,

I am doing a thesis and I need to work with ASTERIX data. I have ASTERIX data in .ast format from the Spanish AIP. I am wondering how to convert the .ast data into a plain text format, for example, .csv or also .xml. Actually, I have two .ast files from Part04-Cat048-asterix-bds (BDS data) and Part12-Cat021-asterix-ads-b (ADS-B data). The questions are:

The final desirable results would be the following categories:

ADS-B categories:

I021/010 DATA SOURCE I021/040 TARGET REPORT DESCRIPTOR I021/161 TRACK NUMBER I021/015 SERVICE IDENT. I021/071 TIME APLIC. POSIT. I021/130 POSITION WGS84 CO-ORDINATES I021/131 POSITION WGS84 CO-ORDINATES HIGH RES. I021/072 TIME APLIC. VELOCITY I021/150 AIR SPEED I021/151 TRUE AIR SPEED I021/080 TARGET ADDRESS I021/073 TIME MESSAGE REC. POSIT. I021/074 TIME MESSAGE REC. POSIT. HIGH PRES. I021/075 TIME MESSAGE REC. VELOCITY I021/076 TIME MESSAGE REC. VELOC. HIGH PRES. I021/140 GEOMETRIC HEIGHT I021/090 QUALITY INDICATORS I021/210 MOPS VERSION I021/070 MODE 3/A CODE I021/230 ROLL ANGLE I021/145 FLIGHT LEVEL I021/152 MAGNETIC HEADING I021/200 TARGET STATUS I021/155 BAROMETRIC VERTICAL RATE I021/157 GEOMETRIC VERTICAL RATE I021/160 AIRBORNE GROUND VECTOR I021/165 TRACK ANGLE RATE I021/077 TIME ASTERIX REPORT TRANS. I021/170 TARGET ID. I021/020 EMITTER CATEGORY I021/220 MET INFORMATION I021/146 SELECTED ALTITUDE I021/148 FINAL STATE SELECTED ALTITUDE I021/110 TRAJECTORY INTENT I021/016 SERVICE MANAGEMENT I021/008 AIRCRAFT OPERATIONAL STATUS I021/271 SURFACE CAPABILITIES AND CHARACTERISTICS I021/132 MESSAGE AMPLITUDE I021/250 MODE S MB DATA I021/260 ACAS RESOLUTION ADVISORY REPORT I021/400 RECEIVER ID I021/295 DATA AGES

BDS categories:

...

dsalantic commented 2 years ago

It depends of the format of your ast files. If there is only asterix data inside, without any headers, you could just try it with: asterix.exe -x -f yourfile.ast and you should get output in XL format.

If you prefer python, you can find the example here for reading "raw" asterix file: https://github.com/CroatiaControlLtd/asterix/blob/master/asterix/examples/read_raw_file.py

I hope it helps. BR, Damir

marius190 commented 2 years ago

As far as I understood asterix is a python library. Is not clear to me where to run the first command indicated above. Should I run the first line in the python terminal?

Thanks for the fast answer and help.

marius190 commented 2 years ago

About the second link, it worked for me in Google Colab. Apparently, it saves the decoded data in list:

image

I will try to subtract from them only the info I need (BDS44, BDS50, BDS60). Then I will try to save the list in a .csv file.

Finally just to mention that version does now work:

print(asterix.__version__)

This is because inside the asterix module ".version" is not imported:

image

dsalantic commented 2 years ago

As far as I understood asterix is a python library. Is not clear to me where to run the first command indicated above. Should I run the first line in the python terminal?

Thanks for the fast answer and help.

Asterix decoder works in two ways:

  1. Standalone executable application. You need to download the source and compile it by yourself (instruction are in README). Then you can call this command from command prompt.
  2. Python library (as you already discovered)
dsalantic commented 2 years ago

It's strange that .version could not be resolved. It works for me. I just tried in Google colab with following lines and it works OK:

!pip install asterix_decoder 
import asterix
asterix.__version__