Overview

Asterix is a binary data format, developed and maintained by eurocontrol.

The major problem with the original specifications is that they are provided in a form of free text (PDF files). As a consequence, the very first step in every asterix project is to retype the specifications to a parsable form. And this is what this project is all about.

Project content

This project contains:

Asterix definitions

In this project, the asterix definitions are stored and maintained in a compact text based parsable form. The intention of this format is to be:

Example definition snippet:

asterix 008 "Monoradar Derived Weather Information"
edition 1.2
date 2014-08-24
preamble
    Surveillance data exchange.

items

    000 "Message Type"
        definition
            This Data Item allows for a more convenient handling of the messages
            at the receiver side by further defining the type of transaction.
        element 8
            table
                1: Polar vector
                2: Cartesian vector of start point/length
                3: Contour record
                4: Cartesian start point and end point vector
                254: SOP message
                255: EOP message

    010 "Data Source Identifier"
        definition
            Identification of the radar station from which the data are received.
        group
            SAC "System Area Code"
                element 8
                    raw
            SIC "System Identification Code"
                element 8
                    raw
        remark
            Note:
                The defined SACs are on the EUROCONTROL ASTERIX website
                (www.eurocontrol.int/asterix)
    ...

See the structure description for more details.

How to use it?

The specifications are provided in various formats.

If you are creating new categories, consider contributing definitions to the upstream repository.

Example: traversing specification with python script

This example is using asterix category description in json format.

import sys
import json

# input json file
infile=sys.argv[1]

# load definition and decode json
with open(infile) as f:
    s = f.read()
root = json.loads(s)

# show category info
print(root['number'], root['edition'], root['date'])

# show top level items
for i in root['catalogue']:
    print(i['name'])

# show user application profile
for i in root['uap']['items']:
    print(i)

def get_rule(rule):
    t = rule['type']
    if t == 'ContextFree':
        return rule['value']
    elif t == 'Dependent':
        return rule['default']
    else:
        raise Exception('unexpected type: {}'.format(t))

# recursivly walk over the structure and show all items

def dump_item(item, parent=''):
    path = parent
    if item['spare']:
        path = path + '/spare'
        n = item['length']
        print('{}, bits: {}'.format(path, n))
        return
    path = path + '/' + item['name']
    dump_variation(get_rule(item['rule']), path)

def dump_variation(variation, path):
    t = variation['type']
    if t == 'Element':
        n = variation['size']
        cont = get_rule(variation['rule']) # exemine content
        print('{} Element, bits: {}'.format(path, n))
    elif t == 'Group':
        print('{} Gorup'.format(path))
        for i in variation['items']:
            dump_item(i, path)
    elif t == 'Extended':
        print('{} Extended'.format(path))
        for i in variation['items']:
            if i is not None:
                dump_item(i, path)
    elif t == 'Repetitive':
        rt = variation['rep']
        if rt['type'] == 'Regular':
            n = rt['size']
            print('{} Repetitive ({})'.format(path, n))
        elif rt['type'] == 'Fx':
            print('{} Repetitive with FX bit'.format(path))
        else:
            raise Exception('unexpected repetitive type {}'.format(rt))
        dump_variation(variation['variation'], path)
    elif t == 'Explicit':
        print('{} Explicit'.format(path))
    elif t == 'Compound':
        print('{} Compound'.format(path))
        for i in variation['items']:
            if i is not None:
                dump_item(i, path)
    else:
        raise Exception('unexpected variation type {}'.format(t))

for i in root['catalogue']:
    dump_item(i)

Related projects

If you’re using asterix-specs definition files in your project (directly or indirectly) and the source code is available, your are welcome to notify project maintainer, to be added to the list.