Commit a79c5268a07736cbee9331479e6a27b252f9c40e

Authored by Goutte
1 parent 11662eed

Add probes and comets. (still locked)

@@ -35,6 +35,68 @@ authors: @@ -35,6 +35,68 @@ authors:
35 role: Project Coordinator 35 role: Project Coordinator
36 mail: vincent.genot@irap.omp.eu 36 mail: vincent.genot@irap.omp.eu
37 37
  38 +# `slug` used internally, and should match [a-z0-9]+
  39 +# `name` is displayed
  40 +# `title` appears on mouse hover
  41 +# `locked` is for sources that are "coming soon"
  42 +# `default` sources are shown to incoming visitors, others need user activation
  43 +sources:
  44 + - type: 'planet'
  45 + slug: 'mercury'
  46 + name: 'Mercury'
  47 + title: 'Mercury (coming soon)'
  48 + locked: true
  49 + default: true
  50 + - type: 'planet'
  51 + slug: 'venus'
  52 + name: 'Venus'
  53 + title: 'Venus (coming soon)'
  54 + locked: true
  55 + default: true
  56 + - type: 'planet'
  57 + slug: 'earth'
  58 + name: 'Earth'
  59 + title: 'Earth (coming soon)'
  60 + locked: true
  61 + default: true
  62 + - type: 'planet'
  63 + slug: 'mars'
  64 + name: 'Mars'
  65 + title: 'Mars (coming soon)'
  66 + locked: true
  67 + default: true
  68 + - type: 'planet'
  69 + slug: 'jupiter'
  70 + name: 'Jupiter'
  71 + title: 'Jupiter'
  72 + locked: false
  73 + default: true
  74 + - type: 'planet'
  75 + slug: 'saturn'
  76 + name: 'Saturn'
  77 + title: 'Saturn (coming soon)'
  78 + locked: true
  79 + default: true
  80 + - type: 'probe'
  81 + slug: 'rosetta'
  82 + name: 'Rosetta'
  83 + title: 'Rosetta (coming soon)'
  84 + locked: true
  85 + default: false
  86 + - type: 'probe'
  87 + slug: 'juno'
  88 + name: 'Juno'
  89 + title: 'Juno (coming soon)'
  90 + locked: true
  91 + default: false
  92 + - type: 'comet'
  93 + slug: 'tchouri'
  94 + name: 'Tchouri'
  95 + title: 'Tchouri (coming soon)'
  96 + locked: true
  97 + default: false
  98 +
  99 +
38 # Tao Model OMNI_input 100 # Tao Model OMNI_input
39 #Rosetta tao_ros_sw 2014-01-01T00:00 2017-01-21T00:00 101 #Rosetta tao_ros_sw 2014-01-01T00:00 2017-01-21T00:00
40 #Juno cruise tao_juno_sw 2012-01-01T00:00 2016-11-02T22:00 102 #Juno cruise tao_juno_sw 2012-01-01T00:00 2016-11-02T22:00
@@ -157,7 +157,12 @@ def favicon(): @@ -157,7 +157,12 @@ def favicon():
157 @app.route("/home.html") 157 @app.route("/home.html")
158 @app.route("/index.html") 158 @app.route("/index.html")
159 def home(): 159 def home():
160 - return render_view('home.html.jinja2', {}) 160 + return render_view('home.html.jinja2', {
  161 + 'sources': config['sources'],
  162 + 'planets': [s for s in config['sources'] if s['type'] == 'planet'],
  163 + 'probes': [s for s in config['sources'] if s['type'] == 'probe'],
  164 + 'comets': [s for s in config['sources'] if s['type'] == 'comet'],
  165 + })
161 166
162 167
163 @app.route("/inspect") 168 @app.route("/inspect")
@@ -194,19 +199,23 @@ def get_csv(): @@ -194,19 +199,23 @@ def get_csv():
194 times = cdf_handle.variables['Time'] 199 times = cdf_handle.variables['Time']
195 data_v = cdf_handle.variables['V'] 200 data_v = cdf_handle.variables['V']
196 data_b = cdf_handle.variables['B'] 201 data_b = cdf_handle.variables['B']
  202 + data_t = cdf_handle.variables['T']
  203 + data_n = cdf_handle.variables['N']
