<commit_before>

// this comes from the seisplotjs waveformplot bundle
var wp = seisplotjs_waveformplot
var traveltime = seisplotjs_traveltime
var fdsnevent = seisplotjs_fdsnevent
var daysAgo = 10;

var quakeQuery = new fdsnevent.EventQuery()
  .minMag(5.5)
  .startTime(new Date(new Date().getTime()-86400*daysAgo*1000))
  .endTime(new Date());
wp.d3.select("div.recentQuakesUrl")
    .append("p")
    .text("URL: "+quakeQuery.formURL());
quakeQuery.query().then(function(quakes) {
  wp.d3.select("div.recentQuakes")
    .selectAll("p")
    .data(quakes)
    .enter() 
    .append("p")
    .text(function(d) {
      return "quake: "
          +d.time.toISOString()+" "
          +d.magnitude.value+" "
          +d.magnitude.type+" "
          +"("+d.latitude+", "+d.longitude+") "
          +(d.depth/1000)+"km "
          +d.description;
    })
    .on("click", function(d){
console.log("click "+d.time);
      wp.d3.select("div.seismograms")
        .selectAll("p")
        .remove();
      wp.d3.select("div.seismograms")
        .selectAll("p")
        .data([d])
        .enter()
        .append("p")
        .text(function(d) {
          return "quake: "
              +d.time.toISOString()+" "
              +d.magnitude.value+" "
              +d.magnitude.type+" "
              +"("+d.latitude+", "+d.longitude+") "
              +(d.depth/1000)+"km "
              +d.description;
        });
       plotSeismograms(wp.d3.select("div.seismograms"),
                       "CO", "JSC", "00", "HHZ", d);
    });
    
}, function(reason) {
wp.d3.select("div.recentQuakes")
    .append("p")
    .text("Reject: "+reason);
});

