<commit_before>import * as turf from "@turf/turf";

import {readTask} from "../src/read-task";
import {taskToGeoJSON} from "../src/task-to-geojson";
import {readFlight} from "../src/read-flight";
import {analyzeFlight} from "../src/analyze-flight";
import {formatResult} from "../src/format-result";
import {viewGeoJSON} from "./utils/view-geojson";

let task = readTask(`${__dirname}/../fixtures/2017-07-15-lev/task.tsk`);
let flight = readFlight(`${__dirname}/../fixtures/2017-07-15-lev/sq_2017-07-15-fla-3jv-01.igc`);
let flight2 = readFlight(`${__dirname}/../fixtures/2017-07-15-lev/IGP_77fg7sd1.igc`);
let result = analyzeFlight(flight, task);

console.log(formatResult(result));

let json = taskToGeoJSON(task);
json.features.push(turf.lineString(flight.map(it => it.coordinate), { color: 'red', opacity: 0.85 }));
json.features.push(turf.lineString(flight2.map(it => it.coordinate), { color: 'green', opacity: 0.85 }));
json.features.push(...result.aatPoints.filter(Boolean).map(it => turf.point(it.coordinate)));

if (process.argv.indexOf('--view') !== -1) {
  viewGeoJSON(json);
}<commit_msg>examples: Switch back to SW flight<commit_after>import * as turf from "@turf/turf";

import {readTask} from "../src/read-task";
import {taskToGeoJSON} from "../src/task-to-geojson";
import {readFlight} from "../src/read-flight";
import {analyzeFlight} from "../src/analyze-flight";
import {formatResult} from "../src/format-result";
import {viewGeoJSON} from "./utils/view-geojson";

let task = readTask(`${__dirname}/../fixtures/2017-07-15-lev/task.tsk`);
let flight = readFlight(`${__dirname}/../fixtures/2017-07-15-lev/SW_77flqgg1.IGC`);
let flight2 = readFlight(`${__dirname}/../fixtures/2017-07-15-lev/IGP_77fg7sd1.igc`);
let result = analyzeFlight(flight, task);

console.log(formatResult(result));

let json = taskToGeoJSON(task);
json.features.push(turf.lineString(flight.map(it => it.coordinate), { color: 'red', opacity: 0.85 }));
json.features.push(turf.lineString(flight2.map(it => it.coordinate), { color: 'green', opacity: 0.85 }));
json.features.push(...result.aatPoints.filter(Boolean).map(it => turf.point(it.coordinate)));

if (process.argv.indexOf('--view') !== -1) {
  viewGeoJSON(json);
}
{'fraction_non_alphanumeric': 0.2081447963800905, 'fraction_numerical': 0.039819004524886875, 'mean_word_length': 5.124653739612189, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4904900', 'n_tokens_mistral': 860, 'n_tokens_neox': 794, 'n_words': 133}