197 data_p = cdf_handle.variables['P_dyn'] 204 data_p = cdf_handle.variables['P_dyn']
  205 + data_a = cdf_handle.variables['Delta_angle']
198 cw.writerow(( 206 cw.writerow((
199 'time', 207 'time',
200 'vrad', 'vtan', 'vlen', 208 'vrad', 'vtan', 'vlen',
201 - 'magn', 'pdyn' 209 + 'magn', 'temp', 'pdyn', 'dens', 'angl'
202 )) 210 ))
203 - for time, datum_v, datum_b, datum_p in zip(times, data_v, data_b, data_p): 211 + for time, datum_v, datum_b, datum_t, datum_p, datum_n, datum_a in \
  212 + zip(times, data_v, data_b, data_t, data_n, data_p, data_a):
204 vrad = datum_v[0] 213 vrad = datum_v[0]
205 vtan = datum_v[1] 214 vtan = datum_v[1]
206 cw.writerow(( 215 cw.writerow((
207 datetime_from_list(time).strftime("%Y-%m-%dT%H:%M:%S+00:00"), 216 datetime_from_list(time).strftime("%Y-%m-%dT%H:%M:%S+00:00"),
208 vrad, vtan, sqrt(vrad * vrad + vtan * vtan), 217 vrad, vtan, sqrt(vrad * vrad + vtan * vtan),
209 - datum_b, datum_p 218 + datum_b, datum_t, datum_n, datum_p, datum_a
210 )) 219 ))
211 cdf_handle.close() 220 cdf_handle.close()
212 221
@@ -232,6 +241,7 @@ def get_orbiter_csv(orbiter): @@ -232,6 +241,7 @@ def get_orbiter_csv(orbiter):
232 abort(400, "Invalid stopped_at parameter : '%s'." % stopped_at) 241 abort(400, "Invalid stopped_at parameter : '%s'." % stopped_at)
233 242
234 # Grab the list of netCDF files from Myriam's API todo 243 # Grab the list of netCDF files from Myriam's API todo
  244 + #
235 245
236 si = StringIO.StringIO() 246 si = StringIO.StringIO()
237 cw = csv_writer(si) 247 cw = csv_writer(si)
web/view/home.html.jinja2
@@ -11,10 +11,33 @@ @@ -11,10 +11,33 @@
11 <span class="mdl-layout-title">Planets</span> 11 <span class="mdl-layout-title">Planets</span>
12 12
13 <section id="orbiters_filters"> 13 <section id="orbiters_filters">
14 - <img title="Jupiter" src="{{ static('img/planet/jupiter_128.png') }}" width="64px" height="64px" alt="Jupiter">  
15 - <img title="Earth (coming soon)" src="{{ static('img/planet/earth_128.png') }}" width="64px" height="64px" alt="Earth (locked)" class="locked">  
16 - <img title="Mars (coming soon)" src="{{ static('img/planet/mars_128.png') }}" width="64px" height="64px" alt="Mars (locked)" class="locked"> 14 +{% for planet in planets %}
  15 + <img title="{{ planet.title }}" src="{{ static('img/planet/'~planet.slug~'_128.png') }}" width="64px" height="64px" alt="{{ planet.name }}" class="{{ 'locked' if planet.locked }}">
  16 +{% endfor %}
17 </section> 17 </section>
  18 +
  19 + <br>
  20 + <hr class="clear">
  21 +
  22 + <span class="mdl-layout-title">Probes</span>
  23 +
  24 + <section id="orbiters_filters">
  25 +{% for probe in probes %}
  26 + <img title="{{ probe.title }}" src="{{ static('img/probe/'~probe.slug~'_128.png') }}" width="64px" height="64px" alt="{{ probe.name }}" class="{{ 'locked' if probe.locked }}">
  27 +{% endfor %}
  28 + </section>
  29 +
  30 + <br>
  31 + <hr class="clear">
  32 +
  33 + <span class="mdl-layout-title">Comets</span>
  34 +
  35 + <section id="orbiters_filters">
  36 +{% for comet in comets %}
  37 + <img title="{{ comet.title }}" src="{{ static('img/comet/'~comet.slug~'_128.png') }}" width="64px" height="64px" alt="{{ comet.name }}" class="{{ 'locked' if comet.locked }}">
  38 +{% endfor %}
  39 + </section>
  40 +
