Skip to content

Commit ff4654b

Browse files
committed
sonde type launched improvements
1 parent 078bded commit ff4654b

File tree

2 files changed

+33
-26
lines changed

2 files changed

+33
-26
lines changed

js/tracker.js

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ var launches = null;
3434
var receiverCanvas = null;
3535

3636
var sondePrefix = ["RS92", "RS92-SGP", "RS92-NGP", "RS41", "RS41-SG", "RS41-SGP", "RS41-SGM", "DFM", "DFM06", "DFM09", "DFM17", "M10", "M20", "iMet-4", "iMet-54", "LMS6", "LMS6-400", "LMS6-1680", "iMS-100", "MRZ", "chase"];
37+
var sondeCodes = {
38+
"07":"iMet-1", "11":"LMS6-403", "13":"RS92", "14":"RS92", "17":"DFM-09", "19":"MRZ-N1", "22":"RS-11G", "23":"RS41", "24":"RS41", "34":"iMet-4", "35":"iMS-100", "41":"RS41", "42":"RS41", "52":"RS92-NGP", "54":"DFM-17",
39+
"62":"MRZ-3MK", "63":"M20", "77":"M10", "82":"LMS6-1680", "84":"iMet-54"
40+
};
41+
var unsupportedSondeCodes = {
42+
"15":"PAZA-12M", "16":"PAZA-22", "18":"DFM-06", "20":"MK3", "21":"1524LA LORAN-C/GL5000", "26":"SRS-C34", "27":"AVK-MRZ", "28":"AVK–AK2-02", "29":"MARZ2-2", "30":"RS2-80", "33":"GTS1-2/GFE(L)", "45":"CF-06", "58":"AVK-BAR",
43+
"59":"M2K2-R", "68":"AVK-RZM-2", "69":"MARL-A/Vektor-M-RZM-2", "73":"MARL-A", "78":"RS90", "80":"RS92", "88":"MARL-A/Vektor-M-MRZ", "89":"MARL-A/Vektor-M-BAR", "97":"iMet-2", "99":"iMet-2"
44+
};
3745

