Commit a7ef14879e66eea71352b18f50b8ba962b148a96
1 parent
8380e043
Exists in
master
and in
2 other branches
More logs !
Showing
2 changed files
with
8 additions
and
2 deletions
Show diff stats
CHANGELOG.md
... | ... | @@ -10,7 +10,9 @@ |
10 | 10 | - [x] Count visits |
11 | 11 | - [x] Zoom in on time series |
12 | 12 | - [x] Loader and targets loading animation |
13 | -- [ ] Start/Stop datetime fields | |
13 | +- [x] Start/Stop datetime fields | |
14 | +- [ ] Optimize CSV generation | |
15 | +- [ ] Remove duplicate NetCDFs from Myriam's API response | |
14 | 16 | - [ ] Download raw data (as CSV) for current time interval and targets |
15 | 17 | - [ ] Same via SAMP |
16 | 18 | - [ ] Credit the author of the pixel art planets | ... | ... |
web/run.py
... | ... | @@ -265,7 +265,7 @@ def generate_csv_contents(source_config, started_at, stopped_at): |
265 | 265 | model_files = retrieve_data(source_config['slug'], model_slug, started_at, stopped_at) |
266 | 266 | orbits_files = retrieve_data(source_config['slug'], source_config['orbit']['model'], started_at, stopped_at) |
267 | 267 | |
268 | - log.debug("Crunching CSV contents for '%s'..." % source_config['slug']) | |
268 | + log.debug("Crunching CSV contents for '%s'..." % source_config['name']) | |
269 | 269 | si = StringIO.StringIO() |
270 | 270 | cw = csv_writer(si) |
271 | 271 | cw.writerow(( # the order matters ! |
... | ... | @@ -278,6 +278,7 @@ def generate_csv_contents(source_config, started_at, stopped_at): |
278 | 278 | precision = "%Y-%m-%dT%H" # model and orbits times are equal-ish |
279 | 279 | orbits_data = {} # keys are datetime as str, values arrays of XY |
280 | 280 | for orbits_file in orbits_files: |
281 | + log.debug("%s: opening orbit NETCDF4 '%s'..." % (source_config['name'], orbits_file)) | |
281 | 282 | cdf_handle = Dataset(orbits_file, "r", format="NETCDF4") |
282 | 283 | times = cdf_handle.variables['Time'] # YYYY DOY HH MM SS .ms |
283 | 284 | data_hci = cdf_handle.variables['HCI'] |
... | ... | @@ -286,9 +287,12 @@ def generate_csv_contents(source_config, started_at, stopped_at): |
286 | 287 | if started_at <= dtime <= stopped_at: |
287 | 288 | dkey = dtime.strftime(precision) |
288 | 289 | orbits_data[dkey] = datum_hci |
290 | + cdf_handle.close() | |
289 | 291 | all_data = {} # keys are datetime as str, values tuples of data |
290 | 292 | for model_file in model_files: |
291 | 293 | # Time, StartTime, StopTime, V, B, N, T, Delta_angle, P_dyn |
294 | + log.debug("%s: opening model NETCDF4 '%s'..." % | |
295 | + (source_config['name'], model_file)) | |
292 | 296 | cdf_handle = Dataset(model_file, "r", format="NETCDF4") |
293 | 297 | times = cdf_handle.variables['Time'] # YYYY DOY HH MM SS .ms |
294 | 298 | data_v = cdf_handle.variables['V'] | ... | ... |