diff --git a/CHANGELOG.md b/CHANGELOG.md index 15d6cfd..4277816 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,13 +10,16 @@ An heliospheric propagation 1D MHD model for solar wind prediction at planets, probes and comets. - -## 1.0.0-rc5 +## 1.0.0-rc6 - [ ] Rework the images of Rosetta and Juno -- [ ] Cache warmup (generate for today's default interval) `/cache/warmup` -- [ ] Improve the generated CDF for SAMP - [ ] Enable p67 + + +## 1.0.0-rc5 + +- [x] Cache warmup (generate for today's default interval) `/cache/warmup` +- [x] Improve the generated CDF for SAMP - [x] Enable Earth - [x] Enable more precise configuration of each models' parameters diff --git a/config.yml b/config.yml index 15be444..aa3fbdf 100644 --- a/config.yml +++ b/config.yml @@ -190,6 +190,8 @@ targets: - slug: 'p67_orb_all' parameters: hee: 'XYZ_HEE' + models: + - slug: 'tao_p67_sw' # fixme locked: true default: false diff --git a/web/run.py b/web/run.py index dde3e84..4d00417 100755 --- a/web/run.py +++ b/web/run.py @@ -14,6 +14,7 @@ from math import sqrt from os import environ, remove as removefile from os.path import isfile, join, abspath, dirname +from dateutil.relativedelta import relativedelta from flask import Flask from flask import request from flask import url_for, send_from_directory, abort as abort_flask @@ -322,6 +323,11 @@ def check_target_config(slug): get_target_config(slug) +def get_active_targets(): + all_targets = config['targets'] + return [t for t in all_targets if not ('locked' in t and t['locked'])] + + def retrieve_amda_netcdf(orbiter, what, started_at, stopped_at): """ Handles remote querying Myriam's API, downloading, extracting and caching @@ -1089,16 +1095,29 @@ def cache_warmup(): Linked to SpaceWeather#edit in swapp.ls to get the default time interval. If you edit this code you'll need to edit the other as well and vice versa. """ - # relativedelta(years=3) - # startted_at = datetime.datetime.now() - relativedelta(years=3) - return "To Do" + before = relativedelta(years=1) + after = relativedelta(weeks=3) + today = datetime.datetime.now().replace(hour=0, minute=0, second=0) + started_at = today - before + stopped_at = today + after + sta = started_at.strftime(FILE_DATE_FMT) + sto = stopped_at.strftime(FILE_DATE_FMT) + + targets = get_active_targets() + for target in targets: + download_target_csv(target['slug'], sta, sto) + targets_slugs = [target['slug'] for target in targets] + targets_slugs.sort() + download_targets_cdf('-'.join(targets_slugs), sta, sto) + + return "Done" @app.route("/log") def log_show(): with open(LOG_FILE, 'r') as f: contents = f.read() - return contents + return "
" + contents + "" @app.route("/log/clear") diff --git a/web/static/js/swapp.js b/web/static/js/swapp.js index 3134fde..4de8c0d 100644 --- a/web/static/js/swapp.js +++ b/web/static/js/swapp.js @@ -46,9 +46,10 @@ stopped_at = moment().add(3, 'week').hours(0).minutes(0).seconds(0); this.setStartAndStop(started_at, stopped_at); this.loadAndCreatePlots(started_at, stopped_at); - return window.addEventListener('resize', function(){ + window.addEventListener('resize', function(){ return this$.resize(); }); + return this; }; SpaceWeather.prototype.buildDataUrlForTarget = function(target_slug, started_at, stopped_at){ var url; diff --git a/web/static/js/swapp.ls b/web/static/js/swapp.ls index f96e79e..9d96e57 100644 --- a/web/static/js/swapp.ls +++ b/web/static/js/swapp.ls @@ -72,14 +72,15 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE This ain't in the constructor because it might return a Promise later on. (for the loader, for example) """ - # Default time interval is from two weeks ago to one week ahead. + # Default time interval is from one year ago to three weeks ahead. # We set the h/m/s to zero to benefit from a daily cache. + # If you edit these values you need to change the cache warmup too (run.py) started_at = moment().subtract(1, 'year').hours(0).minutes(0).seconds(0) stopped_at = moment().add(3, 'week').hours(0).minutes(0).seconds(0) @setStartAndStop(started_at, stopped_at) @loadAndCreatePlots(started_at, stopped_at) - window.addEventListener 'resize', ~> @resize() + this buildDataUrlForTarget: (target_slug, started_at, stopped_at) -> url = @configuration['api']['data_for_interval'] -- libgit2 0.21.2