jambon

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 13 Imported by: 0

README

jambon - tacview / acmi file processing utility

jambon is a small utility designed to help process large tacview (ACMI). It includes CLI tools for searching objects within a tacview, determining object life span, trimming tacviews to specific time frames, and filtering out objects.

Performance

jambon allows the user to optimize for speed or reduced memory usage when running ACMI processing commands. Commands that read ACMI files have a --concurrency flag which determines the number of data-processing routines that will be started. Generally speaking if a command outputs an ACMI file, a --concurrency of 1 will provide a consistent and small memory usage pattern. A larger concurrency value obviously results in less time processing but will require much more memory as data is buffered between stages.

Searching

We can search by any object property and jambon will produce time frames for all relevant objects.

$ jambon search --property "Pilot=Tracer 1-1 | Apothecary" --file example.acmi
Processing file test.acmi...
Object 2051
  First Seen: 2021-07-24T04:00:47Z (47.18)
  Last Seen:  2021-07-24T04:23:00Z (1380.33)
Object 171523
  First Seen: 2021-07-24T04:23:07Z (1387.45)
  Last Seen:  2021-07-24T04:36:22Z (2182.34)
Object 348163
  First Seen: 2021-07-24T04:36:54Z (2214.48)
  Last Seen:  2021-07-24T04:49:39Z (2979.97)
Object 551171
  First Seen: 2021-07-24T04:51:16Z (3076.77)
  Last Seen:  2021-07-24T04:54:36Z (3276.82)
Object 578051
  First Seen: 2021-07-24T04:54:39Z (3279.72)
  Last Seen:  2021-07-24T05:32:01Z (5521.57)

Or perhaps you prefer structured data:

$ jambon search --property "Pilot=Tracer 1-1 | Apothecary" --file example.acmi --json | jq '.'
[
  {
    "object": {
      "Id": 2051,
      "Properties": [
        {
          "Key": "T",
          "Value": "3.3380541|6.0067414|44.88||4.7|95.6|242348.11|-5254.55|92.5"
        },
        {
          "Key": "Type",
          "Value": "Air+FixedWing"
        },
        {
          "Key": "Name",
          "Value": "AV8BNA"
        },
        {
          "Key": "Pilot",
          "Value": "Tracer 1-1 | Apothecary"
        },
        {
          "Key": "Group",
          "Value": "Ford 3"
        },
        {
          "Key": "Color",
          "Value": "Blue"
        },
        {
          "Key": "Coalition",
          "Value": "Enemies"
        },
        {
          "Key": "Country",
          "Value": "us"
        }
      ],
      "Deleted": false
    },
    "first_seen": 47.18,
    "last_seen": 1380.33
  },
...
]

Trimming

Once we have a time frame we can utilize the trim functionality to produce a much smaller ACMI file.

$ jambon trim --input before.acmi --start-at-offset-time 3279.72 --end-at-offset-time 5521.57 --output after.acmi
Collecting frames between 3279.72 and 5521.57...
Sorting 47240 collected frames...
Writing 47240 frames...

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandNormalize = cli.Command{
	Name:        "normalize",
	Description: normalizeDescription,
	Action:      commandNormalize,
	Flags: []cli.Flag{
		&cli.PathFlag{
			Name:     "input",
			Usage:    "path to the input ACMI file",
			Required: true,
		},
		&cli.PathFlag{
			Name:     "output",
			Usage:    "path to the output ACMI file",
			Required: true,
		},
		&cli.StringSliceFlag{
			Name:  "exclude-property",
			Usage: "provide a key=value property pair that will cause matching objects to be excluded from the output",
		},
		&cli.IntFlag{
			Name:  "concurrency",
			Usage: "number of parallel processing routines to run",
			Value: runtime.GOMAXPROCS(-1),
		},
	},
}

CommandNormalize handles rewriting ACMI files

View Source
var CommandSearch = cli.Command{
	Name:        "search",
	Description: "search for an object",
	Action:      commandSearch,
	Flags: []cli.Flag{
		&cli.StringSliceFlag{
			Name:      "file",
			Usage:     "path to tacview files you'd like to search",
			TakesFile: true,
			Required:  true,
		},
		&cli.StringSliceFlag{
			Name:  "property",
			Usage: "provide a key=value property pair to search for",
		},
		&cli.BoolFlag{
			Name:  "print-properties",
			Usage: "print found object properties",
		},
		&cli.BoolFlag{
			Name:  "json",
			Usage: "output data as JSON",
		},
		&cli.IntFlag{
			Name:  "concurrency",
			Usage: "number of parallel processing routines to run",
			Value: runtime.GOMAXPROCS(-1),
		},
	},
}

CommandSearch handles searching a tacview for objects with a given set of properties

View Source
var CommandTrim = cli.Command{
	Name:        "trim",
	Description: "trim a tacview to reduce its duration",
	Action:      commandTrim,
	Flags: []cli.Flag{
		&cli.PathFlag{
			Name:     "input",
			Usage:    "path to the input ACMI file",
			Required: true,
		},
		&cli.PathFlag{
			Name:     "output",
			Usage:    "path to the output ACMI file",
			Required: true,
		},
		&cli.Float64Flag{
			Name:  "start-at-offset-time",
			Usage: "set the start point via an offset time",
		},
		&cli.Float64Flag{
			Name:  "end-at-offset-time",
			Usage: "set the end point via an offset time",
		},
		&cli.StringFlag{
			Name:  "start-at-time",
			Usage: "set the start point via a RFC3999 timestamp",
		},
		&cli.StringFlag{
			Name:  "end-at-time",
			Usage: "set the end point via a RFC3999 timestamp",
		},
		&cli.IntFlag{
			Name:  "concurrency",
			Usage: "number of parallel processing routines to run",
			Value: runtime.GOMAXPROCS(-1),
		},
	},
}

CommandTrim handles trimming a tacview file

Functions

This section is empty.

Types

type JambonNoopProcessor

type JambonNoopProcessor struct {
	// contains filtered or unexported fields
}

func NewJambonNoopProcessor

func NewJambonNoopProcessor(dest io.WriteCloser) *JambonNoopProcessor

func (*JambonNoopProcessor) ProcessFile

func (j *JambonNoopProcessor) ProcessFile(source *tacview.Reader) error

type JambonProcessor

type JambonProcessor interface {
	ProcessFile(*tacview.Reader) error
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL