@@ -710,7 +710,7 @@ function launchSitePredictions(times, station, properties, marker) {
710710 }
711711 function handleData ( data ) {
712712 completed += 1 ;
713- plotPrediction ( data , dates , marker ) ;
713+ plotPrediction ( data , dates , marker , properties ) ;
714714 if ( completed == dates . length ) {
715715 popupContent += "<button onclick='deletePredictions(" + marker + ")' style='margin-bottom:0;'>Delete</button>" ;
716716 popup . setContent ( popupContent ) ;
@@ -725,7 +725,7 @@ function launchSitePredictions(times, station, properties, marker) {
725725 }
726726}
727727
728- function plotPrediction ( data , dates , marker ) {
728+ function plotPrediction ( data , dates , marker , properties ) {
729729 if ( ! launchPredictions . hasOwnProperty ( marker ) ) {
730730 launchPredictions [ marker ] = { } ;
731731 }
@@ -789,8 +789,13 @@ function plotPrediction (data, dates, marker) {
789789 } ) . addTo ( map ) ;
790790
791791 var landingTime = new Date ( landingPoint . datetime ) ;
792- var landingTooltip = "<b>Time:</b> " + landingTime . toLocaleString ( ) + "<br><b>Model Dataset:</b> " + data . request . dataset +
793- "<br><b>Model Assumptions:</b><br>- " + data . request . ascent_rate + "m/s ascent<br>- " + data . request . burst_altitude + "m burst altitude<br>- " + data . request . descent_rate + "m/s descent" ;
792+ if ( properties [ 3 ] != "" && properties [ 4 ] != "" ) {
793+ var landingTooltip = "<b>Time:</b> " + landingTime . toLocaleString ( ) + "<br><b>Model Dataset:</b> " + data . request . dataset +
794+ "<br><b>Model Assumptions:</b><br>- " + data . request . ascent_rate + "m/s ascent<br>- " + data . request . burst_altitude + "m burst altitude (" + properties [ 3 ] + " samples)<br>- " + data . request . descent_rate + "m/s descent (" + properties [ 4 ] + " samples)" ;
795+ } else {
796+ var landingTooltip = "<b>Time:</b> " + landingTime . toLocaleString ( ) + "<br><b>Model Dataset:</b> " + data . request . dataset +
797+ "<br><b>Model Assumptions:</b><br>- " + data . request . ascent_rate + "m/s ascent<br>- " + data . request . burst_altitude + "m burst altitude<br>- " + data . request . descent_rate + "m/s descent" ;
798+ }
794799 plot . landingMarker . bindTooltip ( landingTooltip , { offset : [ 13 , - 28 ] } ) ;
795800}
796801
@@ -860,6 +865,8 @@ function showLaunchSites() {
860865 var ascent_rate = 5 ;
861866 var descent_rate = 6 ;
862867 var burst_altitude = 26000 ;
868+ var burst_samples = "" ;
869+ var descent_samples = "" ;
863870 if ( json [ key ] . rs_types . includes ( "11" ) || json [ key ] . rs_types . includes ( "82" ) ) { //LMS6
864871 ascent_rate = 5 ;
865872 descent_rate = 2.5 ;
@@ -874,6 +881,12 @@ function showLaunchSites() {
874881 if ( json [ key ] . hasOwnProperty ( 'burst_altitude' ) ) {
875882 burst_altitude = json [ key ] [ "burst_altitude" ] ;
876883 }
884+ if ( json [ key ] . hasOwnProperty ( 'burst_samples' ) ) {
885+ burst_samples = json [ key ] [ "burst_samples" ] ;
886+ }
887+ if ( json [ key ] . hasOwnProperty ( 'descent_samples' ) ) {
888+ descent_samples = json [ key ] [ "descent_samples" ] ;
889+ }
877890 popupContent += "<br><b>Launch schedule:</b>" ;
878891 for ( var x = 0 ; x < json [ key ] [ 'times' ] . length ; x ++ ) {
879892 popupContent += "<br>- " ;
@@ -901,7 +914,7 @@ function showLaunchSites() {
901914 popupContent += "<br><b>Notes:</b> " + json [ key ] [ "notes" ] ;
902915 }
903916 popupContent += "<br><b>Know when this site launches?</b> Contribute <a href='https://github.com/projecthorus/sondehub-tracker/issues/114' target='_blank'>here</a>" ;
904- 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>" ;
917+ popupContent += "<br><button onclick='launchSitePredictions(\"" + json [ key ] [ 'times' ] . toString ( ) + "\", \"" + latlon . toString ( ) + "\", \"" + ascent_rate + ":" + descent_rate + ":" + burst_altitude + ":" + burst_samples + ":" + descent_samples + " \", \"" + launches . getLayerId ( marker ) + "\")' style='margin-bottom:0;'>Generate Predictions</button>" ;
905918 } else {
906919 popupContent = "<font style='font-size: 13px'>" + json [ key ] . station_name + "</font><br><br><b>Sondes launched:</b> " + sondesList ;
907920 popupContent += "<br><b>Know when this site launches?</b> Contribute <a href='https://github.com/projecthorus/sondehub-tracker/issues/114' target='_blank'>here</a>" ;
0 commit comments