18 <br> 41 <br>
19 <hr class="clear"> 42 <hr class="clear">
20 43
@@ -22,16 +45,13 @@ @@ -22,16 +45,13 @@
22 45
23 <nav id="parameters" class="mdl-navigation"> 46 <nav id="parameters" class="mdl-navigation">
24 <a class="mdl-navigation__link parameter active" data-ts-slug="pdyn" href="">Dynamic Pressure</a> 47 <a class="mdl-navigation__link parameter active" data-ts-slug="pdyn" href="">Dynamic Pressure</a>
25 - <a class="mdl-navigation__link parameter active" data-ts-slug="magn" href="">Magnetism</a> 48 + <a class="mdl-navigation__link parameter active" data-ts-slug="magn" href="">B Tangential</a>
26 <a class="mdl-navigation__link parameter active" data-ts-slug="vlen" href="">Velocity</a> 49 <a class="mdl-navigation__link parameter active" data-ts-slug="vlen" href="">Velocity</a>
  50 + <a class="mdl-navigation__link parameter active" data-ts-slug="temp" href="">Temperature</a>
  51 + <a class="mdl-navigation__link parameter active" data-ts-slug="dens" href="">Density</a>
  52 + <a class="mdl-navigation__link parameter active" data-ts-slug="angl" href="">Angle Source-Sun-Earth</a>
27 </nav> 53 </nav>
28 54
29 - <span class="mdl-layout-title">Options</span>  
30 -  
31 - <nav class="mdl-navigation">  
32 - <a class="mdl-navigation__link" href="">How is this done?</a>  
33 - <a class="mdl-navigation__link" href="">More...</a>  
34 - </nav>  
35 </div> 55 </div>
36 <main class="mdl-layout__content"> 56 <main class="mdl-layout__content">
37 57
@@ -99,6 +119,9 @@ @@ -99,6 +119,9 @@
99 stroke-width: 1px; 119 stroke-width: 1px;
100 stroke-dasharray: 5px; 120 stroke-dasharray: 5px;
101 } 121 }
  122 + #orbiters_filters {
  123 + padding-left: 17px;
  124 + }
