Commit 297a7dfcb69e43cf00a86b585bb78fea2032ab6a

Authored by Goutte
1 parent 034132c6

Add support for inputs STEREO-A, STEREO-B, L1 (needs testing)

CHANGELOG.md
1 1 ## Nicolas
2 2  
3 3 - [ ] séries temporelles en échelle log ou linéaire
  4 +- [ ] quant on zoome modifier l'échelle en Y afin qu'elle s'adapte aux valeurs maximales de l'intervalle du zoom
4 5 - [ ] permettre à l'utilisateur de choisir inner heliosphere (jusqu'à mars) ou outer heliosphere (jusqu'à saturne) pour la visualisation des éphémérides planétaires
5 6 - [ ] rajouter uranus et neptune comme planètes cibles
6 7 - [ ] rajouter MAVEN, New Horizons, Cassini, Galileo, ExoMars comme spacecraft cible
7 8 - [ ] prévoir la possibilité à l'utilisateur d'afficher le temps en Day Of Year
8   -- [ ] quant on zoome modifier l'échelle en Y afin qu'elle s'adapte aux valeurs maximales de l'intervalle du zoom
9 9 - [ ] modifier le bandeau vertical d'affichage des choix utilisateurs pour qu'il soit plus petit (en particulier les champs paramètres)
10   -- [ ] ajouter dans le bandeau vertical un onglet INPUT DATA avec 3 choix possibles: STEREO-A, STEREO-B, L1
11 10 - [ ] ajouter dans le bandeau vertical un onglet LAYERS avec 3 choix possibles: Jupiter Thermosphere Model, HST Jupiter Observations, HST Saturn Observations
12 11 - [ ] ajouter un bouton ALERT qui permet d'ouvrir une nouvelle page de formulaire ou l'utilisateur entrerait les données suivantes:
13 12 * email
... ... @@ -32,6 +31,7 @@
32 31  
33 32 - [ ] Rework the images of Rosetta and Juno
34 33 - [ ] Enable p67
  34 +- [x] Add support for inputs STEREO-A, STEREO-B, L1
35 35 - [x] More ticks along X-axis (I tried, but it does not behave as expected)
36 36 - [x] Smaller footer credits
37 37 - [x] Move the version to the footer
... ...
config.yml
... ... @@ -46,6 +46,17 @@ authors:
46 46  
47 47 amda: "http://cdpp.irap.omp.eu/BASE/DDService/getDataUrl.php?dataSet={dataSet}&StartTime={startTime}&StopTime={stopTime}"
48 48  
  49 +inputs:
  50 + - slug: "l1"
  51 + name: "L1"
  52 + desc: "The default input."
  53 + - slug: "sa"
  54 + name: "STEREO-A"
  55 + desc: "The first of the STEREO (Solar Terrestrial Relations Observatory), a solar observation mission."
  56 + - slug: "sb"
  57 + name: "STEREO-B"
  58 + desc: "The second of the STEREO (Solar Terrestrial Relations Observatory), a solar observation mission."
  59 +
49 60 #Targets
50 61 #Earth earth_orb_all
51 62 #Jupiter jupiter_orb_all
... ... @@ -75,12 +86,17 @@ targets:
75 86 name: 'Mercury'
76 87 title: 'Mercury'
77 88 orbit:
78   - models:
79   - - slug: 'mercury_orb_all'
80   - semimajor: 0
81   - semiminor: 0
  89 + models:
  90 + - slug: 'mercury_orb_all'
  91 + semimajor: 0
  92 + semiminor: 0
82 93 models:
83   - - slug: 'tao_mercury_sw'
  94 + l1:
  95 + - slug: 'tao_mercury_sw'
  96 + sa:
  97 + - slug: 'tao_mercury_sw'
  98 + sb:
  99 + - slug: 'tao_mercury_sw'
84 100 locked: false
85 101 default: true
86 102 - type: 'planet'
... ... @@ -88,12 +104,17 @@ targets:
88 104 name: 'Venus'
89 105 title: 'Venus'
90 106 orbit:
91   - models:
92   - - slug: 'venus_orb_all'
93   - semimajor: 0.72333199
94   - semiminor: 0.7233154
  107 + models:
  108 + - slug: 'venus_orb_all'
  109 + semimajor: 0.72333199
  110 + semiminor: 0.7233154
95 111 models:
96   - - slug: 'tao_venus_sw'
  112 + l1:
  113 + - slug: 'tao_venus_sw'
  114 + sa:
  115 + - slug: 'tao_venus_sw'
  116 + sb:
  117 + - slug: 'tao_venus_sw'
97 118 locked: false
98 119 default: true
99 120 - type: 'planet'
... ... @@ -101,42 +122,71 @@ targets:
101 122 name: 'Earth'
102 123 title: 'Earth'
103 124 orbit:
104   - models: [] # Earth has no orbit models, we hard-coded it to (1, 0)
  125 + models: [] # Earth has no orbit models, we hard-coded it to (1, 0)
105 126 models:
106   - - slug: 'omni_hour_all'
107   - - slug: 'ace_swepam_real'
108   - parameters:
109   - dens: 'Dens'
110   - vtot: 'Vel'
111   - temp: 'Temp'
  127 + l1:
  128 + - slug: 'omni_hour_all'
  129 + - slug: 'ace_swepam_real'
  130 + parameters:
  131 + dens: 'Dens'
  132 + vtot: 'Vel'
  133 + temp: 'Temp'
  134 + sa:
  135 + - slug: 'omni_hour_all'
  136 + - slug: 'ace_swepam_real'
  137 + parameters:
  138 + dens: 'Dens'
  139 + vtot: 'Vel'
  140 + temp: 'Temp'
  141 + sb:
  142 + - slug: 'omni_hour_all'
  143 + - slug: 'ace_swepam_real'
  144 + parameters:
  145 + dens: 'Dens'
  146 + vtot: 'Vel'
  147 + temp: 'Temp'
112 148 locked: false
113 149 default: true
114 150 - type: 'planet'
115 151 slug: 'mars'
116 152 name: 'Mars'
117 153 title: 'Mars'
118   - models:
119   - - slug: 'tao_mars_sw'
120   - - slug: 'tao_mars_swrt'
121 154 orbit:
122   - models:
123   - - slug: 'mars_orb_all'
124   - semimajor: 1.52366231
125   - semiminor: 1.51700011
  155 + models:
  156 + - slug: 'mars_orb_all'
  157 + semimajor: 1.52366231
  158 + semiminor: 1.51700011
  159 + models:
  160 + l1:
  161 + - slug: 'tao_mars_sw'
  162 + - slug: 'tao_mars_swrt'
  163 + sa:
  164 + - slug: 'tao_mars_sw'
  165 + - slug: 'tao_mars_swrt'
  166 + sb:
  167 + - slug: 'tao_mars_sw'
  168 + - slug: 'tao_mars_swrt'
126 169 locked: false
127 170 default: true
128 171 - type: 'planet'
129 172 slug: 'jupiter'
130 173 name: 'Jupiter'
131 174 title: 'Jupiter'
132   - models:
133   - - slug: 'tao_jup_sw'
134   - - slug: 'tao_jup_swrt'
135 175 orbit:
136   - models:
137   - - slug: 'jupiter_orb_all'
138   - semimajor: 5.45516759
139   - semiminor: 4.95155843
  176 + models:
  177 + - slug: 'jupiter_orb_all'
  178 + semimajor: 5.45516759
  179 + semiminor: 4.95155843
  180 + models:
  181 + l1:
  182 + - slug: 'tao_jup_sw'
  183 + - slug: 'tao_jup_swrt'
  184 + sa:
  185 + - slug: 'tao_jup_sw'
  186 + - slug: 'tao_jup_swrt'
  187 + sb:
  188 + - slug: 'tao_jup_sw'
  189 + - slug: 'tao_jup_swrt'
140 190 locked: false
141 191 default: true
142 192 - type: 'planet'
... ... @@ -144,12 +194,17 @@ targets:
144 194 name: 'Saturn'
145 195 title: 'Saturn'
146 196 orbit:
147   - models:
148   - - slug: 'saturn_orb_all'
149   - semimajor: 9.53707032
150   - semiminor: 9.5230773
  197 + models:
  198 + - slug: 'saturn_orb_all'
  199 + semimajor: 9.53707032
  200 + semiminor: 9.5230773
151 201 models:
152   - - slug: 'tao_sat_sw'
  202 + l1:
  203 + - slug: 'tao_sat_sw'
  204 + sa:
  205 + - slug: 'tao_sat_sw'
  206 + sb:
  207 + - slug: 'tao_sat_sw'
153 208 locked: false
154 209 default: true
155 210 - type: 'probe'
... ... @@ -157,16 +212,21 @@ targets:
157 212 name: 'Rosetta'
158 213 title: 'Rosetta'
159 214 orbit:
160   - models:
161   - - slug: 'ros_orb_cruise'
162   - stopped_at: '2014-08-02T00:00:00'
163   - - slug: 'p67_orb_all'
164   - started_at: '2014-08-02T00:00:00'
165   - #stopped_at: '2016-09-30T11:19:00'
166   - parameters:
167   - hee: 'XYZ_HEE'
  215 + models:
  216 + - slug: 'ros_orb_cruise'
  217 + stopped_at: '2014-08-02T00:00:00'
  218 + - slug: 'p67_orb_all'
  219 + started_at: '2014-08-02T00:00:00'
  220 + #stopped_at: '2016-09-30T11:19:00'
  221 + parameters:
  222 + hee: 'XYZ_HEE'
168 223 models:
169   - - slug: 'tao_ros_sw'
  224 + l1:
  225 + - slug: 'tao_ros_sw'
  226 + sa:
  227 + - slug: 'tao_ros_sw'
  228 + sb:
  229 + - slug: 'tao_ros_sw'
170 230 locked: false
171 231 default: false
172 232 - type: 'probe'
... ... @@ -174,13 +234,18 @@ targets:
174 234 name: 'Juno'
175 235 title: 'Juno'
176 236 orbit:
177   - models:
178   - - slug: 'juno_cruise_all'
179   - stopped_at: '2016-07-05T03:53:00'
180   - - slug: 'jupiter_orb_all'
181   - started_at: '2016-07-05T03:53:00'
  237 + models:
  238 + - slug: 'juno_cruise_all'
  239 + stopped_at: '2016-07-05T03:53:00'
  240 + - slug: 'jupiter_orb_all'
  241 + started_at: '2016-07-05T03:53:00'
182 242 models:
183   - - slug: 'tao_juno_sw'
  243 + l1:
  244 + - slug: 'tao_juno_sw'
  245 + sa:
  246 + - slug: 'tao_juno_sw'
  247 + sb:
  248 + - slug: 'tao_juno_sw'
184 249 locked: false
185 250 default: false
186 251 - type: 'comet'
... ... @@ -188,12 +253,17 @@ targets:
188 253 name: 'Churyumov-Gerasimenko'
189 254 title: 'Churyumov-Gerasimenko (coming soon)'
190 255 orbit:
191   - models:
192   - - slug: 'p67_orb_all'
193   - parameters:
194   - hee: 'XYZ_HEE'
  256 + models:
  257 + - slug: 'p67_orb_all'
  258 + parameters:
  259 + hee: 'XYZ_HEE'
195 260 models:
196   - - slug: 'tao_p67_sw' # fixme
  261 + l1:
  262 + - slug: 'tao_p67_sw' # fixme
  263 + sa:
  264 + - slug: 'tao_p67_sw' # fixme
  265 + sb:
  266 + - slug: 'tao_p67_sw' # fixme
197 267 locked: true
198 268 default: false
199 269  
... ...
web/run.py
... ... @@ -419,14 +419,17 @@ def retrieve_amda_netcdf(orbiter, what, started_at, stopped_at):
419 419 return list(set(local_netc_files)) # remove possible dupes
420 420  
421 421  
422   -def get_data_for_target(target_config, started_at, stopped_at):
  422 +def get_data_for_target(
  423 + target_config,
  424 + started_at, stopped_at,
  425 + input_slug='l1'):
423 426 """
424 427 :return: dict whose keys are datetime as str, values tuples of data
425 428 """
426 429 log.debug("Grabbing data for '%s'..." % target_config['slug'])
427 430  
428 431 try:
429   - models = target_config['models']
  432 + models = target_config['models'][input_slug]
430 433 except Exception as e:
431 434 abort(500, "Invalid model configuration for '%s' : %s"
432 435 % (target_config['slug'], str(e)))
... ... @@ -459,7 +462,7 @@ def get_data_for_target(target_config, started_at, stopped_at):
459 462 raise Exception("No variable '%s' found in NetCDF." % _keys[_key])
460 463 return [None] * len(_nc.variables['Time']) # slow -- use numpy!
461 464  
462   - # Override them using the configuration, maybe also put these in config ?
  465 + # Override these using the model configuration
463 466 default_nc_keys = {
464 467 'hee': 'HEE',
465 468 'vtot': 'V',
... ... @@ -576,14 +579,17 @@ def get_data_for_target(target_config, started_at, stopped_at):
576 579 return all_data
577 580  
578 581  
579   -def generate_csv_contents(target_slug, started_at, stopped_at):
  582 +def generate_csv_contents(target_slug, input_slug, started_at, stopped_at):
580 583 target_config = get_target_config(target_slug)
581 584 log.debug("Crunching CSV contents for '%s'..." % target_config['name'])
582 585 si = StringIO.StringIO()
583 586 cw = csv_writer(si)
584 587 cw.writerow(PROPERTIES)
585 588  
586   - all_data = get_data_for_target(target_config, started_at, stopped_at)
  589 + all_data = get_data_for_target(
  590 + target_config=target_config, input_slug=input_slug,
  591 + started_at=started_at, stopped_at=stopped_at
  592 + )
587 593  
588 594 log.debug("Writing and sorting CSV for '%s'..." % target_config['slug'])
589 595 for dkey in sorted(all_data):
... ... @@ -593,15 +599,15 @@ def generate_csv_contents(target_slug, started_at, stopped_at):
593 599 return si.getvalue()
594 600  
595 601  
596   -def generate_csv_file_if_needed(target_slug, started_at, stopped_at):
597   - filename = "%s_%s_%s.csv" % (target_slug,
598   - started_at.strftime(FILE_DATE_FMT),
599   - stopped_at.strftime(FILE_DATE_FMT))
  602 +def generate_csv_file_if_needed(target_slug, input_slug, started_at, stopped_at):
  603 + filename = "%s_%s_%s_%s.csv" % (target_slug, input_slug,
  604 + started_at.strftime(FILE_DATE_FMT),
  605 + stopped_at.strftime(FILE_DATE_FMT))
600 606 local_csv_file = join(CACHE_DIR, filename)
601 607  
602 608 generate = True
603 609 if isfile(local_csv_file):
604   - # It need to have more than one line to not be empty (headers)
  610 + # It needs to have more than one line to not be empty (headers)
605 611 with open(local_csv_file) as f:
606 612 cnt = 0
607 613 for _ in f:
... ... @@ -683,6 +689,16 @@ def remove_files_created_before(date, in_directory):
683 689 return removed_files
684 690  
685 691  
  692 +def get_input_slug_from_query(inp=None):
  693 + if inp is None:
  694 + input_slug = request.args.get('input_slug', 'l1')
  695 + else:
  696 + input_slug = inp
  697 + if input_slug not in [i.slug for i in config.inputs]:
  698 + input_slug = 'l1' # be tolerant instead of yelling loudly
  699 + return input_slug
  700 +
  701 +
686 702 def get_hit_counter():
687 703 hit_count_path = get_path("../VISITS")
688 704  
... ... @@ -730,9 +746,11 @@ def home():
730 746 increment_hit_counter()
731 747 parameters = PARAMETERS.values()
732 748 parameters.sort(key=lambda x: x['position'])
  749 + input_slug = get_input_slug_from_query()
733 750 return render_view('home.html.jinja2', {
734 751 'targets': config['targets'],
735 752 'parameters': parameters,
  753 + 'input_slug': input_slug,
736 754 'planets': [s for s in config['targets'] if s['type'] == 'planet'],
737 755 'probes': [s for s in config['targets'] if s['type'] == 'probe'],
738 756 'comets': [s for s in config['targets'] if s['type'] == 'comet'],
... ... @@ -740,12 +758,13 @@ def home():
740 758 })
741 759  
742 760  
743   -@app.route("/<target>_<started_at>_<stopped_at>.csv")
744   -def download_target_csv(target, started_at, stopped_at):
  761 +@app.route("/<target>_<inp>_<started_at>_<stopped_at>.csv")
  762 +def download_target_csv(target, inp, started_at, stopped_at):
745 763 """
746 764 Grab data and orbit data for the specified `target`,
747 765 rearrange it and return it as a CSV file.
748 766 `started_at` and `stopped_at` should be UTC.
  767 + `inp` is the input slug, l1 or sa or sb.
749 768 """
750 769 check_target_config(target)
751 770 try:
... ... @@ -756,20 +775,24 @@ def download_target_csv(target, started_at, stopped_at):
756 775 stopped_at = datetime.datetime.strptime(stopped_at, FILE_DATE_FMT)
757 776 except:
758 777 abort(400, "Invalid stopped_at parameter : '%s'." % stopped_at)
  778 + input_slug = get_input_slug_from_query(inp=inp)
759 779  
760   - filename = "%s_%s_%s.csv" % (target,
761   - started_at.strftime(FILE_DATE_FMT),
762   - stopped_at.strftime(FILE_DATE_FMT))
  780 + filename = "%s_%s_%s_%s.csv" % (target, input_slug,
  781 + started_at.strftime(FILE_DATE_FMT),
  782 + stopped_at.strftime(FILE_DATE_FMT))
763 783 local_csv_file = join(CACHE_DIR, filename)
764   - generate_csv_file_if_needed(target, started_at, stopped_at)
  784 + generate_csv_file_if_needed(
  785 + target_slug=target, input_slug=input_slug,
  786 + started_at=started_at, stopped_at=stopped_at
  787 + )
765 788 if not isfile(local_csv_file):
766 789 abort(500, "Could not cache CSV file at '%s'." % local_csv_file)
767 790  
768 791 return send_from_directory(CACHE_DIR, filename)
769 792  
770 793  
771   -@app.route("/<targets>_<started_at>_<stopped_at>.tar.gz")
772   -def download_targets_tarball(targets, started_at, stopped_at):
  794 +@app.route("/<targets>_<inp>_<started_at>_<stopped_at>.tar.gz")
  795 +def download_targets_tarball(targets, inp, started_at, stopped_at):
773 796 """
774 797 Grab data and orbit data for each of the specified `targets`,
775 798 in their own CSV file, and make a tarball of them.
... ... @@ -801,24 +824,35 @@ def download_targets_tarball(targets, started_at, stopped_at):
801 824 sta = started_at.strftime(FILE_DATE_FMT)
802 825 sto = stopped_at.strftime(FILE_DATE_FMT)
803 826  
804   - gzip_filename = "%s_%s_%s.tar.gz" % (separator.join(targets), sta, sto)
  827 + input_slug = get_input_slug_from_query(inp=inp)
  828 +
  829 + gzip_filename = "%s_%s_%s_%s.tar.gz" % (
  830 + separator.join(targets), input_slug, sta, sto
  831 + )
805 832 local_gzip_file = join(CACHE_DIR, gzip_filename)
806 833  
807 834 if not isfile(local_gzip_file):
808 835 log.debug("Creating the CSV files for the tarball...")
809 836 for target_config in targets_configs:
810   - filename = "%s_%s_%s.csv" % (target_config['slug'], sta, sto)
  837 + filename = "%s_%s_%s_%s.csv" % (
  838 + target_config['slug'], input_slug, sta, sto
  839 + )
811 840 local_csv_file = join(CACHE_DIR, filename)
812 841 if not isfile(local_csv_file):
813 842 with open(local_csv_file, mode="w+") as f:
814   - f.write(generate_csv_contents(target_config['slug'],
815   - started_at=started_at,
816   - stopped_at=stopped_at))
  843 + f.write(generate_csv_contents(
  844 + target_slug=target_config['slug'],
  845 + started_at=started_at,
  846 + stopped_at=stopped_at,
  847 + input_slug=input_slug
  848 + ))
817 849  
818 850 log.debug("Creating the tarball '%s'..." % local_gzip_file)
819 851 with tarfile.open(local_gzip_file, "w:gz") as tar:
820 852 for target_config in targets_configs:
821   - filename = "%s_%s_%s.csv" % (target_config['slug'], sta, sto)
  853 + filename = "%s_%s_%s_%s.csv" % (
  854 + target_config['slug'], input_slug, sta, sto
  855 + )
822 856 local_csv_file = join(CACHE_DIR, filename)
823 857 tar.add(local_csv_file, arcname=filename)
824 858  
... ... @@ -828,8 +862,8 @@ def download_targets_tarball(targets, started_at, stopped_at):
828 862 return send_from_directory(CACHE_DIR, gzip_filename)
829 863  
830 864  
831   -@app.route("/<targets>_<params>_<started_at>_<stopped_at>.nc")
832   -def download_targets_netcdf(targets, params, started_at, stopped_at):
  865 +@app.route("/<targets>_<inp>_<params>_<started_at>_<stopped_at>.nc")
  866 +def download_targets_netcdf(targets, inp, params, started_at, stopped_at):
833 867 """
834 868 Grab data and orbit data for the specified `target`,
835 869 rearrange it and return it as a NetCDF file.
... ... @@ -867,8 +901,11 @@ def download_targets_netcdf(targets, params, started_at, stopped_at):
867 901 sta = started_at.strftime(date_fmt)
868 902 sto = stopped_at.strftime(date_fmt)
869 903  
870   - nc_filename = "%s_%s_%s_%s.nc" % \
871   - (separator.join(targets), separator.join(params), sta, sto)
  904 + input_slug = get_input_slug_from_query(inp=inp)
  905 +
  906 + nc_filename = "%s_%s_%s_%s_%s.nc" % (
  907 + separator.join(targets), separator.join(params), input_slug, sta, sto
  908 + )
872 909 nc_path = join(CACHE_DIR, nc_filename)
873 910  
874 911 if not isfile(nc_path):
... ... @@ -883,7 +920,10 @@ def download_targets_netcdf(targets, params, started_at, stopped_at):
883 920 target_slug = target['slug']
884 921 log.debug("Adding group '%s' to the NetCDF..." % target_slug)
885 922 nc_group = nc_handle.createGroup(target_slug)
886   - data = get_data_for_target(target, started_at, stopped_at)
  923 + data = get_data_for_target(
  924 + target_config=target, input_slug=input_slug,
  925 + started_at=started_at, stopped_at=stopped_at
  926 + )
887 927 dkeys = sorted(data)
888 928 dimension = 'dim_'+target_slug
889 929 nc_handle.createDimension(dimension, len(dkeys))
... ... @@ -946,8 +986,8 @@ def download_targets_netcdf(targets, params, started_at, stopped_at):
946 986 return send_from_directory(CACHE_DIR, nc_filename)
947 987  
948 988  
949   -@app.route("/<targets>_<started_at>_<stopped_at>.cdf")
950   -def download_targets_cdf(targets, started_at, stopped_at):
  989 +@app.route("/<targets>_<inp>_<started_at>_<stopped_at>.cdf")
  990 +def download_targets_cdf(targets, inp, started_at, stopped_at):
951 991 """
952 992 Grab data and orbit data for the specified `target`,
953 993 rearrange it and return it as a CDF file.
... ... @@ -986,7 +1026,11 @@ def download_targets_cdf(targets, started_at, stopped_at):
986 1026 sta = started_at.strftime(FILE_DATE_FMT)
987 1027 sto = stopped_at.strftime(FILE_DATE_FMT)
988 1028  
989   - cdf_filename = "%s_%s_%s.cdf" % (separator.join(targets), sta, sto)
  1029 + input_slug = get_input_slug_from_query(inp=inp)
  1030 +
  1031 + cdf_filename = "%s_%s_%s_%s.cdf" % (
  1032 + separator.join(targets), input_slug, sta, sto
  1033 + )
990 1034 cdf_path = join(CACHE_DIR, cdf_filename)
991 1035  
992 1036 if not isfile(cdf_path):
... ... @@ -1010,7 +1054,10 @@ def download_targets_cdf(targets, started_at, stopped_at):
1010 1054 available_params = list(PROPERTIES)
1011 1055 for target in targets_configs:
1012 1056 target_slug = target['slug']
1013   - data = get_data_for_target(target, started_at, stopped_at)
  1057 + data = get_data_for_target(
  1058 + target_config=target, input_slug=input_slug,
  1059 + started_at=started_at, stopped_at=stopped_at
  1060 + )
1014 1061 dkeys = sorted(data)
1015 1062  
1016 1063 values = []
... ... @@ -1108,13 +1155,14 @@ def cache_warmup():
1108 1155 stopped_at = today + after
1109 1156 sta = started_at.strftime(FILE_DATE_FMT)
1110 1157 sto = stopped_at.strftime(FILE_DATE_FMT)
  1158 + inp = 'l1' # default input, maybe warm them all up ?
1111 1159  
1112 1160 targets = get_active_targets()
1113 1161 for target in targets:
1114   - download_target_csv(target['slug'], sta, sto)
  1162 + download_target_csv(target['slug'], inp, sta, sto)
1115 1163 targets_slugs = [target['slug'] for target in targets]
1116 1164 targets_slugs.sort()
1117   - download_targets_cdf('-'.join(targets_slugs), sta, sto)
  1165 + download_targets_cdf('-'.join(targets_slugs), inp, sta, sto)
1118 1166  
1119 1167 return "Done"
1120 1168  
... ...
web/view/home.html.jinja2
... ... @@ -59,7 +59,9 @@
59 59 <div class="mdl-layout mdl-js-layout mdl-layout--fixed-drawer">
60 60  
61 61 <div class="mdl-layout__drawer">
  62 +
62 63 <span class="mdl-layout-title" title="Two years maximum.">{{ icon('calendar') }} Time Interval</span>
  64 +
63 65 <form id="form_time_interval" action="#">
64 66 <div class="mdl-textfield mdl-js-textfield">
65 67 <input type="date" id="started_at" name="started_at" title="The date of the beginning of the interval to observe." class="mdl-textfield__input">
... ... @@ -96,6 +98,22 @@
96 98 <br>
97 99 <hr class="clear">
98 100  
  101 +{# <span class="mdl-layout-title">{{ icon('database') }} Inputs</span>#}
  102 +{##}
  103 +{# <section class="section-drawer">#}
  104 +{#{% for input in config.inputs %}#}
  105 +{# <label class="mdl-radio mdl-js-radio mdl-js-ripple-effect" for="option-input-{{ input.slug }}" title="{{ input.desc }}">#}
  106 +{# <input type="radio" id="option-input-{{ input.slug }}" class="mdl-radio__button" name="input_slug" value="{{ input.slug }}" {{ 'checked' if input.slug == input_slug }}>#}
  107 +{# <span class="mdl-radio__label">{{ input.name }}</span>#}
  108 +{# </label>#}
  109 +{# <br />#}
  110 +{#{% endfor %}#}
  111 +{# <br />#}
  112 +{# <input type="button" id="apply_new_input" value="Reload for input" title="This may take a while." class="mdl-button mdl-js-button mdl-js-ripple-effect">#}
  113 +{# </section>#}
  114 +{##}
  115 +{# <hr class="clear">#}
  116 +
99 117 <span class="mdl-layout-title">{{ icon('flask') }} Parameters</span>
100 118  
101 119 <nav id="parameters" class="mdl-navigation">
... ... @@ -315,6 +333,9 @@
315 333 #started_at, #stopped_at {
316 334 width: 85%;
317 335 }
  336 + .section-drawer {
  337 + padding-left: 3em;
  338 + }
318 339 .targets-filters {
319 340 padding-left: 17px;
320 341 }
... ... @@ -537,9 +558,9 @@ var configuration = {
537 558 time_series_container: '#time_series',
538 559 orbits_container: '#orbits',
539 560 api: {
540   - 'data_for_interval': "{{ request.url_root }}<target>_<started_at>_<stopped_at>.csv",
541   - 'download': "{{ request.url_root }}<targets>_<started_at>_<stopped_at>.cdf",
542   - 'samp': "{{ request.url_root }}<targets>_<started_at>_<stopped_at>.cdf"
  561 + 'data_for_interval': "{{ request.url_root }}<target>_{{ input_slug }}_<started_at>_<stopped_at>.csv",
  562 + 'download': "{{ request.url_root }}<targets>_{{ input_slug }}_<started_at>_<stopped_at>.cdf",
  563 + 'samp': "{{ request.url_root }}<targets>_{{ input_slug }}_<started_at>_<stopped_at>.cdf"
543 564 },
544 565 sun: {
545 566 img: '{{ static('img/sun_128.png') }}'
... ... @@ -621,6 +642,11 @@ jQuery().ready(function($){
621 642 sw.resizeDomain(started_at, stopped_at);
622 643 return false;
623 644 });
  645 + $('#apply_new_input').on("click", function(e){
  646 + var new_input_slug = $("input[name='input_slug']:checked").val();
  647 + window.location = "?input_slug="+new_input_slug;
  648 + return false;
  649 + });
624 650 $('#download').on("click", function(e){
625 651 var url = sw.buildDownloadUrl();
626 652 console.info("Downloading " + url);
... ...