var plotSeismograms = function(div, net, sta, loc, chan, quake) {
  var dur = 900;
  var host = 'service.iris.edu';
  var protocol = 'http:';
    if ("https:" == document.location.protocol) {
      protocol = 'https:'
    }
var jsclat = 34;
var jsclon = -81;
var pOffset = -120;
var clockOffset = 0; // set this from server somehow!!!!
    console.log("calc start end: "+quake.time+" "+dur+" "+clockOffset);
    new traveltime.TraveltimeQuery()
        .evdepth(quake.depth/1000)
        .evlat(quake.latitude).evlon(quake.longitude)
        .stalat(jsclat).stalon(jsclon)
        .phases('p,P,PKP,PKIKP,Pdiff,s,S,Sdiff,PKP,SKS,SKIKS,PP,PcP,pP,sS,PKKP,SKKS,SS')
        .query()
        .then(function(ttimes) {
    var firstP = ttimes.arrivals[0];
    for (var p=0; p<ttimes.arrivals.length; p++) {
      if (firstP.time > ttimes.arrivals[p]) {
        firstP = ttimes.arrivals[p];
      }
    }
    var PArrival = new Date(quake.time.getTime()+(firstP.time+pOffset)*1000);
    var seisDates = wp.calcStartEndDates(PArrival, null, dur, clockOffset);
    var startDate = seisDates.start;
    var endDate = seisDates.end;

console.log("Start end: "+startDate+" "+endDate);
    var url = wp.formRequestUrl(protocol, host, net, sta, loc, chan, startDate, endDate);
console.log("Data request: "+url);
wp.loadParse(url, function (error, dataRecords) {
      if (error) {
        div.append('p').html("Error loading data." );
      } else {
          div.selectAll('div.myseisplot').remove();
          var byChannel = wp.miniseed.byChannel(dataRecords);
          var keys = Object.keys(byChannel);
          for (var i = 0; i < keys.length; i++) {
            var key = keys[i];
            var segments = wp.miniseed.merge(byChannel[key]);
            div.append('p').html('Plot for ' + key);
            var svgdiv = div.append('div').attr('class', 'myseisplot');
            if (segments.length > 0) {
                var seismogram = new wp.chart(svgdiv, segments, startDate, endDate);
                var markers = [];
                for (var m=0;m<ttimes.length; m++) {
                  markers.push({ name: ttimes[m].phase, time: new Date(quake.time.getTime()+(ttimes[m].time)*1000) });
                }
                seismogram.appendMarkers(markers);
                seismogram.draw();
            }
        }<commit_msg>missed update of traveltime json<commit_after>

// this comes from the seisplotjs waveformplot bundle
var wp = seisplotjs_waveformplot
var traveltime = seisplotjs_traveltime
var fdsnevent = seisplotjs_fdsnevent
var daysAgo = 10;

var quakeQuery = new fdsnevent.EventQuery()
  .minMag(5.5)
  .startTime(new Date(new Date().getTime()-86400*daysAgo*1000))
  .endTime(new Date());
wp.d3.select("div.recentQuakesUrl")
    .append("p")
    .text("URL: "+quakeQuery.formURL());
quakeQuery.query().then(function(quakes) {
  wp.d3.select("div.recentQuakes")
    .selectAll("p")
    .data(quakes)
    .enter() 
    .append("p")
    .text(function(d) {
      return "quake: "
          +d.time.toISOString()+" "
          +d.magnitude.value+" "
          +d.magnitude.type+" "
          +"("+d.latitude+", "+d.longitude+") "
          +(d.depth/1000)+"km "
          +d.description;
    })
    .on("click", function(d){
console.log("click "+d.time);
      wp.d3.select("div.seismograms")
        .selectAll("p")
        .remove();
      wp.d3.select("div.seismograms")
        .selectAll("p")
        .data([d])
        .enter()
        .append("p")
        .text(function(d) {
          return "quake: "
              +d.time.toISOString()+" "
              +d.magnitude.value+" "
              +d.magnitude.type+" "
              +"("+d.latitude+", "+d.longitude+") "
              +(d.depth/1000)+"km "
              +d.description;
        });
       plotSeismograms(wp.d3.select("div.seismograms"),
                       "CO", "JSC", "00", "HHZ", d);
    });
    
}, function(reason) {
wp.d3.select("div.recentQuakes")
    .append("p")
    .text("Reject: "+reason);
});

var plotSeismograms = function(div, net, sta, loc, chan, quake) {
  var dur = 900;
  var host = 'service.iris.edu';
  var protocol = 'http:';
    if ("https:" == document.location.protocol) {
      protocol = 'https:'
    }
var jsclat = 34;
var jsclon = -81;
var pOffset = -120;
var clockOffset = 0; // set this from server somehow!!!!
    console.log("calc start end: "+quake.time+" "+dur+" "+clockOffset);
    new traveltime.TraveltimeQuery()
        .evdepth(quake.depth/1000)
        .evlat(quake.latitude).evlon(quake.longitude)
        .stalat(jsclat).stalon(jsclon)
        .phases('p,P,PKP,PKIKP,Pdiff,s,S,Sdiff,PKP,SKS,SKIKS,PP,PcP,pP,sS,PKKP,SKKS,SS')
        .query()
        .then(function(ttimes) {
    var firstP = ttimes.arrivals[0];
    for (var p=0; p<ttimes.arrivals.length; p++) {
      if (firstP.time > ttimes.arrivals[p]) {
        firstP = ttimes.arrivals[p];
      }
    }
    var PArrival = new Date(quake.time.getTime()+(firstP.time+pOffset)*1000);
    var seisDates = wp.calcStartEndDates(PArrival, null, dur, clockOffset);
    var startDate = seisDates.start;
    var endDate = seisDates.end;

console.log("Start end: "+startDate+" "+endDate);
    var url = wp.formRequestUrl(protocol, host, net, sta, loc, chan, startDate, endDate);
console.log("Data request: "+url);
wp.loadParse(url, function (error, dataRecords) {
      if (error) {
        div.append('p').html("Error loading data." );
      } else {
          div.selectAll('div.myseisplot').remove();
          var byChannel = wp.miniseed.byChannel(dataRecords);
          var keys = Object.keys(byChannel);
          for (var i = 0; i < keys.length; i++) {
            var key = keys[i];
            var segments = wp.miniseed.merge(byChannel[key]);
            div.append('p').html('Plot for ' + key);
            var svgdiv = div.append('div').attr('class', 'myseisplot');
            if (segments.length > 0) {
                var seismogram = new wp.chart(svgdiv, segments, startDate, endDate);
                var markers = [];
                for (var m=0;m<ttimes.arrivals.length; m++) {
                  markers.push({ name: ttimes.arrivals[m].phase, time: new Date(quake.time.getTime()+(ttimes.arrivals[m].time)*1000) });
                }
                seismogram.appendMarkers(markers);
                seismogram.draw();
            }
        }
{'fraction_non_alphanumeric': 0.17259964903484581, 'fraction_numerical': 0.014289295562797694, 'mean_word_length': 2.3953191489361703, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '1016310', 'n_tokens_mistral': 2925, 'n_tokens_neox': 2785, 'n_words': 490}