..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Analyzing Climate Change using Earth Surface Temperature Visualization</title>
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="{{url_for('static',filename='css/style.css')}}">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin="" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
</head>
<body>
<div class="relative min-h-screen md:flex" data-dev-hint="container">
<main id="content" class="flex-1 p-6 lg:px-8 h-screen overflow-y-auto">
<nav class="bg-white border-gray-200 px-2 sm:px-4 py-2.5 rounded dark:bg-gray-800">
<div class="container flex flex-wrap items-center justify-between mx-auto">
<div class="flex" title="Analyzing Climate Change using Earth Surface Temperature Visualization">
<span class="text-xl font-extrabold whitespace-nowrap truncate">Analyzing Climate Change
using
Earth Surface Temperature Visualization</span>
</div>
<div class="flex md:order-2">
<div class="relative hidden mr-3 md:mr-0 md:block">
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
<svg class="w-5 h-5 text-gray-500" fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
clip-rule="evenodd"></path>
</svg>
</div>
<input type="text"
class="block w-full p-2 pl-10 text-gray-900 border border-gray-300 rounded-lg bg-gray-50 sm:text-sm focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
placeholder="Search for a city..." id="citySearch" autocomplete="off" />
<div id="result_container"
class="absolute w-full p-2 bg-white top-10 -left-0 text-gray-900 border border-gray-300 rounded-lg bg-gray-50 sm:text-sm max-h-64 overflow-y-auto hidden"
style="z-index: 1000;">
<ul id="results" class="list-reset h-full block"></ul>
</div>
</div>
<button id="displayData"
class="inline-flex items-center px-4 py-1 font-semibold leading-6 text-sm shadow rounded-md text-white bg-indigo-600 hover:bg-indigo-700 text-center ml-3">
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
stroke-width="2" viewBox="0 0 24 24" class="w-6 h-6">
<path d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
</svg>
</button>
</div>
</div>
</nav>
<div class="h-3/4 mx-auto">
<div class="border-4 border-dashed border-gray-200 rounded-lg h-full">
<div id="map"></div>
<div id="rangeContainer" class="rangeContainer hidden" style=" position: relative;
top: -12vh;
z-index: 1000;
right: 0vw;
background: white;
padding: 30px 30px 30px 30px;
width: 615px;">
<p style="position: relative;
top: -20px;
left: -15px;">Temperature Visualization:</p>
<div class="range">
<input id="changeDate" type="range" min="1" max="7" steps="1" value="1">
</div>
<ul class="range-labels">
<li class="active selected">Today</li>
<li>Tomorrow</li>
<li>Day 3</li>
<li>Day 4</li>
<li>Day 5</li>
<li>Day 6</li>
<li>Day 7</li>
</ul>
</div>
</div>
</div>
<div class="mx-auto px-3 py-6 text-center">
<button type="button"
class="inline-flex items-center px-4 py-2 font-semibold leading-6 text-sm shadow rounded-md text-white bg-indigo-500 hover:bg-indigo-400 transition ease-in-out duration-150 cursor-not-allowed hidden"
disabled="" id="processingButton">
<svg class="animate-spin -ml-1 mr-3 h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg"
fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4">
</circle>
<path class="opacity-75" fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
</path>
</svg>
Processing...
</button>
<div id="predictionImage" class="w-full"></div>
</div>
</main>
</div>
</body>
<script src="https://cdn.plot.ly/plotly-2.6.3.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script type="text/javascript">
const cities = JSON.parse('{{cities_list | tojson}}');
</script>
<script src="../static/js/map.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="../static/js/search.js" defer></script>
<script src="../static/js/prediction.js" defer></script>
<script>
var sheet = document.createElement('style'),
$rangeInput = $('.range input'),
prefs = ['webkit-slider-runnable-track', 'moz-range-track', 'ms-track'];
document.body.appendChild(sheet);
var getTrackStyle = function (el) {
var curVal = el.value,
val = (curVal - 1) * 16.666666667,
style = '';
// Set active label
$('.range-labels li').removeClass('active selected');
var curLabel = $('.range-labels').find('li:nth-child(' + curVal + ')');
curLabel.addClass('active selected');
curLabel.prevAll().addClass('selected');
// Change background gradient
for (var i = 0; i < prefs.length; i++) {
style += '.range {background: linear-gradient(to right, #37adbf 0%, #37adbf ' + val + '%, #fff ' + val + '%, #fff 100%)}';
style += '.range input::-' + prefs[i] + '{background: linear-gradient(to right, #37adbf 0%, #37adbf ' + val + '%, #b2b2b2 ' + val + '%, #b2b2b2 100%)}';
}
return style;
}
$rangeInput.on('input', function () {
sheet.textContent = getTrackStyle(this);
});
// Change input value on label click
$('.range-labels li').on('click', function () {
var index = $(this).index();
$rangeInput.val(index + 1).trigger('input');
var currentCityName = document.getElementById('citySearch').value || 'Buffalo';
var latitude = document.getElementById('citySearch').getAttribute('latitude') || '42.8864';
var longitude = document.getElementById('citySearch').getAttribute('longitude') || '-78.8784';
changeColor({ city: currentCityName, latitude: latitude, longitude: longitude }, temperatureData[index]);
});
document.getElementById('changeDate').addEventListener('change', (e) => {
var currentCityName = document.getElementById('citySearch').value || 'Buffalo';
var latitude = document.getElementById('citySearch').getAttribute('latitude') || '42.8864';
var longitude = document.getElementById('citySearch').getAttribute('longitude') || '-78.8784';
changeColor({ city: currentCityName, latitude: latitude, longitude: longitude }, temperatureData[e.target.value - 1]);
})
</script>
</html>
|
|