3846
var got_positions = false;
3947
var zoomed_in = false;
@@ -821,28 +829,27 @@ function showLaunchSites() {
821829
for (var key in json) {
822830
if (json.hasOwnProperty(key)) {
823831
var latlon = [json[key].lat, json[key].lon];
824-
var sondes = json[key].rs_types.toString();
825-
sondes = sondes.replace(new RegExp("\\b07\\b"), "iMet-1 (possible to track)");
826-
sondes = sondes.replace(new RegExp("\\b11\\b"), "LMS6-403 (possible to track)");
827-
sondes = sondes.replace(new RegExp("\\b13\\b"), "RS92 (possible to track)");
828-
sondes = sondes.replace(new RegExp("\\b14\\b"), "RS92 (possible to track)");
829-
sondes = sondes.replace(new RegExp("\\b17\\b"), "DFM-09 (possible to track)");
830-
sondes = sondes.replace(new RegExp("\\b19\\b"), "MRZ-N1 (possible to track)");
831-
sondes = sondes.replace(new RegExp("\\b21\\b"), "RS-11G (possible to track)");
832-
sondes = sondes.replace(new RegExp("\\b22\\b"), "RS-11G (possible to track)");
833-
sondes = sondes.replace(new RegExp("\\b23\\b"), "RS41 (possible to track)");
834-
sondes = sondes.replace(new RegExp("\\b24\\b"), "RS41 (possible to track)");
835-
sondes = sondes.replace(new RegExp("\\b34\\b"), "iMet-4 (possible to track)");
836-
sondes = sondes.replace(new RegExp("\\b35\\b"), "iMS-100 (possible to track)");
837-
sondes = sondes.replace(new RegExp("\\b41\\b"), "RS41 (possible to track)");
838-
sondes = sondes.replace(new RegExp("\\b42\\b"), "RS41 (possible to track)");
839-
sondes = sondes.replace(new RegExp("\\b52\\b"), "RS92-NGP (possible to track)");
840-
sondes = sondes.replace(new RegExp("\\b54\\b"), "DFM-17 (possible to track)");
841-
sondes = sondes.replace(new RegExp("\\b62\\b"), "MRZ-3MK (possible to track)");
842-
sondes = sondes.replace(new RegExp("\\b63\\b"), "M20 (possible to track)");
843-
sondes = sondes.replace(new RegExp("\\b77\\b"), "M10 (possible to track)");
844-
sondes = sondes.replace(new RegExp("\\b82\\b"), "LMS6-1680 (possible to track)");
845-
sondes = sondes.replace(new RegExp("\\b84\\b"), "iMet-54 (possible to track)");
832+
var sondes = json[key].rs_types;
833+
var sondesList = "";
834+
for (var y = 0; y < sondes.length; y++) {
835+
if (Array.isArray(sondes[y]) == false) {
836+
sondes[y] = [sondes[y]];
837+
}
838+
if (sondeCodes.hasOwnProperty(sondes[y][0])) {
839+
sondesList += sondeCodes[sondes[y][0]]
840+
if (sondes[y].length > 1) {
841+
sondesList += " (" + sondes[y][1] + " MHz)";
842+
}
843+
} else if (unsupportedSondeCodes.hasOwnProperty(sondes[y][0])) {
844+
sondesList += unsupportedSondeCodes[sondes[y][0]];
845+
sondesList += " (cannot track)";
846+
} else {
847+
sondesList += sondes[y][0] + " (unknown WMO code)";
848+
}
849+
if (y < sondes.length-1) {
850+
sondesList += ", ";
851+
}
852+
}
846853
var marker = new L.circleMarker(latlon, {color: '#696969', fillColor: "white", radius: 8});
847854
var popup = new L.popup({ autoClose: false, closeOnClick: false });
848855
marker.bindPopup(popup);
@@ -871,11 +878,11 @@ function showLaunchSites() {
871878
if (tempDate) {
872879
if (date < tempDate) {
873880
tempDate = date;
874-
popupContent = "<font style='font-size: 13px'>" + json[key].station_name + "</font><br><br><b>Sondes launched:</b> " + sondes + "<br><b>Next launch:</b> " + date.toString();
881+
popupContent = "<font style='font-size: 13px'>" + json[key].station_name + "</font><br><br><b>Sondes launched:</b> " + sondesList + "<br><b>Next launch:</b> " + date.toString();
875882
}
876883
} else {
877884
tempDate = date;
878-
popupContent = "<font style='font-size: 13px'>" + json[key].station_name + "</font><br><br><b>Sondes launched:</b> " + sondes + "<br><b>Next launch:</b> " + date.toString();
885+
popupContent = "<font style='font-size: 13px'>" + json[key].station_name + "</font><br><br><b>Sondes launched:</b> " + sondesList + "<br><b>Next launch:</b> " + date.toString();
879886
}
880887
}
881888
var ascent_rate = 5;
@@ -921,7 +928,7 @@ function showLaunchSites() {
921928
popupContent += "<br><b>Know when this site launches?</b> Contribute <a href='https://github.com/projecthorus/sondehub-tracker/issues/114' target='_blank'>here</a>";
922929
popupContent += "<br><button onclick='launchSitePredictions(\"" + json[key]['times'].toString() + "\", \"" + latlon.toString() + "\", \"" + ascent_rate + ":" + descent_rate + ":" + burst_altitude + "\", \"" + launches.getLayerId(marker) + "\")' style='margin-bottom:0;'>Generate Predictions</button>";
923930
} else {
924-
popupContent = "<font style='font-size: 13px'>" + json[key].station_name + "</font><br><br><b>Sondes launched:</b> " + sondes;
931+
popupContent = "<font style='font-size: 13px'>" + json[key].station_name + "</font><br><br><b>Sondes launched:</b> " + sondesList;
925932
popupContent += "<br><b>Know when this site launches?</b> Contribute <a href='https://github.com/projecthorus/sondehub-tracker/issues/114' target='_blank'>here</a>";
926933
}
927934
popup.setContent(popupContent);

launchSites.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@
668668
{"station":"94711","rs_types":["42"],"lat":-31.4839,"lon":145.8294,"alt":264,"station_name":"Cobar (Australia)","times":["3:00:00","4:00:00","6:00:00"]},
669669
{"station":"94750","rs_types":["41"],"lat":-34.9469,"lon":150.5353,"alt":122,"station_name":"Nowra Ran Air Station (Australia)"},
670670
{"station":"94767","rs_types":["41"],"lat":-33.9464,"lon":151.1731,"alt":6,"station_name":"Sydney Airport (Australia)","times":["0:21:00"]},
671-
{"station":"94776","rs_types":["42"],"lat":-32.7933,"lon":151.8358,"alt":9,"station_name":"Williamtown Aerodrome (Australia)","times":["0:00:00"]},
671+
{"station":"94776","rs_types":[["42","402.500"]],"lat":-32.7933,"lon":151.8358,"alt":9,"station_name":"Williamtown Aerodrome (Australia)","times":["0:00:00"]},
672672
{"station":"94802","rs_types":["42"],"lat":-34.9414,"lon":117.8022,"alt":71,"station_name":"Albany Airport (Australia)","times":["4:00:00","5:00:00","6:00:00","2:00:00"]},
673673
{"station":"94821","rs_types":["42"],"lat":-37.7472,"lon":140.7739,"alt":65,"station_name":"Mount Gambier Aerodrome (Australia)","times":["4:00:00","1:00:00"]},
674674
{"station":"94866","rs_types":["41"],"lat":-37.6656,"lon":144.8322,"alt":132,"station_name":"Melbourne Airport (Australia)","times":["0:12:00","0:00:00"]},

0 commit comments

Comments
 (0)