<commit_before>package uk.co.epii.bennevis;

public class Main {

  public static void main(String[] args) {
    System.out.println("Running <NAME>");
  }

}<commit_msg>Wrote a simple application to take a GPX file and spit out a csv<commit_after>package uk.co.epii.bennevis;

import uk.co.epii.bennevis.gpx.GPXLoader;
import uk.co.epii.bennevis.opendata.ContourAltimeter;
import uk.me.jstott.jcoord.OSRef;

import java.io.*;

public class Main {

  public static void main(String[] args) throws FileNotFoundException {
    InputStream is = null;
    OutputStream out = null;
    if (args.length == 0) {
      is = System.in;
      out = System.out;
    }
    if (args.length == 1) {
      is = new FileInputStream(args[0]);
      out = System.out;
    }
    if (args.length == 2) {
      is = new FileInputStream(args[0]);
      out = new FileOutputStream(args[1]);
    }
    GPXLoader gpxLoader = new GPXLoader();
    gpxLoader.loadFile(is);
    IAltimeter altimeter = new ContourAltimeter();
    OSRef previous = null;
    double distance = 0;
    PrintWriter pw = new PrintWriter(out);
    for (OSRef osRef : gpxLoader.getPoints()) {
      pw.print(osRef.getEasting());
      pw.print(",");
      pw.print(osRef.getNorthing());
      pw.print(",");
      distance += distance(previous, osRef);
      pw.print(distance / 1609.344);
      pw.print(",");
      pw.print(altimeter.getAltitude(osRef));
      pw.println();
      previous = osRef;
    }
    pw.flush();
    pw.close();
  }

  private static double distance(OSRef previous, OSRef osRef) {
    if (previous == null) {
      return 0;
    }
    double dx = previous.getEasting() - osRef.getEasting();
    double dy = previous.getNorthing() - osRef.getNorthing();
    return Math.sqrt(dx * dx + dy * dy);
  }

}
{'fraction_non_alphanumeric': 0.13826185101580135, 'fraction_numerical': 0.008465011286681716, 'mean_word_length': 2.8627450980392157, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '3943849', 'n_tokens_mistral': 622, 'n_tokens_neox': 597, 'n_words': 139}