Commit 7b3d3593ab95fb0a5896bff621a9adc4f68e38b1
1 parent
10389e8d
Exists in
rhitier-dev
Move inputs configs to inputs: section
Showing
4 changed files
with
133 additions
and
60 deletions
Show diff stats
.gitignore
config.yml-dist
@@ -102,52 +102,12 @@ layers: | @@ -102,52 +102,12 @@ layers: | ||
102 | 102 | ||
103 | 103 | ||
104 | inputs: | 104 | inputs: |
105 | + | ||
105 | - slug: "om" | 106 | - slug: "om" |
107 | + type: "input" | ||
106 | name: "OMNI" | 108 | name: "OMNI" |
107 | - desc: "The default input." | ||
108 | - - slug: "art" | ||
109 | - name: "ACE-RT" | ||
110 | - desc: "ACE Real ime" | ||
111 | - - slug: "dsc" | ||
112 | - name: "DISCOVER" | ||
113 | - desc: "DISCOVER" | ||
114 | - - slug: "solo" | ||
115 | - name: "SOLAR-O" | ||
116 | - desc: "Solar Orbiter" | ||
117 | - - slug: "sa" | ||
118 | - name: "STEREO-A" | ||
119 | - desc: "The first of the STEREO (Solar Terrestrial Relations Observatory), a solar observation mission." | ||
120 | - - slug: "sb" | ||
121 | - name: "STEREO-B" | ||
122 | - desc: "The second of the STEREO (Solar Terrestrial Relations Observatory), a solar observation mission." | ||
123 | - | ||
124 | -#Comets | ||
125 | -#67P p67_orb_all | ||
126 | -# | ||
127 | -#Probes | ||
128 | -#Maven maven_orb_cruise | ||
129 | -#Juno juno_cruise_all | ||
130 | -#Exomars exomars_cruise_all | ||
131 | -#Rosetta ros_orb_cruise | ||
132 | - | ||
133 | -# To add a new target, you must : | ||
134 | -# 1. Configure it here | ||
135 | -# 2. Create the two related images in `web/static/img/target/` | ||
136 | -# | ||
137 | -# `slug` is used internally, and should match \[a-z0-9]+\ (NO dashes /!\) | ||
138 | -# `name` is displayed in the time series (should be short) | ||
139 | -# `title` appears on mouse hover, and can be longer | ||
140 | -# `locked` is for sources that are "coming soon" | ||
141 | -# `default` sources are shown to incoming visitors, others need user activation | ||
142 | -# `orbit` holds the orbit configuration data | ||
143 | -# `models` holds the configuration data for each model | ||
144 | -# the slugs are ids for AMDA | ||
145 | -targets: | ||
146 | - | ||
147 | - - type: 'input' | ||
148 | - slug: 'om' | ||
149 | - name: 'OMNI' | ||
150 | title: 'Omni' | 109 | title: 'Omni' |
110 | + desc: "The default input." | ||
151 | orbit: | 111 | orbit: |
152 | models: | 112 | models: |
153 | - slug: 'mercury-orb-all' | 113 | - slug: 'mercury-orb-all' |
@@ -165,11 +125,11 @@ targets: | @@ -165,11 +125,11 @@ targets: | ||
165 | #atse: '' | 125 | #atse: '' |
166 | locked: false | 126 | locked: false |
167 | default: false | 127 | default: false |
168 | - | ||
169 | - - type: 'input' | ||
170 | - slug: 'art' | ||
171 | - name: 'ACE REAL TIME' | 128 | + - slug: "art" |
129 | + type: "input" | ||
130 | + name: "ACE-RT" | ||
172 | title: 'Ace RT' | 131 | title: 'Ace RT' |
132 | + desc: "ACE Real ime" | ||
173 | orbit: | 133 | orbit: |
174 | models: | 134 | models: |
175 | - slug: 'mercury-orb-all' | 135 | - slug: 'mercury-orb-all' |
@@ -188,11 +148,11 @@ targets: | @@ -188,11 +148,11 @@ targets: | ||
188 | #atse: '' | 148 | #atse: '' |
189 | locked: false | 149 | locked: false |
190 | default: false | 150 | default: false |
191 | - | ||
192 | - - type: 'input' | ||
193 | - slug: 'dsc' | ||
194 | - name: 'DISCOVER' | 151 | + - slug: "dsc" |
152 | + type: "input" | ||
153 | + name: "DISCOVER" | ||
195 | title: 'Discover' | 154 | title: 'Discover' |
155 | + desc: "DISCOVER" | ||
196 | orbit: | 156 | orbit: |
197 | models: | 157 | models: |
198 | - slug: 'mercury-orb-all' | 158 | - slug: 'mercury-orb-all' |
@@ -214,7 +174,107 @@ targets: | @@ -214,7 +174,107 @@ targets: | ||
214 | #atse: 'mercury_sw_da' | 174 | #atse: 'mercury_sw_da' |
215 | locked: false | 175 | locked: false |
216 | default: false | 176 | default: false |
177 | + - slug: "solo" | ||
178 | + type: "input" | ||
179 | + name: "SOLAR-O" | ||
180 | + title: 'Solar Orbiter' | ||
181 | + desc: "Solar Orbiter" | ||
182 | + orbit: | ||
183 | + models: | ||
184 | + - slug: 'so-orb-all' | ||
185 | + parameters: | ||
186 | + xy_hee: 'so_xyz_hee' | ||
187 | + models: | ||
188 | + solo: | ||
189 | + - slug: 'so-pas-momgr1' | ||
190 | + parameters: | ||
191 | + dens: 'pas_momgr_n' | ||
192 | + vtot: 'pas_momgr_v_tot' | ||
193 | + temp: 'pas_momgr_tav' | ||
194 | + #pdyn: 'dsc_pdyn' | ||
195 | + - slug: 'so-mag-1min' | ||
196 | + parameters: | ||
197 | + xy_b: 'solo_b_rtn' | ||
198 | + #btan: 'mercury_sw_b' | ||
199 | + #brad: 'mercury_sw_bx' | ||
200 | + #atse: 'mercury_sw_da' | ||
201 | + locked: false | ||
202 | + default: false | ||
203 | + - slug: "sa" | ||
204 | + type: "input" | ||
205 | + name: "STEREO-A" | ||
206 | + title: 'STEREO-A' | ||
207 | + desc: "The first of the STEREO (Solar Terrestrial Relations Observatory), a solar observation mission." | ||
208 | + orbit: | ||
209 | + models: | ||
210 | + - slug: 'sta-l2-orb' | ||
211 | + parameters: | ||
212 | + xy_hee: 'sta_xyz_hee' | ||
213 | + models: | ||
214 | + sa: | ||
215 | + - slug: 'sta-l2-pla' | ||
216 | + parameters: | ||
217 | + dens: 'np_sta' | ||
218 | + vtot: 'vpbulk_sta' | ||
219 | + #temp: '' | ||
220 | + #pdyn: '' | ||
221 | + - slug: 'sta-b-1min' | ||
222 | + parameters: | ||
223 | + xy_b: 'sta_b_rtn' | ||
224 | + #btan: 'mercury_sw_b' | ||
225 | + #brad: 'mercury_sw_bx' | ||
226 | + #atse: 'mercury_sw_da' | ||
227 | + locked: false | ||
228 | + default: false | ||
229 | + - slug: "sb" | ||
230 | + type: "input" | ||
231 | + name: "STEREO-B" | ||
232 | + title: 'STEREO-B' | ||
233 | + desc: "The second of the STEREO (Solar Terrestrial Relations Observatory), a solar observation mission." | ||
234 | + orbit: | ||
235 | + models: | ||
236 | + - slug: 'stb-l2-orb' | ||
237 | + parameters: | ||
238 | + xy_hee: 'stb_xyz_hee' | ||
239 | + models: | ||
240 | + sb: | ||
241 | + - slug: 'stb-l2-pla' | ||
242 | + parameters: | ||
243 | + dens: 'np_stb' | ||
244 | + vtot: 'vpbulk_stb' | ||
245 | + #temp: '' | ||
246 | + #pdyn: '' | ||
247 | + - slug: 'stb-b-1min' | ||
248 | + parameters: | ||
249 | + xy_b: 'stb_b_rtn' | ||
250 | + #btan: '' | ||
251 | + #brad: '' | ||
252 | + #atse: '' | ||
253 | + locked: false | ||
254 | + default: false | ||
217 | 255 | ||
256 | +#Comets | ||
257 | +#67P p67_orb_all | ||
258 | +# | ||
259 | +#Probes | ||
260 | +#Maven maven_orb_cruise | ||
261 | +#Juno juno_cruise_all | ||
262 | +#Exomars exomars_cruise_all | ||
263 | +#Rosetta ros_orb_cruise | ||
264 | + | ||
265 | +# To add a new target, you must : | ||
266 | +# 1. Configure it here | ||
267 | +# 2. Create the two related images in `web/static/img/target/` | ||
268 | +# | ||
269 | +# `slug` is used internally, and should match \[a-z0-9]+\ (NO dashes /!\) | ||
270 | +# `name` is displayed in the time series (should be short) | ||
271 | +# `title` appears on mouse hover, and can be longer | ||
272 | +# `locked` is for sources that are "coming soon" | ||
273 | +# `default` sources are shown to incoming visitors, others need user activation | ||
274 | +# `orbit` holds the orbit configuration data | ||
275 | +# `models` holds the configuration data for each model | ||
276 | +# the slugs are ids for AMDA | ||
277 | +targets: | ||
218 | 278 | ||
219 | - type: 'planet' | 279 | - type: 'planet' |
220 | slug: 'mercury' | 280 | slug: 'mercury' |
web/hp_cmd.py
@@ -5,16 +5,17 @@ from datetime import datetime | @@ -5,16 +5,17 @@ from datetime import datetime | ||
5 | import argparse | 5 | import argparse |
6 | 6 | ||
7 | if __name__ == "__main__": | 7 | if __name__ == "__main__": |
8 | - hp_parser = argparse.ArgumentParser(prog='Descritpor', | ||
9 | - description='description') | 8 | + hp_parser = argparse.ArgumentParser(prog='Heliopropa Command tool') |
10 | 9 | ||
11 | hp_parser.add_argument('-clog', '--console-log', action='store_true') | 10 | hp_parser.add_argument('-clog', '--console-log', action='store_true') |
12 | hp_parser.add_argument('-s', '--dry-run', action='store_true') | 11 | hp_parser.add_argument('-s', '--dry-run', action='store_true') |
13 | 12 | ||
14 | subparsers = hp_parser.add_subparsers(dest='hpcmd_name') | 13 | subparsers = hp_parser.add_subparsers(dest='hpcmd_name') |
15 | 14 | ||
15 | + csvgen_parser = subparsers.add_parser('show_config', | ||
16 | + help='Show configuration targets and inputs') | ||
16 | csvgen_parser = subparsers.add_parser('csv_gen', | 17 | csvgen_parser = subparsers.add_parser('csv_gen', |
17 | - help='csv-gen help') | 18 | + help='Generate CSV for given target/input (can be input/input)') |
18 | csvgen_parser.add_argument('-a', '--all', action='store_true') | 19 | csvgen_parser.add_argument('-a', '--all', action='store_true') |
19 | csvgen_parser.add_argument('-t', '--target') | 20 | csvgen_parser.add_argument('-t', '--target') |
20 | csvgen_parser.add_argument('-i', '--input') | 21 | csvgen_parser.add_argument('-i', '--input') |
@@ -26,18 +27,27 @@ if __name__ == "__main__": | @@ -26,18 +27,27 @@ if __name__ == "__main__": | ||
26 | if args.console_log: | 27 | if args.console_log: |
27 | _logger = init_console_logger() | 28 | _logger = init_console_logger() |
28 | 29 | ||
29 | - if args.hpcmd_name == 'csv_gen': | 30 | + if args.hpcmd_name == 'show_config': |
31 | + for meteor in config['targets'] + config['inputs']: | ||
32 | + meteor_type = meteor['type'] | ||
33 | + meteor_name = f"'{meteor['name']}'" | ||
34 | + meteor_slug = meteor['slug'] | ||
35 | + meteor_models = ', '.join(list(meteor['models'].keys())) | ||
36 | + print(f"{meteor_type:6} {meteor_slug:6} {meteor_name:11}: models = {meteor_models}") | ||
37 | + elif args.hpcmd_name == 'csv_gen': | ||
30 | # build default dates in not -b or not -e | 38 | # build default dates in not -b or not -e |
31 | - sta, sto = get_default_sta_sto( args.begin, args.end) | 39 | + sta, sto = get_default_sta_sto(args.begin, args.end) |
40 | + | ||
41 | + meteors_list = config['targets'] + config['inputs'] | ||
32 | 42 | ||
33 | if args.all: | 43 | if args.all: |
34 | # build the {target_slug: [input list]} dictionnary from config.yaml | 44 | # build the {target_slug: [input list]} dictionnary from config.yaml |
35 | - targets = {t['slug']: list(t['models'].keys()) for t in config['targets']} | 45 | + meteors_dict = {t['slug']: list(t['models'].keys()) for t in meteors_list} |
36 | else: | 46 | else: |
37 | # todo: check -i an -t | 47 | # todo: check -i an -t |
38 | - targets = {args.target: [args.input]} | 48 | + meteors_dict = {args.target: [args.input]} |
39 | 49 | ||
40 | - for _t, _i_list in targets.items(): | 50 | + for _t, _i_list in meteors_dict.items(): |
41 | # print(_t, _i_list) | 51 | # print(_t, _i_list) |
42 | for _i in _i_list: | 52 | for _i in _i_list: |
43 | print(f"generating csv for {_t}/ {_i}") | 53 | print(f"generating csv for {_t}/ {_i}") |
web/run.py
@@ -420,7 +420,7 @@ def get_local_filename(url): | @@ -420,7 +420,7 @@ def get_local_filename(url): | ||
420 | 420 | ||
421 | 421 | ||
422 | def get_target_config(slug): | 422 | def get_target_config(slug): |
423 | - for s in config['targets']: # dumb | 423 | + for s in config['targets'] + config['inputs']: # dumb |
424 | if s['slug'] == slug: | 424 | if s['slug'] == slug: |
425 | return s | 425 | return s |
426 | raise Exception("No target found in configuration for '%s'." % slug) | 426 | raise Exception("No target found in configuration for '%s'." % slug) |
@@ -1297,6 +1297,8 @@ def home(): | @@ -1297,6 +1297,8 @@ def home(): | ||
1297 | parameters = sorted(parameters, key=lambda x: x['position']) | 1297 | parameters = sorted(parameters, key=lambda x: x['position']) |
1298 | input_slug = get_input_slug_from_query() | 1298 | input_slug = get_input_slug_from_query() |
1299 | targets = [t for t in config['targets'] if not t['locked']] | 1299 | targets = [t for t in config['targets'] if not t['locked']] |
1300 | + # now add the input_slug configuration as a target to be plotted | ||
1301 | + targets = [get_target_config(input_slug)] + targets | ||
1300 | started_at, stopped_at = get_interval_from_query(request) | 1302 | started_at, stopped_at = get_interval_from_query(request) |
1301 | for i, target in enumerate(targets): | 1303 | for i, target in enumerate(targets): |
1302 | targets[i]['catalog_layers'] = get_catalog_layers( | 1304 | targets[i]['catalog_layers'] = get_catalog_layers( |