Commit 9f57dcebb14de43efbbff905ecfd856edcb207e5

Authored by Goutte
1 parent 36961d6f

Add half the bridge to the auroral emissions' images from Paris' VOTABLE.

Showing 3 changed files with 485 additions and 0 deletions   Show diff stats
requirements.txt
@@ -11,6 +11,7 @@ Jinja2==2.9.5 @@ -11,6 +11,7 @@ Jinja2==2.9.5
11 Markdown==2.6.8 11 Markdown==2.6.8
12 MarkupSafe==1.0 12 MarkupSafe==1.0
13 python-slugify==1.2.4 13 python-slugify==1.2.4
  14 +requests==2.19.1
14 15
15 16
16 ## SECOND LEVEL DEPS 17 ## SECOND LEVEL DEPS
spec/example_votable.xml 0 → 100644
@@ -0,0 +1,396 @@ @@ -0,0 +1,396 @@
  1 +<?xml version='1.0' encoding='utf-8'?>
  2 +<VOTABLE version="1.3" xmlns="http://www.ivoa.net/xml/VOTable/v1.3"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://www.ivoa.net/xml/VOTable/v1.3 http://vo.ari.uni-heidelberg.de/docs/schemata/VOTable-1.3.xsd">
  5 + <DESCRIPTION>Planetary aurorae are powerful emissions radiated from auroral
  6 + regions of magnetized planets by accelerated charged particles, in a
  7 + wide range of wavelengths (from radio to X-rays). The UV range in
  8 + particular is adequate to measure collisionaly excited transitions of
  9 + H and H2, the dominant species in the upper atmosphere of giant
  10 + planets, produced by precipitating auroral particles, and benefits a
  11 + good angular resolution. Auroral UV observations therefore provide a
  12 + rich source of informations on planetary atmospheres and
  13 + magnetospheres. They also offer a unique diagnostic to remotely probe
  14 + the solar wind activity throughout the heliosphere. from Laurent Lamy
  15 + </DESCRIPTION>
  16 + <INFO name="legal" value="this research have been made using APIS database by LaurentLamy
  17 +Lesia-Observatoire de Paris"></INFO>
  18 + <RESOURCE type="results" utype="ivo://vopdc.obspm/std/EpnCore/schema-2.0">
  19 + <INFO name="SERVICE_PROTOCOL" value="2.0">EPN-TAP</INFO>
  20 + <INFO name="server"
  21 + value="http://voparis-tap-planeto.obspm.fr:80"></INFO>
  22 + <INFO name="query"
  23 + value="SELECT apis.epn_core.granule_uid, apis.epn_core.granule_gid, apis.epn_core.obs_id, apis.epn_core.dataproduct_type, apis.epn_core.target_name, apis.epn_core.target_class, apis.epn_core.time_min, apis.epn_core.time_max, apis.epn_core.time_sampling_step_min, apis.epn_core.time_sampling_step_max, apis.epn_core.time_exp_min, apis.epn_core.time_exp_max, apis.epn_core.spectral_range_min, apis.epn_core.spectral_range_max, apis.epn_core.spectral_sampling_step_min, apis.epn_core.spectral_sampling_step_max, apis.epn_core.spectral_resolution_min, apis.epn_core.spectral_resolution_max, apis.epn_core.c1min, apis.epn_core.c1max, apis.epn_core.c2min, apis.epn_core.c2max, apis.epn_core.c3min, apis.epn_core.c3max, apis.epn_core.c1_resol_min, apis.epn_core.c1_resol_max, apis.epn_core.c2_resol_min, apis.epn_core.c2_resol_max, apis.epn_core.c3_resol_min, apis.epn_core.c3_resol_max, apis.epn_core.spatial_frame_type, apis.epn_core.incidence_min, apis.epn_core.incidence_max, apis.epn_core.emergence_min, apis.epn_core.emergence_max, apis.epn_core.phase_min, apis.epn_core.phase_max, apis.epn_core.instrument_host_name, apis.epn_core.instrument_name, apis.epn_core.measurement_type, apis.epn_core.access_url, apis.epn_core.access_format, apis.epn_core.access_estsize, apis.epn_core.processing_level, apis.epn_core.publisher, apis.epn_core.bib_reference, apis.epn_core.service_title, apis.epn_core.target_region, apis.epn_core.feature_name, apis.epn_core.ra, apis.epn_core.dec, apis.epn_core.release_date, apis.epn_core.creation_date, apis.epn_core.modification_date, apis.epn_core.s_region, apis.epn_core.thumbnail_url, apis.epn_core.external_link, apis.epn_core.obs_mode, apis.epn_core.detector_name, apis.epn_core.opt_elem, apis.epn_core.filter, apis.epn_core.orientation, apis.epn_core.measurement_unit, apis.epn_core.proposal_id, apis.epn_core.proposal_pi, apis.epn_core.proposal_title, apis.epn_core.platesc, apis.epn_core.campaign, apis.epn_core.target_apparent_radius, apis.epn_core.north_pole_position, apis.epn_core.target_primary_hemisphere, apis.epn_core.target_secondary_hemisphere FROM apis.epn_core WHERE target_name = 'saturn' AND dataproduct_type = 'im' AND time_min &gt; 2440587.50001 AND time_min &lt; 2458288.2836 ORDER BY time_min LIMIT 20000"></INFO>
  24 + <INFO name="src_res" value="Contains traces from resource apis/q">
  25 + Planetary aurorae are powerful emissions radiated from auroral
  26 + regions of magnetized planets by accelerated charged particles, in
  27 + a
  28 + wide range of wavelengths (from radio to X-rays). The UV range in
  29 + particular is adequate to measure collisionaly excited transitions
  30 + of
  31 + H and H2, the dominant species in the upper atmosphere of giant
  32 + planets, produced by precipitating auroral particles, and benefits
  33 + a
  34 + good angular resolution. Auroral UV observations therefore provide
  35 + a
  36 + rich source of informations on planetary atmospheres and
  37 + magnetospheres. They also offer a unique diagnostic to remotely
  38 + probe
  39 + the solar wind activity throughout the heliosphere. from Laurent
  40 + Lamy
  41 + </INFO>
  42 + <INFO name="copyright" value="apis/q copyright or license">this
  43 + research have been made using APIS database by LaurentLamy
  44 + Lesia-Observatoire de Paris
  45 + </INFO>
  46 + <INFO name="src_table"
  47 + value="Contains traces from table apis.epn_core">plasma in
  48 + planetary atmosphere.
  49 + </INFO>
  50 + <INFO name="QUERY_STATUS" value="OK">Query successful</INFO>
  51 + <INFO name="citation" ucd="meta.bib"
  52 + value="http://voparis-tap-planeto.obspm.fr:80/tableinfo/apis.epn_core">
  53 + For advice on how to cite the resource(s) that contributed to this
  54 + result, see
  55 + http://voparis-tap-planeto.obspm.fr:80/tableinfo/apis.epn_core
  56 + </INFO>
  57 + <TABLE name="epn_core">
  58 + <DESCRIPTION>plasma in planetary atmosphere.</DESCRIPTION>
  59 + <FIELD ID="granule_uid" arraysize="*" datatype="char"
  60 + name="granule_uid" ucd="meta.id">
  61 + <DESCRIPTION>Granule unique identifier, provides direct
  62 + access
  63 + </DESCRIPTION>
  64 + </FIELD>
  65 + <FIELD ID="granule_gid" arraysize="*" datatype="char"
  66 + name="granule_gid" ucd="meta.id">
  67 + <DESCRIPTION>Group identifier, identical for similar data
  68 + products
  69 + </DESCRIPTION>
  70 + </FIELD>
  71 + <FIELD ID="obs_id" arraysize="*" datatype="char" name="obs_id"
  72 + ucd="meta.id">
  73 + <DESCRIPTION>Identical for data products related to the same
  74 + original data
  75 + </DESCRIPTION>
  76 + </FIELD>
  77 + <FIELD ID="dataproduct_type" arraysize="*" datatype="char"
  78 + name="dataproduct_type" ucd="meta.code.class">
  79 + <DESCRIPTION>Organization of the data product (from enumerated
  80 + list)
  81 + </DESCRIPTION>
  82 + </FIELD>
  83 + <FIELD ID="target_name" arraysize="*" datatype="char"
  84 + name="target_name" ucd="meta.id;src">
  85 + <DESCRIPTION>Name of target (IAU standard)</DESCRIPTION>
  86 + </FIELD>
  87 + <FIELD ID="target_class" arraysize="*" datatype="char"
  88 + name="target_class" ucd="meta.code.class;src">
  89 + <DESCRIPTION>type of target from enumerated list</DESCRIPTION>
  90 + </FIELD>
  91 + <FIELD ID="time_min" datatype="double" name="time_min"
  92 + ucd="time.start" unit="d">
  93 + <DESCRIPTION>Acquisition start time (in JD)</DESCRIPTION>
  94 + </FIELD>
  95 + <FIELD ID="time_max" datatype="double" name="time_max"
  96 + ucd="time.end" unit="d">
  97 + <DESCRIPTION>Acquisition stop time (in JD)</DESCRIPTION>
  98 + </FIELD>
  99 + <FIELD ID="time_sampling_step_min" datatype="double"
  100 + name="time_sampling_step_min" ucd="time.interval;stat.min"
  101 + unit="s">
  102 + <DESCRIPTION>Min time sampling step</DESCRIPTION>
  103 + </FIELD>
  104 + <FIELD ID="time_sampling_step_max" datatype="double"
  105 + name="time_sampling_step_max" ucd="time.interval;stat.max"
  106 + unit="s">
  107 + <DESCRIPTION>Max time sampling step</DESCRIPTION>
  108 + </FIELD>
  109 + <FIELD ID="time_exp_min" datatype="double" name="time_exp_min"
  110 + ucd="time.duration;obs.exposure;stat.min" unit="s">
  111 + <DESCRIPTION>Min integration time</DESCRIPTION>
  112 + </FIELD>
  113 + <FIELD ID="time_exp_max" datatype="double" name="time_exp_max"
  114 + ucd="time.duration;obs.exposure;stat.max" unit="s">
  115 + <DESCRIPTION>Max integration time</DESCRIPTION>
  116 + </FIELD>
  117 + <FIELD ID="spectral_range_min" datatype="double"
  118 + name="spectral_range_min" ucd="em.freq;stat.min" unit="Hz">
  119 + <DESCRIPTION>Min spectral range (frequency)</DESCRIPTION>
  120 + </FIELD>
  121 + <FIELD ID="spectral_range_max" datatype="double"
  122 + name="spectral_range_max" ucd="em.freq;stat.max" unit="Hz">
  123 + <DESCRIPTION>Max spectral range (frequency)</DESCRIPTION>
  124 + </FIELD>
  125 + <FIELD ID="spectral_sampling_step_min" datatype="double"
  126 + name="spectral_sampling_step_min"
  127 + ucd="em.freq.step;stat.min" unit="Hz">
  128 + <DESCRIPTION>min spectral sampling step (as frequency)
  129 + </DESCRIPTION>
  130 + </FIELD>
  131 + <FIELD ID="spectral_sampling_step_max" datatype="double"
  132 + name="spectral_sampling_step_max"
  133 + ucd="em.freq.step;stat.max" unit="Hz">
  134 + <DESCRIPTION>max pectral sampling step (as frequency)
  135 + </DESCRIPTION>
  136 + </FIELD>
  137 + <FIELD ID="spectral_resolution_min" datatype="double"
  138 + name="spectral_resolution_min"
  139 + ucd="spect.resolution;stat.min" unit="Hz">
  140 + <DESCRIPTION>Min spectral resolution (as frequency)
  141 + </DESCRIPTION>
  142 + </FIELD>
  143 + <FIELD ID="spectral_resolution_max" datatype="double"
  144 + name="spectral_resolution_max"
  145 + ucd="spect.resolution;stat.max" unit="Hz">
  146 + <DESCRIPTION>Max spectral resolution (as frequency)
  147 + </DESCRIPTION>
  148 + </FIELD>
  149 + <FIELD ID="c1min" datatype="double" name="c1min" ucd="pos;stat.min"
  150 + unit="deg">
  151 + <DESCRIPTION>Min (westernmost) longitude on planetary surface
  152 + </DESCRIPTION>
  153 + </FIELD>
  154 + <FIELD ID="c1max" datatype="double" name="c1max" ucd="pos;stat.max"
  155 + unit="deg">
  156 + <DESCRIPTION>Max (easternmost) longitude on planetary surface
  157 + </DESCRIPTION>
  158 + </FIELD>
  159 + <FIELD ID="c2min" datatype="double" name="c2min" ucd="pos;stat.min"
  160 + unit="deg">
  161 + <DESCRIPTION>Min latitude on planetary surface</DESCRIPTION>
  162 + </FIELD>
  163 + <FIELD ID="c2max" datatype="double" name="c2max" ucd="pos;stat.max"
  164 + unit="deg">
  165 + <DESCRIPTION>Max latitude on planetary surface</DESCRIPTION>
  166 + </FIELD>
  167 + <FIELD ID="c3min" datatype="double" name="c3min" ucd="pos;stat.min"
  168 + unit="km">
  169 + <DESCRIPTION>Min of third coordinate (altitude)</DESCRIPTION>
  170 + </FIELD>
  171 + <FIELD ID="c3max" datatype="double" name="c3max" ucd="pos;stat.max"
  172 + unit="km">
  173 + <DESCRIPTION>Max of third coordinate (altitude)</DESCRIPTION>
  174 + </FIELD>
  175 + <FIELD ID="c1_resol_min" datatype="double" name="c1_resol_min"
  176 + ucd="pos.resolution;stat.min" unit="deg">
  177 + <DESCRIPTION>Min resolution on longitude</DESCRIPTION>
  178 + </FIELD>
  179 + <FIELD ID="c1_resol_max" datatype="double" name="c1_resol_max"
  180 + ucd="pos.resolution;stat.max" unit="deg">
  181 + <DESCRIPTION>Max resolution on longitude</DESCRIPTION>
  182 + </FIELD>
  183 + <FIELD ID="c2_resol_min" datatype="double" name="c2_resol_min"
  184 + ucd="pos.resolution;stat.min" unit="deg">
  185 + <DESCRIPTION>Min resolution on latitude</DESCRIPTION>
  186 + </FIELD>
  187 + <FIELD ID="c2_resol_max" datatype="double" name="c2_resol_max"
  188 + ucd="pos.resolution;stat.max" unit="deg">
  189 + <DESCRIPTION>Max resolution on latitude</DESCRIPTION>
  190 + </FIELD>
  191 + <FIELD ID="c3_resol_min" datatype="double" name="c3_resol_min"
  192 + ucd="pos.resolution;stat.min">
  193 + <DESCRIPTION>Min resolution in third coordinate</DESCRIPTION>
  194 + </FIELD>
  195 + <FIELD ID="c3_resol_max" datatype="double" name="c3_resol_max"
  196 + ucd="pos.resolution;stat.max">
  197 + <DESCRIPTION>Max resolution in third coordinate</DESCRIPTION>
  198 + </FIELD>
  199 + <FIELD ID="spatial_frame_type" arraysize="*" datatype="char"
  200 + name="spatial_frame_type" ucd="meta.code.class;pos.frame">
  201 + <DESCRIPTION>Defines the nature of coordinates (from enumerated
  202 + list)
  203 + </DESCRIPTION>
  204 + </FIELD>
  205 + <FIELD ID="incidence_min" datatype="double" name="incidence_min"
  206 + ucd="pos.posAng;stat.min" unit="deg">
  207 + <DESCRIPTION>Min incidence angle (solar zenith angle)
  208 + </DESCRIPTION>
  209 + </FIELD>
  210 + <FIELD ID="incidence_max" datatype="double" name="incidence_max"
  211 + ucd="pos.posAng;stat.max" unit="deg">
  212 + <DESCRIPTION>Max incidence angle (solar zenith angle)
  213 + </DESCRIPTION>
  214 + </FIELD>
  215 + <FIELD ID="emergence_min" datatype="double" name="emergence_min"
  216 + ucd="pos.posAng;stat.min" unit="deg">
  217 + <DESCRIPTION>Min emergence angle</DESCRIPTION>
  218 + </FIELD>
  219 + <FIELD ID="emergence_max" datatype="double" name="emergence_max"
  220 + ucd="pos.posAng;stat.max" unit="deg">
  221 + <DESCRIPTION>Max emergence angle</DESCRIPTION>
  222 + </FIELD>
  223 + <FIELD ID="phase_min" datatype="double" name="phase_min"
  224 + ucd="pos.phaseAng;stat.min" unit="deg">
  225 + <DESCRIPTION>Min phase angle</DESCRIPTION>
  226 + </FIELD>
  227 + <FIELD ID="phase_max" datatype="double" name="phase_max"
  228 + ucd="pos.phaseAng;stat.max" unit="deg">
  229 + <DESCRIPTION>Max phase angle</DESCRIPTION>
  230 + </FIELD>
  231 + <FIELD ID="instrument_host_name" arraysize="*" datatype="char"
  232 + name="instrument_host_name" ucd="meta.id;instr.obsty">
  233 + <DESCRIPTION>Standard name of the observatory or spacecraft
  234 + </DESCRIPTION>
  235 + </FIELD>
  236 + <FIELD ID="instrument_name" arraysize="*" datatype="char"
  237 + name="instrument_name" ucd="meta.id;instr">
  238 + <DESCRIPTION>Standard name of instrument</DESCRIPTION>
  239 + </FIELD>
  240 + <FIELD ID="measurement_type" arraysize="*" datatype="char"
  241 + name="measurement_type" ucd="meta.ucd">
  242 + <DESCRIPTION>UCD(s) defining the nature of measurements
  243 + </DESCRIPTION>
  244 + </FIELD>
  245 + <FIELD ID="access_url" arraysize="*" datatype="char"
  246 + name="access_url" ucd="meta.ref.url">
  247 + <DESCRIPTION>URL of the data files.</DESCRIPTION>
  248 + </FIELD>
  249 + <FIELD ID="access_format" arraysize="*" datatype="char"
  250 + name="access_format" ucd="meta.code.mime">
  251 + <DESCRIPTION>file format type.</DESCRIPTION>
  252 + </FIELD>
  253 + <FIELD ID="access_estsize" datatype="int" name="access_estsize"
  254 + ucd="phys.size;meta.file" unit="kbyte">
  255 + <DESCRIPTION>Estimate file size in kB.</DESCRIPTION>
  256 + <VALUES null="-2147483648"></VALUES>
  257 + </FIELD>
  258 + <FIELD ID="processing_level" datatype="int" name="processing_level"
  259 + ucd="meta.code;obs.calib">
  260 + <DESCRIPTION>Level of calibration (CODMAC level)</DESCRIPTION>
  261 + <VALUES null="-2147483648"></VALUES>
  262 + </FIELD>
  263 + <FIELD ID="publisher" arraysize="*" datatype="char"
  264 + name="publisher" ucd="meta.name">
  265 + <DESCRIPTION>publiher of the ressource</DESCRIPTION>
  266 + </FIELD>
  267 + <FIELD ID="bib_reference" arraysize="*" datatype="char"
  268 + name="bib_reference" ucd="meta.bib">
  269 + <DESCRIPTION>Extra: bibliograpic reference</DESCRIPTION>
  270 + </FIELD>
  271 + <FIELD ID="service_title" arraysize="*" datatype="char"
  272 + name="service_title" ucd="meta.title">
  273 + <DESCRIPTION>Title of the ressourcee</DESCRIPTION>
  274 + </FIELD>
  275 + <FIELD ID="target_region" arraysize="*" datatype="char"
  276 + name="target_region" ucd="meta.id;obs.field">
  277 + <DESCRIPTION>region of interest from a predifine list
  278 + </DESCRIPTION>
  279 + </FIELD>
  280 + <FIELD ID="feature_name" arraysize="*" datatype="char"
  281 + name="feature_name" ucd="meta.id;obs.field">
  282 + <DESCRIPTION>Secondary name (can be standard name of region of
  283 + interest)
  284 + </DESCRIPTION>
  285 + </FIELD>
  286 + <FIELD ID="ra" datatype="double" name="ra"
  287 + ucd="pos.eq.ra;meta.main" unit="deg">
  288 + <DESCRIPTION>Right ascention</DESCRIPTION>
  289 + </FIELD>
  290 + <FIELD ID="dec" datatype="double" name="dec"
  291 + ucd="pos.eq.dec;meta.main" unit="deg">
  292 + <DESCRIPTION>Declination</DESCRIPTION>
  293 + </FIELD>
  294 + <FIELD ID="release_date" arraysize="*" datatype="char"
  295 + name="release_date" ucd="time.release" xtype="timestamp">
  296 + <DESCRIPTION>Start of public period</DESCRIPTION>
  297 + <VALUES null=""></VALUES>
  298 + </FIELD>
  299 + <FIELD ID="creation_date" arraysize="*" datatype="char"
  300 + name="creation_date" ucd="time.creation" xtype="timestamp">
  301 + <DESCRIPTION>Creation date of entry</DESCRIPTION>
  302 + <VALUES null=""></VALUES>
  303 + </FIELD>
  304 + <FIELD ID="modification_date" arraysize="*" datatype="char"
  305 + name="modification_date" ucd="time.update"
  306 + xtype="timestamp">
  307 + <DESCRIPTION>Date of last modification of entry</DESCRIPTION>
  308 + <VALUES null=""></VALUES>
  309 + </FIELD>
  310 + <FIELD ID="s_region" arraysize="*" datatype="double"
  311 + name="s_region" ucd="phys.outline;obs.field"
  312 + xtype="polygon">
  313 + <DESCRIPTION>STC-S region</DESCRIPTION>
  314 + </FIELD>
  315 + <FIELD ID="thumbnail_url" arraysize="*" datatype="char"
  316 + name="thumbnail_url" ucd="meta.ref.url;meta.file">
  317 + <DESCRIPTION>URL of a thumbnail image</DESCRIPTION>
  318 + </FIELD>
  319 + <FIELD ID="external_link" arraysize="*" datatype="char"
  320 + name="external_link" ucd="meta.ref.url">
  321 + <DESCRIPTION>Link to a web page providing more details on the
  322 + granule
  323 + </DESCRIPTION>
  324 + </FIELD>
  325 + <FIELD ID="obs_mode" arraysize="*" datatype="char" name="obs_mode"
  326 + ucd="meta.code;instr.setup">
  327 + <DESCRIPTION>Observing mode</DESCRIPTION>
  328 + </FIELD>
  329 + <FIELD ID="detector_name" arraysize="*" datatype="char"
  330 + name="detector_name" ucd="meta.id;instr.det">
  331 + <DESCRIPTION>Detector name</DESCRIPTION>
  332 + </FIELD>
  333 + <FIELD ID="opt_elem" arraysize="*" datatype="char" name="opt_elem"
  334 + ucd="meta.id;instr.param">
  335 + <DESCRIPTION>Optical element name</DESCRIPTION>
  336 + </FIELD>
  337 + <FIELD ID="filter" arraysize="*" datatype="char" name="filter"
  338 + ucd="meta.id;instr.filter">
  339 + <DESCRIPTION>Filter name</DESCRIPTION>
  340 + </FIELD>
  341 + <FIELD ID="orientation" datatype="double" name="orientation"
  342 + ucd="meta.unit">
  343 + <DESCRIPTION>Position angle of image y axis</DESCRIPTION>
  344 + </FIELD>
  345 + <FIELD ID="measurement_unit" arraysize="*" datatype="char"
  346 + name="measurement_unit" ucd="meta.unit">
  347 + <DESCRIPTION>Measurement unit</DESCRIPTION>
  348 + </FIELD>
  349 + <FIELD ID="proposal_id" datatype="int" name="proposal_id"
  350 + ucd="meta.id;meta.code">
  351 + <DESCRIPTION>Proposal identifier</DESCRIPTION>
  352 + <VALUES null="-2147483648"></VALUES>
  353 + </FIELD>
  354 + <FIELD ID="proposal_pi" arraysize="*" datatype="char"
  355 + name="proposal_pi" ucd="meta.bib.author">
  356 + <DESCRIPTION>Proposal principal investigator</DESCRIPTION>
  357 + </FIELD>
  358 + <FIELD ID="proposal_title" arraysize="*" datatype="char"
  359 + name="proposal_title" ucd="meta.title">
  360 + <DESCRIPTION>Proposal title</DESCRIPTION>
  361 + </FIELD>
  362 + <FIELD ID="platesc" datatype="double" name="platesc"
  363 + ucd="pos.angResolution">
  364 + <DESCRIPTION>spatial resolution per pixel or platescale
  365 + </DESCRIPTION>
  366 + </FIELD>
  367 + <FIELD ID="campaign" arraysize="*" datatype="char" name="campaign"
  368 + ucd="meta.id;meta.code">
  369 + <DESCRIPTION>Name of the observational campaign</DESCRIPTION>
  370 + </FIELD>
  371 + <FIELD ID="target_apparent_radius" datatype="double"
  372 + name="target_apparent_radius" ucd="pos.angDistance">
  373 + <DESCRIPTION>Apparent radius of the target</DESCRIPTION>
  374 + </FIELD>
  375 + <FIELD ID="north_pole_position" datatype="double"
  376 + name="north_pole_position" ucd="pos.angDistance">
  377 + <DESCRIPTION>North pole position angle with respect to
  378 + celestial north pole
  379 + </DESCRIPTION>
  380 + </FIELD>
  381 + <FIELD ID="target_primary_hemisphere" arraysize="*" datatype="char"
  382 + name="target_primary_hemisphere" ucd="meta.id;obs.field">
  383 + <DESCRIPTION>Primary observed hemisphere</DESCRIPTION>
  384 + </FIELD>
  385 + <FIELD ID="target_secondary_hemisphere" arraysize="*"
  386 + datatype="char" name="target_secondary_hemisphere"
  387 + ucd="meta.id;obs.field">
  388 + <DESCRIPTION>Secondary observed hemisphere</DESCRIPTION>
  389 + </FIELD>
  390 + <DATA>
  391 + <TABLEDATA></TABLEDATA>
  392 + </DATA>
  393 + </TABLE>
  394 + </RESOURCE>
  395 +</VOTABLE>
  396 +
