Bez tytułu

z Chunky Prairie Dog, 1 tydzień temu, napisane w Plain Text, wyświetlone 10 razy. [paste_expire] 10 miesiące.
URL https://pastebin.k4be.pl/view/186f7e9e Udostępnij
Pobierz wklejkę lub Pokaż surowy tekst
  1. 272:
  2. 273: function summarytxt(e){
  3. 274:     var layer = e.target;
  4. 275:     // pcco2=layer.feature.properties.co2pc;
  5. 276:
  6. 277:     if (layer.feature.properties.co2pc<emissions){
  7. 278:            ratio=emissions/layer.feature.properties.co2pc;
  8. 279:            stringplus="This flight produces (per passenger) the same amount of greenhouse gases as "+ratio.toFixed(1)+" average resident of "+layer.feature.properties.name +" did in 2017.";
  9. 280:     } else {
  10. 281:            ratio=layer.feature.properties.co2pc/emissions;
  11. 282:            stringplus="This average resident of "+layer.feature.properties.name +" produced the same amount of greenhouse gases in 2017 as "+ratio.toFixed(1) +" of these flights (per passenger)";
  12. 283:     }
  13. 284:
  14. 285:     hoverstring="<span id='hovername'>"+layer.feature.properties.name+":</span> "+layer.feature.properties.co2pc+" tonnes CO<sub>2</sub> per capita<br>"+stringplus;
  15. 286:
  16. 345:
  17. 346: //constants for equation
  18. 347: shDC=50;
  19. 348: lhDC=125;
  20. 349: ash=3.87871E-05;
  21. 350: alh=0.000134576;
  22. 351: bsh=2.9866;
  23. 352: csh=1263.42;
  24. 353: blh=6.1798;
  25. 354: clh=3446.20;
  26. 355: Ssh=158.44;
  27. 356: Slh=280.39;
  28. 357: Plf=0.77;
  29. 358: passF=0.951;
  30. 359: ecosh=0.96;
  31. 360: ecolh=0.8;
  32. 361: bussh=1.26;
  33. 362: buslh=1.54;
  34. 363: fcsh=2.4;
  35. 364: fclh=2.4;
  36. 365: EF=3.150;
  37. 366: pp=0.51;
  38. 367: Mnonco2=2;
  39. 389:    eraseErrorMsg();
  40. 390:
  41. 391:    origin=airportdata[fromindex];
  42. 392:    destination=airportdata[toindex];
  43. 393:
  44. 394:    origincoord=[origin.Lat,origin.Long];
  45. 395:    destcoord=[destination.Lat,destination.Long];
  46. 396:
  47. 397:    greatcircledist=getDistance(origincoord,destcoord)/1000; //units of km
  48. 398:
  49. 399:    if (greatcircledist<1500){
  50. 400:            CW=ecosh;
  51. 401:            dist2=greatcircledist+shDC;
  52. 402:            flightdist= (dist2);
  53. 403:            emissions2=((ash*flightdist**2+bsh*flightdist+csh)/(Ssh*Plf))*passF*CW*(EF*Mnonco2+pp)*2/1000;
  54. 404:
  55. 405:    } else {
  56. 406:            CW=ecolh;
  57. 407:            dist2=greatcircledist+lhDC;
  58. 408:            flightdist= (dist2);
  59. 409:            emissions2=((alh*flightdist**2+blh*flightdist+clh)/(Slh*Plf))*passF*CW*(EF*Mnonco2+pp)*2/1000;
  60. 410:
  61. 421:
  62. 422:    // emissions = flightdist*175*2.7/1000000;  //unit is tonnes
  63. 423:    // emissions3=greatcircledist*0.62*co2fact/1000*2;  //miles * co2factor * roundtrip
  64. 424:
  65. 425:    emissions=emissions2;
  66. 426:    // console.log(emissions,emissions3);
  67. 427:    // console.log(emissions2/(flightdist*1.609)*1000);
  68. 428:    
  69. 429:    threshold=emissions;
  70. 430:
  71. 431:    drawSubset();
  72. 432:    drawGreatCircle();
  73. 433:    globaltxt();
  74. 434:
  75. 435:    emissionsstring="The round-trip flight from <span id='stringorig'>"+origin.City+"</span> to <span id='stringdest'>"+destination.City +"</span> is <span id='stringdist'>"+parseInt(flightdist*2/1.609).toLocaleString()+" miles</span> and produces <span id='stringemiss'>"+ emissions.toFixed(1)+" tonnes</span> of CO<sub>2</sub> equivalent emissions <b><i>for each passenger</i></b>. In 2017, <span id='stringnum'>"+numCountries+" countries</span> in the world have lower annual per capita emissions than this flight, accounting for <span id='stringpct'>"+pctpop+"</span> of the world's population."
  76. 436:    $("#emissions").html(emissionsstring);
  77. 437: }
  78. 438:
  79. 439: function getDistance(origin, destination) {
  80. 440:     // return distance in meters
  81. 441:     var lon1 = toRadian(origin[1]),
  82. 442:         lat1 = toRadian(origin[0]),
  83. 443:         lon2 = toRadian(destination[1]),
  84. 444:         lat2 = toRadian(destination[0]);
  85. 445:
  86. 446:     var deltaLat = lat2 - lat1;
  87. 447:     var deltaLon = lon2 - lon1;
  88. 448:
  89. 449:     var a = Math.pow(Math.sin(deltaLat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(deltaLon/2), 2);
  90. 450:     var c = 2 * Math.asin(Math.sqrt(a));
  91. 451:     var EARTH_RADIUS = 6371;
  92. 452:     return c * EARTH_RADIUS * 1000;

odpowiedź "Bez tytułu"

Tutaj możesz odpowiedzieć na wklejkę z góry

captcha