102 #orbiters_filters img { 125 #orbiters_filters img {
103 float: left; 126 float: left;
104 } 127 }
@@ -155,11 +178,14 @@ jQuery().ready(function($){ @@ -155,11 +178,14 @@ jQuery().ready(function($){
155 178
156 d3.csv('{{ url_for('get_csv') }}', function(csv){ 179 d3.csv('{{ url_for('get_csv') }}', function(csv){
157 var timeFormat = d3.timeParse('%Y-%m-%dT%H:%M:%S%Z'); 180 var timeFormat = d3.timeParse('%Y-%m-%dT%H:%M:%S%Z');
158 - var data = {'pdyn': [], 'magn': [], 'vlen': []}; 181 + var data = {'pdyn': [], 'magn': [], 'vlen': [], 'temp': [], 'dens': [], 'angl': []};
159 csv.forEach(function (d) { 182 csv.forEach(function (d) {
160 data['pdyn'].push({x: timeFormat(d['time']), y: parseFloat(d['pdyn'])}); 183 data['pdyn'].push({x: timeFormat(d['time']), y: parseFloat(d['pdyn'])});
161 data['magn'].push({x: timeFormat(d['time']), y: parseFloat(d['magn'])}); 184 data['magn'].push({x: timeFormat(d['time']), y: parseFloat(d['magn'])});
162 data['vlen'].push({x: timeFormat(d['time']), y: parseFloat(d['vlen'])}); 185 data['vlen'].push({x: timeFormat(d['time']), y: parseFloat(d['vlen'])});
  186 + data['temp'].push({x: timeFormat(d['time']), y: parseFloat(d['temp'])});
  187 + data['dens'].push({x: timeFormat(d['time']), y: parseFloat(d['dens'])});
  188 + data['angl'].push({x: timeFormat(d['time']), y: parseFloat(d['angl'])});
163 }); 189 });
164 190
165 var container = '#time_series'; 191 var container = '#time_series';
@@ -172,7 +198,15 @@ jQuery().ready(function($){ @@ -172,7 +198,15 @@ jQuery().ready(function($){
172 timeSeries.push(new TimeSeries( 198 timeSeries.push(new TimeSeries(
173 'vlen', 'Velocity (km/s)', data['vlen'], container 199 'vlen', 'Velocity (km/s)', data['vlen'], container
174 )); 200 ));
175 - 201 + timeSeries.push(new TimeSeries(
  202 + 'temp', 'Temperature (K)', data['temp'], container
  203 + ));
  204 + timeSeries.push(new TimeSeries(
  205 + 'dens', 'Density N (cm⁻³)', data['dens'], container
  206 + ));
  207 + timeSeries.push(new TimeSeries(
  208 + 'angl', 'Angle T-S-E (deg)', data['angl'], container
  209 + ));
176 // move outside after promises 210 // move outside after promises
177 timeSeries.forEach(function(ts){ 211 timeSeries.forEach(function(ts){
178 ts.options['onMouseOver'] = function() { 212 ts.options['onMouseOver'] = function() {
web/view/layout.html.jinja2
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 32
33 <header class="mdl-layout__header"> 33 <header class="mdl-layout__header">
34 <div class="mdl-layout__header-row"> 34 <div class="mdl-layout__header-row">
35 - <span class="mdl-layout-title">CDPP / Space Weather Online</span> 35 + <span class="mdl-layout-title">CDPP / Solar Wind Prediction @ Planets</span>
36 <!-- Add spacer, to align navigation to the right --> 36 <!-- Add spacer, to align navigation to the right -->
37 <div class="mdl-layout-spacer"></div> 37 <div class="mdl-layout-spacer"></div>
38 <!-- Navigation. We hide it in small screens. --> 38 <!-- Navigation. We hide it in small screens. -->
@@ -67,14 +67,27 @@ @@ -67,14 +67,27 @@
67 67
68 <footer class="mdl-mini-footer"> 68 <footer class="mdl-mini-footer">
69 <div class="mdl-mini-footer__left-section"> 69 <div class="mdl-mini-footer__left-section">
70 - <div class="mdl-logo">v{{ version }}</div> 70 +{# <div class="mdl-logo">v{{ version }}</div>#}
  71 +
  72 + <p class="disclaimer">
  73 + The <a href="http://www.europlanet-2020-ri.eu/">Europlanet 2020 Research Infrastructure</a> project has received funding
  74 + <br>
  75 + from the <a href="https://ec.europa.eu/programmes/horizon2020/">European Union's Horizon 2020</a> research and innovation programme
  76 + under grant agreement N°&nbsp;654208.
  77 + </p>
  78 +
71 {# <img class="logo" src="{{ static('img/logo/logo_cnrs.png') }}" alt="CNRS" id="logo-cnrs" />#} 79 {# <img class="logo" src="{{ static('img/logo/logo_cnrs.png') }}" alt="CNRS" id="logo-cnrs" />#}
72 - <ul class="mdl-mini-footer__link-list">  
73 - <li><a href="#">Help</a></li>  
74 - <li><a href="#">Sources</a></li>  
75 - <li><a href="#">Authors</a></li>  
76 - <li><a href="#">Privacy & Terms</a></li>  
77 - </ul> 80 +{# <ul class="mdl-mini-footer__link-list">#}
  81 +{# <li><a href="#">Help?</a></li>#}
  82 +{# <li><a href="#">Sources</a></li>#}
  83 +{# <li><a href="#">Authors</a></li>#}
  84 +{# <li><a href="#">License</a></li>#}
  85 +{# </ul>#}
  86 + </div>
  87 + <div class="mdl-mini-footer__right-section">
  88 + <img class="logo" src="{{ static('img/logo/logo_cdpp.png') }}" alt="CDPP" id="logo_cdpp" />
  89 + &nbsp;&nbsp;&nbsp;
  90 + <img class="logo" src="{{ static('img/logo/logo_europlanet.png') }}" alt="Europlanet" id="logo_europlanet" />
78 </div> 91 </div>
79 </footer> 92 </footer>
80 93