home.html.jinja2
6.88 KB
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
{% extends 'layout.html.jinja2' %}
{% set menu_section = 'home' %}
{% block title %}Home{% endblock %}
{% block content %}
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-drawer">
<div class="mdl-layout__drawer">
<span class="mdl-layout-title">Planets</span>
<section id="orbiters_filters">
{% for planet in planets %}
<img title="{{ planet.title }}" src="{{ static('img/target/'~planet.slug~'_128.png') }}" width="64px" height="64px" alt="{{ planet.name }}" class="{{ 'locked' if planet.locked }}">
{% endfor %}
</section>
<br>
<hr class="clear">
<span class="mdl-layout-title">Probes</span>
<section id="orbiters_filters">
{% for probe in probes %}
<img title="{{ probe.title }}" src="{{ static('img/target/'~probe.slug~'_128.png') }}" width="64px" height="64px" alt="{{ probe.name }}" class="{{ 'locked' if probe.locked }}">
{% endfor %}
</section>
<br>
<hr class="clear">
<span class="mdl-layout-title">Comets</span>
<section id="orbiters_filters">
{% for comet in comets %}
<img title="{{ comet.title }}" src="{{ static('img/target/'~comet.slug~'_128.png') }}" width="64px" height="64px" alt="{{ comet.name }}" class="{{ 'locked' if comet.locked }}">
{% endfor %}
</section>
<br>
<hr class="clear">
<span class="mdl-layout-title">Parameters</span>
<nav id="parameters" class="mdl-navigation">
<a class="mdl-navigation__link parameter active" data-ts-slug="pdyn" href="#">Dynamic Pressure</a>
<a class="mdl-navigation__link parameter" data-ts-slug="magn" href="#">B Tangential</a>
<a class="mdl-navigation__link parameter" data-ts-slug="vlen" href="#">Velocity</a>
<a class="mdl-navigation__link parameter" data-ts-slug="temp" href="#">Temperature</a>
<a class="mdl-navigation__link parameter" data-ts-slug="dens" href="#">Density</a>
<a class="mdl-navigation__link parameter" data-ts-slug="angl" href="#">Angle Source-Sun-Earth</a>
</nav>
</div>
<main id="plots_wrapper" class="mdl-layout__content">
<div class="mdl-grid">
<div class="mdl-cell mdl-cell--4-col">
<section id="orbits"></section>
</div>
<div class="mdl-cell mdl-cell--8-col">
<section id="time_series"></section>
</div>
</div>
{# <div class="loader"><div class="hole"></div></div>#}
</main>
</div>
{% endblock %}
{% block styles %}
<style>
html, body {
{# background-color: #322e3f;#}
{# color: #e3e3e3;#}
}
.axis path, .axis line {
fill: none;
{# stroke: #f4f4f4;#}
shape-rendering: crispEdges;
stroke-width: 1px;
}
svg text {
{# fill: #f4f4f4;#}
}
path.line {
fill: none;
stroke: steelblue;
stroke-width: 1px;
}
circle.cursor-circle {
fill: black;
stroke: rgba(20, 20, 20, 0.48);
}
text.cursor-text {
{# font-family: 'Ubuntu', 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif;#}
{# font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;#}
font-family: "Ubuntu Mono", 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
text-align: right;
}
text.cursor-text-shadow {
stroke: white;
stroke-width: 5px;
opacity: 0.777
}
path.orbit.orbit_section {
fill: none;
stroke: steelblue;
stroke-width: 3px;
}
ellipse.orbit.orbit_ellipse {
fill: none;
stroke: #a3a3a3;
stroke-width: 1px;
stroke-dasharray: 5px;
}
#orbiters_filters {
padding-left: 17px;
}
#orbiters_filters img {
float: left;
}
#orbiters_filters img.locked {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-o-filter: grayscale(100%);
-ms-filter: grayscale(100%);
filter: grayscale(100%);
}
#orbits {
{# background-image: url('{{ static('img/orbitals_background.png') }}');#}
{# background-repeat: repeat;#}
{# background-size: 42%;#}
}
#parameters .parameter {
outline: 0;
}
#parameters .parameter.active {
background-color: #c8d3e1;
}
</style>
{% endblock %}
{% block scripts_footer %}
<script type="application/javascript" src="{{ static('js/vendor/d3.min.js') }}"></script>
<script type="application/javascript" src="{{ static('js/swapp.js') }}"></script>
<script type="application/javascript">
var configuration = {
time_series_container: '#time_series',
orbits_container: '#orbits',
api : {
'data_for_interval': "{{ request.url_root }}<source>/data.csv"
// ?started_at=<started_at>&stopped_at=<stopped_at>
},
sun: {
img: '{{ static('img/sun_128.png') }}'
},
sources : {
{% for target in targets if not target.locked%}
{% if not loop.first %},{% endif %}
'{{ target.slug }}': {
slug: '{{ target.slug }}',
name: '{{ target.name }}',
active: true,
orbit: { a: {{ target.orbit.semimajor }}, b: {{ target.orbit.semiminor }} },
img: '{{ static('img/target/'~target.slug~'_128.png') }}'
}
{% endfor %}
{# jupiter: {#}
{# slug: 'jupiter',#}
{# name: 'Jupiter',#}
{# active: true,#}
{# minDate: '1990-01-01T01:30:00',#}
{# maxDate: '2017-02-19T00:00:00',#}
{# orbit: { a: 5.45516759, b: 4.95155843 },#}
{# img: '{{ static('img/target/jupiter_128.png') }}'#}
{# },#}
},
{# todo @Nicolas Define -somehow- error margins of each parameter #}
parameters : [
{
id: 'pdyn',
title: "Dynamic Pressure (nPa)",
active: true,
unit: "nPa"
},
{
id: 'magn',
title: "Magnetism (nT)",
active: false,
unit: "nT"
},
{
id: 'vlen',
title: "Velocity (km/s)",
active: false,
unit: "km/s"
},
{
id: 'temp',
title: "Temperature (K)",
active: false,
unit: "K"
},
{
id: 'dens',
title: "Density N (cm⁻³)",
active: false,
unit: "cm⁻³"
},
{
id: 'angl',
title: "Angle S-S-E (deg)",
active: false,
unit: "deg"
}
]
};
jQuery().ready(function($){
var sw = new SpaceWeather(configuration);
sw.init();
var toggleTimeSeries = function(slug) {
$('#time_series .'+slug).toggleClass('hidden');
};
var isParameterEnabled = function(parameter_id) {
$('#parameters .parameter[data-ts-slug='+slug+']').hasClass('active');
};
$("#parameters .parameter").click(function(e){
e.stopPropagation();
var switch_on = ! $(this).hasClass('active');
var parameter_slug = $(this).attr('data-ts-slug');
if (switch_on) {
sw.enableParameter(parameter_slug);
} else {
sw.disableParameter(parameter_slug);
}
$(this).toggleClass('active');
{# toggleTimeSeries($(this).attr('data-ts-slug'));#}
return false;
});
window.addEventListener('resize', function() { sw.resize(); });
});
</script>
{% endblock %}