Reverted r622. Detail will, as before, be loaded on request only.
This commit is contained in:
parent
fa0ef11337
commit
ca182f594e
Notes:
subgit
2018-03-07 17:58:50 +01:00
r625 www/trunk
126
www/events.js
126
www/events.js
@ -59,7 +59,6 @@ function ajaxLoadEvents(stime, etime) {
|
||||
var etime = new Date();
|
||||
etime.setDate(etime.getDate()+1);
|
||||
};
|
||||
var mapBounds = map.getBounds();
|
||||
var request_data = {
|
||||
starttime: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()),
|
||||
endtime: sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate()),
|
||||
@ -68,7 +67,6 @@ function ajaxLoadEvents(stime, etime) {
|
||||
minlon: mapBounds.getWest()-config['map']['latlngDelta'],
|
||||
maxlon: mapBounds.getEast()+config['map']['latlngDelta'],
|
||||
minmag: config['event']['minMag']-config['event']['minMagDelta'],
|
||||
includearrivals: true,
|
||||
};
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@ -77,19 +75,11 @@ function ajaxLoadEvents(stime, etime) {
|
||||
dataType: "xml",
|
||||
success: function (xml) {
|
||||
$(xml).find('event').each(function () {
|
||||
var event = $(this);
|
||||
var id = $(this).attr('publicID').split('/')[2];
|
||||
var mag = $(this).find('magnitude > mag > value').text();
|
||||
var otime = $(this).find('origin > time > value').text();
|
||||
var lng = $(this).find('origin > longitude > value').text();
|
||||
var lng_err = $(this).find('origin > longitude > uncertainty').text();
|
||||
var lat = $(this).find('origin > latitude > value').text();
|
||||
var lat_err = $(this).find('origin > latitude > uncertainty').text();
|
||||
var depth = $(this).find('origin > depth > value').text();
|
||||
var depth_err = $(this).find('origin > depth > uncertainty').text();
|
||||
var rms = $(this).find('origin > quality > standardError').text();
|
||||
var gap = $(this).find('origin > quality > azimuthalGap').text();
|
||||
var phases_count = $(this).find('origin > quality > usedPhaseCount').text();
|
||||
var evaluationMode = $(this).find('evaluationMode').text();
|
||||
var evaluationStatus = $(this).find('evaluationStatus').text();
|
||||
var type = $(this).find('type').last().text();
|
||||
@ -112,41 +102,8 @@ function ajaxLoadEvents(stime, etime) {
|
||||
+ '<td><a href="#" class="toggle" eventid="'+id+'">'+location+'</a><a class="map-link" href="#" eventid="'+id+'">Karte</a></td>'
|
||||
+ '</tr>';
|
||||
// setting up event details (2nd line)
|
||||
row += '<tr class="tablesorter-childRow">'
|
||||
+ '<td colspan="4" eventid="'+id+'">'
|
||||
+ '<pre>'
|
||||
+ sprintf("ID %49s\n", id)
|
||||
+ sprintf("Type %47s\n\n", type)
|
||||
+ "Origin\n"
|
||||
+ 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\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 += 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 += '</td></tr>';
|
||||
row += '<tr class="tablesorter-childRow">'
|
||||
+ '<td colspan="4" eventid="'+id+'">Daten werden geladen ...</td></tr>';
|
||||
// setting up download links (3nd line)
|
||||
var xmlurl = sprintf('%s?formatted=true&includearrivals=true&eventid=%s', config['ajax']['eventURL'], id);
|
||||
var oTime = new Date(otime);
|
||||
@ -198,6 +155,81 @@ function ajaxLoadEvents(stime, etime) {
|
||||
});
|
||||
};
|
||||
|
||||
/* ajaxLoadEventInfo */
|
||||
function ajaxLoadEventInfo(id) {
|
||||
var request_data = {
|
||||
eventid: id,
|
||||
includeArrivals: true,
|
||||
};
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: config['ajax']['eventURL'],
|
||||
data: request_data,
|
||||
dataType: "xml",
|
||||
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();
|
||||
var lng_err = $(this).find('origin > longitude > uncertainty').text();
|
||||
var lat = $(this).find('origin > latitude > value').text();
|
||||
var lat_err = $(this).find('origin > latitude > uncertainty').text();
|
||||
var depth = $(this).find('origin > depth > value').text();
|
||||
var depth_err = $(this).find('origin > depth > uncertainty').text();
|
||||
var rms = $(this).find('origin > quality > standardError').text();
|
||||
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 = "<pre>"
|
||||
+ sprintf("ID %49s\n", id)
|
||||
+ sprintf("Type %47s\n\n", type)
|
||||
+ "Origin\n"
|
||||
+ 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\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 + '</pre>';
|
||||
$('#eventstable > tbody > tr.tablesorter-childRow > td[eventid='+id+']').html(row);
|
||||
});
|
||||
},
|
||||
complete: function () {
|
||||
null;
|
||||
},
|
||||
error: function( jqxhr, textStatus, error ) {
|
||||
var err = textStatus + ", " + error;
|
||||
console.log( "Request Failed: " + err );
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* toggles visibility of filtered markers
|
||||
* only events in the event list are shown */
|
||||
function toggleFilteredMarkers() {
|
||||
@ -310,6 +342,10 @@ $(document).ready(function() {
|
||||
});
|
||||
// show / hide event info
|
||||
$('#eventstable').delegate('.toggle', 'click' , function(){
|
||||
// load event details
|
||||
var eventid = $(this).attr('eventid');
|
||||
( eventDetails[eventid] ) ? null : ajaxLoadEventInfo(eventid);
|
||||
|
||||
// toggle visibility of selected row
|
||||
$(this).closest('tr').nextUntil('tr.tablesorter-hasChildRow').find('td').toggle('slow');
|
||||
// mark currently selected row and remove class selected from all other rows
|
||||
|
Loading…
Reference in New Issue
Block a user