@@ -9,6 +9,8 @@ import random @@ -9,6 +9,8 @@ import random
9 import tarfile 9 import tarfile
10 import time 10 import time
11 import urllib 11 import urllib
  12 +import requests
  13 +
12 from csv import writer as csv_writer 14 from csv import writer as csv_writer
13 from math import sqrt, isnan 15 from math import sqrt, isnan
14 from os import environ, remove as removefile 16 from os import environ, remove as removefile
@@ -338,6 +340,92 @@ def get_active_targets(): @@ -338,6 +340,92 @@ def get_active_targets():
338 return [t for t in all_targets if not ('locked' in t and t['locked'])] 340 return [t for t in all_targets if not ('locked' in t and t['locked'])]
339 341
340 342
  343 +def retrieve_auroral_emissions(target_name):
  344 + """
  345 + Work In Progress.
  346 + :param target_name: You should probably not let users choose this value,
  347 + as our sanitizing for ADQL may not be 100% safe.
  348 + Use values from YAML configuration, instead.
  349 + Below is a list of the ids we found to be existing.
  350 + > SELECT DISTINCT target_name FROM apis.epn_core
  351 + - Mars
  352 + - MERCURY
  353 + - Jupiter
  354 + - Titan
  355 + - Io
  356 + - VENUS
  357 + - Ganymede
  358 + - Uranus
  359 + - Callisto
  360 + - Europa
  361 + - Saturn
  362 + :return:
  363 + """
  364 + api_url = "http://voparis-tap.obspm.fr/__system__/tap/run/tap/sync"
  365 + d_started_at = datetime.datetime.now()
  366 + t_started_at = time.mktime(d_started_at.timetuple()) - 3600 * 24 * 365 * 10 # fixme
  367 + # t_started_at = 1
  368 + d_stopped_at = datetime.datetime.now()
  369 + t_stopped_at = time.mktime(d_stopped_at.timetuple())
  370 +
  371 + def to_jday(timestamp):
  372 + return timestamp / 86400.0 + 2440587.5
  373 +
  374 + query = """
  375 +SELECT
  376 + time_min,
  377 + time_max,
  378 + thumbnail_url,
  379 + external_link
  380 +FROM apis.epn_core
  381 +WHERE target_name='{target_name}'
  382 +AND dataproduct_type='im'
  383 +AND time_min > {jday_start}
  384 +AND time_min < {jday_stop}
  385 +ORDER BY time_min, granule_gid
  386 +""".format(
  387 + target_name=target_name.replace("'", "\\'"),
  388 + jday_start=to_jday(t_started_at),
  389 + jday_stop=to_jday(t_stopped_at)
  390 + )
  391 +
  392 +# query = """
  393 +# SELECT DISTINCT target_name FROM apis.epn_core
  394 +# """
  395 +
  396 + try:
  397 + response = requests.post(api_url, {
  398 + 'REQUEST': 'doQuery',
  399 + 'LANG': 'ADQL',
  400 + 'QUERY': query,
  401 + 'TIMEOUT': '30',
  402 + 'FORMAT': 'VOTable/td'
  403 + })
  404 +
  405 + response_xml = response.text
  406 +
  407 + import xml.etree.ElementTree as ET
  408 + root = ET.fromstring(response_xml)
  409 + namespaces = {'vo': 'http://www.ivoa.net/xml/VOTable/v1.3'}
  410 + rows_xpath = "./vo:RESOURCE/vo:TABLE/vo:DATA/vo:TABLEDATA/vo:TR"
  411 + rows = []
  412 + for row in root.findall(rows_xpath, namespaces):
  413 + rows.append({
  414 + 'time_min': row[0].text,
  415 + 'time_max': row[1].text,
  416 + 'thumbnail_url': row[2].text,
  417 + 'external_link': row[3].text,
  418 + })
  419 +
  420 + # print(rows)
  421 + return rows
  422 + except Exception as e:
  423 + print("Failed to retrieve auroral emissions :")
  424 + print(e)
  425 +
  426 + # print(query)
  427 +
  428 +
341 def retrieve_amda_netcdf(orbiter, what, started_at, stopped_at): 429 def retrieve_amda_netcdf(orbiter, what, started_at, stopped_at):
342 """ 430 """
343 Handles remote querying AMDA's API for URLs, and then downloading, 431 Handles remote querying AMDA's API for URLs, and then downloading,