diff --git a/www/events.js b/www/events.js index af76769..40169de 100644 --- a/www/events.js +++ b/www/events.js @@ -158,6 +158,7 @@ function ajaxLoadEventInfo(id) { success: function (xml) { eventDetails[id] = true; $(xml).find('event').each(function () { + var event = $(this); var mag = $(this).find('magnitude > mag > value').text(); var otime = $(this).find('origin > time > value').text(); var lng = $(this).find('origin > longitude > value').text(); @@ -170,26 +171,46 @@ function ajaxLoadEventInfo(id) { var gap = $(this).find('origin > quality > azimuthalGap').text(); var phases_count = $(this).find('origin > quality > usedPhaseCount').text(); var type = $(this).find('type').last().text(); + // setting up general event info var row = "
"
-					+ sprintf("ID %32s\n", id)
-					+ sprintf("Type %30s\n\n", type)
+					+ sprintf("ID %49s\n", id)
+					+ sprintf("Type %47s\n\n", type)
 					+ "Origin\n"
-					+ sprintf("Magnitude %13.1f\n", Number(mag))
 					+ sprintf("Date %18s\n", otime.split('T')[0])
 					+ sprintf("Time %18s UTC\n", otime.split('T')[1].substring(0, 11))
 					+ sprintf("Latitude %14.4f °N +- %4.1f km\n",Number(lat), Number(lat_err))
 					+ sprintf("Longitude %13.4f °E +- %4.1f km\n", Number(lng), Number(lng_err))
 					+ sprintf("Depth %14.1f    km +- %4.1f km\n", Number(depth)/1000., Number(depth_err)/1000.)
+					+ sprintf("Magnitude %10.1f\n", Number(mag))
 					+ sprintf("Residual RMS %7.1f    sec\n", Number(rms))
 					+ sprintf("Azimuthal gap %6.1f    °\n\n", Number(gap))
 					+ sprintf("%d Phase arrivals:\n", Number(phases_count))
-					+ "sta  net   dist azi  phase   time         res   wt  sta\n";
+					+ "sta  net  dist azi     phase time         res   wt\n";
+				// adding phase info (TODO sort by distance)
+				$(this).find('origin > arrival').each(function() {
+					var pickid = $(this).find('pickID').text();
+					var azi = $(this).find('azimuth').text();
+					var dist = $(this).find('distance').text();
+					var tres = $(this).find('timeResidual').text();
+					var phase = $(this).find('phase').text();
+					var tweight = $(this).find('timeWeight').text();
+					if ( Number(tweight) > 0.0 ) {
+						var waveformid = event.find('pick[publicID="'+pickid+'"] > waveformID');
+						var networkcode = waveformid.attr('networkCode');
+						var stationcode = waveformid.attr('stationCode');
+						var channel = waveformid.attr('channelCode').substring(2,2);
+						var phasemode = event.find('pick[publicID="'+pickid+'"] > evaluationMode').text().substring(0,1).toUpperCase();
+						var picktime = event.find('pick[publicID="'+pickid+'"] > time > value').text().split('T')[1].substring(0,11);
+						row = row
+							+ sprintf('%-4s %2s  %5.1f %5.1f %3s %1s %13s %5.1f %5.2f\n', stationcode, networkcode, Number(dist), Number(azi), phase, phasemode, picktime, Number(tres), Number(tweight));
+					};
+				});
 				row = row + '
'; $('#eventstable > tbody > tr.tablesorter-childRow > td[eventid='+id+']').html(row); }); }, complete: function () { - console.log('Fetched details for event '+id); + null; }, error: function( jqxhr, textStatus, error ) { var err = textStatus + ", " + error; @@ -198,55 +219,6 @@ function ajaxLoadEventInfo(id) { }); }; -/* add row to table - obsolete */ -function addEventRow(id, props) { - $('#eventstable').tablesorter({ - sortList: "[[0,0], [1,1]], [2,1]", - resort: true, - showProcessing: true, - pager_size: 35 - }); - var html = '' - + ''+props.date+'T'+props.time.split('.')[0]+'Z' - + ''+props.date+'T'+props.time.split('.')[0]+'Z' - + ''+props.mag+'' - + ''+props.location+'Karte' - + '' - + '' - + '' - + "
ID                     "+id+"\n\n"
-		+ "Origin\n"
-		+ "Date                   "+props.date+"\n"
-		+ "Time                   "+props.time+"\n"
-		+ "Latitude                "+props.lat+" deg  +/-    "+props.lat_err+" km\n"
-		+ "Longitude                "+props.lon+" deg  +/-    "+props.lon_err+" km\n"
-		+ "Depth                       "+props.depth+" km   +/-    "+props.depth_err+" km\n"
-		+ "Residual RMS             "+props.rms+" s\n"
-		+ "Azimuthal gap             "+props.gap+" deg\n\n"
-		+ props.no_phases + " Phase arrivals:\n"
-		+ "sta  net   dist azi  phase   time         res     wt  sta\n";
-	for ( i = 0 ; i < props.no_phases ; i++ ) {
-		html +=  props.phases[i];
-		( i < props.no_phases -1 ) ? html += "\n" : null ;
-	};
-	html += "
\n"; - var added = $('#eventstable tbody').append(html); - added.find('.tablesorter-childRow td').hide(); - $('#eventstable').find('td.utctime-date').each(function() { - $.localtime.formatObject($(this), "dd. MM. yyyy"); - $(this).removeClass('utctime-date'); - $(this).addClass('localtime-date'); - }); - $('#eventstable').find('td.utctime-time').each(function() { - $.localtime.formatObject($(this), "HH:mm"); - $(this).removeClass('utctime-time'); - $(this).addClass('localtime-time'); - }); - // force resorting - $("#eventstable").trigger("update", [true]); -}; - /* toggles visibility of filtered markers * only events in the event list are shown */ function toggleFilteredMarkers() {