Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot-fix coming through! #87

Merged
merged 3 commits into from
Jul 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
286 changes: 286 additions & 0 deletions ClimateMonitorV2/public/files/backup.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
Column3,Column2,Column1
50.78,0.292,4696
57.138,-2.078,5331
50.818,0.314,5531
53.452,-2.264,6356
51.464,-2.566,7675
51.474,-2.576,7685
57.13,-2.086,7789
57.146,-2.114,8554
51.104,-4.162,8568
51.43,-2.612,8582
57.136,-2.108,8733
50.77,0.278,9044
51.464,-2.566,10491
51.502,-2.702,11068
52.422,-1.516,11276
50.774,0.256,11315
51.222,-0.194,11324
50.76,0.282,12585
51.498,-2.694,12711
51.086,-0.302,13295
56.456,-3.12,13356
53.33,-1.18,14326
50.792,0.252,14369
51.484,-2.584,14787
51.076,-0.516,15108
53.612,-2.416,15177
57.124,-2.102,15462
50.842,0.166,15629
51.442,-0.522,15869
50.786,0.324,15873
51.108,-4.162,15980
50.776,0.294,16324
57.106,-2.088,17079
51.452,-2.574,17318
51.468,-2.574,17502
51.11,-4.158,17648
51.822,-2.268,17741
50.858,0.592,18257
51.382,-0.156,18489
50.15,-5.616,18848
53.36,-1.01,19356
53.36256396126,-1.48549318314,19818
51.796,-0.172,20605
52.138,-0.45,20743
51.44,-2.574,20842
53.36091530484,-1.49962842464,20926
53.356,-1.504,20978
53.398,-1.514,21103
53.364,-1.48,21258
50.146,-5.63,21343
53.36292300000,-1.51208900000,21388
53.336,-1.51,21422
50.932,0.246,21497
51.698,-0.292,21792
53.35384000000,-1.46486500000,21921
53.35450300000,-1.46672600000,21931
53.404,-1.51,21987
51.574,-2.572,21989
51.576,0.194,21991
53.388,-1.504,21997
51.698,-0.292,22015
57.196,-2.1,22068
53.354,-1.48,22174
50.858,-1.778,22308
53.412,-1.328,22363
57.39,-2.468,22449
51.698,-0.292,22476
56.964,-2.212,22480
57.11,-2.24,22523
57.164,-2.12,22549
57.51,-1.84,22612
50.79,0.298,22614
57.158,-2.106,22618
57.172,-2.134,22691
53.398,-1.496,22810
51.45,-0.24,22837
57.548,-2.024,22879
57.15,-2.108,23007
53.532,-1.478,23146
56.39,-3.266,23280
53.36008400000,-1.51100200000,23582
57.15,-2.134,23628
51.466,-2.564,23644
51.472,-2.558,23646
53.404,-1.502,23866
53.37,-1.38,24135
51.45,-2.624,24147
53.362,-1.518,24153
53.47046796690,-1.47156178951,24155
53.35785700000,-1.48375500000,24167
53.39704500000,-1.50763010000,24174
53.36333513392,-1.51090294356,24189
53.41114345477,-1.39174461365,24199
53.42735200384,-1.47451758385,24237
53.38132533802,-1.45959377289,24239
53.37347229745,-1.41774058342,24247
53.36764010000,-1.36707750000,24297
53.42111867767,-1.45467996597,24319
56.468,-3.004,24389
53.364,-1.504,24409
57.20352965455,-2.28857231093,24543
51.39407136029,-1.32308006287,24563
53.40175757548,-1.46569311619,24655
50.78213142427,0.25483676360,24981
53.372,-1.556,25259
53.36274322879,-1.48576140404,25275
51.38,0.098,25287
51.386,0.016,25359
52.772,-3.89,25435
52.024,0.248,25445
50.79699250000,0.27956820000,25545
57.174,-2.112,25555
52.98907351825,-0.74913024902,25585
53.36601010000,-1.35190380000,25587
53.37312025276,-1.41825020313,25591
53.36936919590,-1.50477826595,25599
53.35504685093,-1.46655678749,25601
53.40033620000,-1.50259730000,25611
53.37482924250,-1.46074712276,25691
50.77046146318,0.25733113289,25802
51.00901597642,-0.10872615911,25958
51.38,0.098,26060
51.412,0.01,26253
53.37111994358,-1.55310094357,26361
53.36417734190,-1.47216796875,26381
57.172,-2.124,26616
50.774,0.268,26624
56.46665135897,-3.20591568947,26626
51.55453761246,-0.08730053902,26658
52.24588080000,-0.87026500000,26736
56.46667506635,-3.20636630058,26910
51.42139982562,-2.71091938019,26922
0,0,27015
53.36890509167,-1.50409162045,27073
53.38752610465,-1.49428009987,27077
57.07225290000,-2.79766460000,27173
57.16675693579,-2.11801171303,27319
57.15347386797,-2.27150809762,27321
57.104,-2.094,27333
57.148,-2.144,27365
50.778,0.258,27422
57.19412020000,-2.12101660000,27434
51.24961600000,-1.11879100000,27513
57.15465532530,-2.11653113365,27529
53.42309106484,-1.52489751577,27552
57.152,-2.118,27644
57.206,-2.184,27686
51.38,0.098,27706
50.77462740534,0.26191234589,27784
53.442,-2.276,27897
50.756,0.254,27989
54.488,-0.624,28110
52.464,-1.484,28128
52.04,0.246,28144
53.346,-1.688,28170
51.672,-0.4,28262
52.87,-1.416,28447
52.01478600000,0.23776200000,28575
51.54593472227,-0.14490097761,28601
53.32436919333,-1.52202486992,28820
53.39221607432,-1.51845216751,28852
53.37520687518,-1.44629001617,28870
53.37012135408,-1.49112582207,28888
52.726,-2.108,28934
53.35080758690,-1.47421841277,28950
57.138,-2.118,29002
53.38922796795,-1.51274534874,29078
53.36,-1.484,29080
53.026,-1.092,29096
52.988,-0.75,29132
52.98842767256,-0.74904441833,29136
53.22,-0.554,29138
52.988,-0.75,29142
52.59,-1.072,29144
51.75269748495,0.44178128242,29308
50.772,0.274,29364
53.386,-1.514,29426
53.40101237266,-1.50951504707,29448
52.02470271690,0.23705899715,29630
51.38,-0.176,29700
51.488,0.152,29730
53.356,-1.464,29838
53.364,-1.488,29878
50.82,0.236,30006
51.62,-3.97,30008
51.508,-0.386,30036
57.07200000000,-2.79700000000,30104
52.24166346754,0.58282256126,30213
57.08046324603,-2.79308080673,30311
51.698,-0.292,30770
50.68094900000,-2.06157400000,30776
51.71604840004,-4.94716286659,30780
51.39814403335,-0.19052910811,30798
55.882,-4.336,31014
51.38,0.098,31083
51.37490000000,-2.91450000000,31188
51.562,0.012,31658
53.44191524440,-1.46924972534,31702
53.37959100948,-1.47568702698,31706
53.35462421422,-1.51580750942,31710
53.35964860719,-1.51730554411,31722
51.38,0.098,31758
51.092,-0.708,32036
53.34767568453,-1.49644575315,32182
51.498,-0.136,32190
51.38,0.098,32222
57.11736800000,-2.19439100000,32405
52.498,-2.168,32679
53.346,-1.46,32970
51.456,-2.62,32984
53.36905506340,-1.50163515704,33461
51.436,-2.742,33862
51.538,-0.084,34230
51.504,-2.59,34288
51.85050594043,-2.24506795406,34457
51.828,-2.298,34896
51.46,-2.536,34954
51.46117342329,-2.54220520612,35068
51.43406343553,-2.00435578823,35370
51.462,-2.554,35382
51.538,-0.084,35456
50.794,-1.066,35558
53.41173064047,-1.42454524292,36287
51.44,-2.006,36367
50.848,-1.216,36445
53.35819473222,-1.51600125711,36477
53.36686297299,-1.49922609329,36549
51.842,-2.23,37221
50.77294478933,0.28155684471,37235
50.77420890000,0.09185340000,37795
50.87,0.022,37805
50.922,0.018,37809
50.88390300000,0.01736420000,37849
50.88536840000,0.00592280000,37853
50.87637920000,0.00491870000,37875
50.87489730000,-0.00296590000,38075
51.68762500000,-2.22807200000,38164
51.396,-2.354,38525
57.12442300000,-2.17391900000,38541
51.34539750818,0.52727937698,38561
53.034,-3.03,38637
51.64,-0.752,38811
53.36266079784,-1.48563295137,38927
52.04916846953,-0.82256108522,39142
51.446,-0.186,39226
51.386,-2.352,39254
51.88,-0.518,39434
52.416,-0.732,39893
51.444,-2.606,39950
53.326,-2.73,40529
51.46384540000,-2.55561810000,40571
51.71895975759,-2.18442052603,40575
51.85,-2.246,40717
55.06,-3.392,41191
51.438,-0.01,41309
57.132,-2.084,41657
50.86,0.258,41761
57.134,-2.136,41861
53.366,-1.498,41897
57.1,-2.92,42082
51.414,0.018,42186
52.32,0.36,42616
51.426,0.102,42818
51.51482500000,-0.17917100000,43206
53.06870966712,-2.04217761755,43282
52.42662183130,-1.90860092640,43363
51.514,-0.178,43419
51.444,-2.018,43435
53.35870232350,-1.32793125696,43708
52.924,-2.388,43803
52.44257775000,-1.94274742969,44124
51.47,-0.152,44232
54.734,-1.75,44410
51.38,0.098,44532
51.822,-0.326,44564
51.38,0.098,44578
51.38,0.098,44670
51.38,0.098,44698
52.446,-1.93,44716
52.05521581313,-3.16630985588,44744
51.38,0.098,44774
57.424,-1.92,44820
51.38,0.098,44844
52.512,-1.188,44955
53.32470882462,-1.74132227898,45087
1 change: 1 addition & 0 deletions ClimateMonitorV2/public/files/data.24h.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ClimateMonitorV2/public/files/data.json

