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,7 +10,9 @@ | ||
10 | - [x] Count visits | 10 | - [x] Count visits |
11 | - [x] Zoom in on time series | 11 | - [x] Zoom in on time series |
12 | - [x] Loader and targets loading animation | 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 | - [ ] Download raw data (as CSV) for current time interval and targets | 16 | - [ ] Download raw data (as CSV) for current time interval and targets |
15 | - [ ] Same via SAMP | 17 | - [ ] Same via SAMP |
16 | - [ ] Credit the author of the pixel art planets | 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,7 +265,7 @@ def generate_csv_contents(source_config, started_at, stopped_at): | ||
265 | model_files = retrieve_data(source_config['slug'], model_slug, started_at, stopped_at) | 265 | model_files = retrieve_data(source_config['slug'], model_slug, started_at, stopped_at) |
266 | orbits_files = retrieve_data(source_config['slug'], source_config['orbit']['model'], started_at, stopped_at) | 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 | si = StringIO.StringIO() | 269 | si = StringIO.StringIO() |
270 | cw = csv_writer(si) | 270 | cw = csv_writer(si) |
271 | cw.writerow(( # the order matters ! | 271 | cw.writerow(( # the order matters ! |
@@ -278,6 +278,7 @@ def generate_csv_contents(source_config, started_at, stopped_at): | @@ -278,6 +278,7 @@ def generate_csv_contents(source_config, started_at, stopped_at): | ||
278 | precision = "%Y-%m-%dT%H" # model and orbits times are equal-ish | 278 | precision = "%Y-%m-%dT%H" # model and orbits times are equal-ish |
279 | orbits_data = {} # keys are datetime as str, values arrays of XY | 279 | orbits_data = {} # keys are datetime as str, values arrays of XY |
280 | for orbits_file in orbits_files: | 280 | for orbits_file in orbits_files: |
281 | + log.debug("%s: opening orbit NETCDF4 '%s'..." % (source_config['name'], orbits_file)) | ||
281 | cdf_handle = Dataset(orbits_file, "r", format="NETCDF4") | 282 | cdf_handle = Dataset(orbits_file, "r", format="NETCDF4") |
282 | times = cdf_handle.variables['Time'] # YYYY DOY HH MM SS .ms | 283 | times = cdf_handle.variables['Time'] # YYYY DOY HH MM SS .ms |
283 | data_hci = cdf_handle.variables['HCI'] | 284 | data_hci = cdf_handle.variables['HCI'] |
@@ -286,9 +287,12 @@ def generate_csv_contents(source_config, started_at, stopped_at): | @@ -286,9 +287,12 @@ def generate_csv_contents(source_config, started_at, stopped_at): | ||
286 | if started_at <= dtime <= stopped_at: | 287 | if started_at <= dtime <= stopped_at: |
287 | dkey = dtime.strftime(precision) | 288 | dkey = dtime.strftime(precision) |
288 | orbits_data[dkey] = datum_hci | 289 | orbits_data[dkey] = datum_hci |
290 | + cdf_handle.close() | ||
289 | all_data = {} # keys are datetime as str, values tuples of data | 291 | all_data = {} # keys are datetime as str, values tuples of data |
290 | for model_file in model_files: | 292 | for model_file in model_files: |
291 | # Time, StartTime, StopTime, V, B, N, T, Delta_angle, P_dyn | 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 | cdf_handle = Dataset(model_file, "r", format="NETCDF4") | 296 | cdf_handle = Dataset(model_file, "r", format="NETCDF4") |
293 | times = cdf_handle.variables['Time'] # YYYY DOY HH MM SS .ms | 297 | times = cdf_handle.variables['Time'] # YYYY DOY HH MM SS .ms |
294 | data_v = cdf_handle.variables['V'] | 298 | data_v = cdf_handle.variables['V'] |