Large diffs are not rendered by default.

29 changes: 20 additions & 9 deletions ClimateMonitorV2/public/javascripts/new_mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ function respiratoryDiseasePeoplePM2(PM2, people, id) {

}

function fractionalreducer(numerator, denominator) {
var gcd = function gcd(a, b) {
return (b ? gcd(b,a%b) : a)
}
gcd = gcd(numerator, denominator)
return [numerator/gcd, denominator/gcd]
}
function human_display(people, infected, id, preface) {
if (preface == null) {
preface = "<p></p>"
Expand All @@ -67,10 +74,14 @@ function human_display(people, infected, id, preface) {
}

$(id).empty()
infected = Math.ceil(infected)
console.log("Infected people" + infected)
console.log("Healthy people:" + people)
$(id).append(preface)
$(id).append("<p> Out of " + String(people*10) + " people, " + String(infected*10) + " would sadly lose their lives due to pollution.")
//fractions = fractionalreducer(people, infected)

//healthy = fractions[0]
//infected = fractions[1]
$(id).append("<p> Out of " + String(people) + " people, " + String(infected) + " would sadly lose their lives due to pollution.")

for (i = 0; i < (people-infected); i++) {
$(id).append(`
Expand Down Expand Up @@ -330,10 +341,7 @@ $(document).ready(() => {
var pm2Chart = document.getElementById('pm2Chart').getContext('2d');
var pm10Chart = document.getElementById('pm10Chart').getContext('2d');
// Currently not in use, date range picker for graphs


//human_display(500, 100, "#danger_level")
human_display(500, 100, "#danger_level2", null)


var scatterChartPM2 = new Chart(pm2Chart, {
type: 'scatter',
Expand Down Expand Up @@ -614,6 +622,8 @@ $(document).ready(() => {

})
}


function updateGraphMultiDay(data) {
var i;
label2 = "PM2.5 Values"
Expand Down Expand Up @@ -682,14 +692,15 @@ $(document).ready(() => {
findDates(sensor_id)
});

var json = $.getJSON('http://api.luftdaten.info/static/v2/data.24h.json', function (data) {
console.log("Going To Luftdaten")
var json = $.getJSON('https://data.sensor.community/static/v2/data.1h.json', function (data) {
var counter = 0
var totalpm2 = 0
var totalpm10 = 0

console.log("Let's ty this again")
$.each(data, function (key, val) {
if ((val.location.longitude > -1.58) && (val.location.longitude < -1.34) && (val.location.latitude <= 53.468) && (val.location.latitude >= 53.29)) {
console.log("Found one in the correct location")

if (val.sensordatavalues[0].value_type == "P1") {
counter++;
totalpm10 += parseFloat(val.sensordatavalues[0].value)
Expand Down