diff --git a/CHANGELOG.md b/CHANGELOG.md
index 075382d..f069a4f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,9 +10,7 @@
- [ ] Give the future data another color
- [ ] Sort times series by closeness to the sun
- [ ] Generate a CDF file (not NetCDF)
-- [ ] Make the footer images clickable
- [ ] Move the link to the source in the footer
-- [ ] Highlight the visits counter
An heliospheric propagation 1D MHD model for solar wind prediction at planets, probes and comets.
@@ -20,6 +18,9 @@ An heliospheric propagation 1D MHD model for solar wind prediction at planets, p
## 1.0.0-rc4
+- [x] Make the footer images clickable
+- [x] Highlight the visits counter
+- [x] Use a default interval up to 3 weeks in the future
- [x] Add interval constraints for orbit models (Rosetta uses P67 after a time)
- [x] Make the download with a netcdf file instead of a tarball of CSVs
- [x] Support having no position to display (for Rosetta in some intervals)
diff --git a/config.yml b/config.yml
index fdae59c..9c6fd00 100644
--- a/config.yml
+++ b/config.yml
@@ -166,10 +166,13 @@ targets:
- type: 'probe'
slug: 'juno'
name: 'Juno'
- title: 'Juno (coming soon)'
+ title: 'Juno'
orbit:
models:
- slug: 'juno_cruise_all'
+ stopped_at: '2016-07-01T00:00:00'
+ - slug: 'jupiter_orb_all'
+ started_at: '2016-07-01T00:00:00'
models:
- slug: 'tao_juno_sw'
locked: false
diff --git a/web/run.py b/web/run.py
index 7358669..41fd83a 100755
--- a/web/run.py
+++ b/web/run.py
@@ -46,10 +46,12 @@ FILE_DATE_FMT = "%Y-%m-%dT%H:%M:%S"
# LOGGING #####################################################################
+LOG_FILE = get_path('run.log')
+
log = logging.getLogger("HelioPropa")
log.setLevel(logging.DEBUG)
# log.setLevel(logging.ERROR) # <-- set log level here !
-logHandler = logging.FileHandler(get_path('run.log'))
+logHandler = logging.FileHandler(LOG_FILE)
logHandler.setFormatter(logging.Formatter(
"%(asctime)s - %(levelname)s - %(message)s"
))
@@ -265,6 +267,19 @@ def is_list_in_list(needle, haystack):
return True
+def round_time(dt=None, round_to=60):
+ """
+ Round a datetime object to any time laps in seconds
+ dt : datetime.datetime object, default now.
+ roundTo : Closest number of seconds to round to, default 1 minute.
+ """
+ if dt is None:
+ dt = datetime.datetime.now()
+ seconds = (dt.replace(tzinfo=None) - dt.min).seconds
+ rounding = (seconds + round_to / 2) // round_to * round_to
+ return dt + datetime.timedelta(0, rounding-seconds, -dt.microsecond)
+
+
def datetime_from_list(time_list):
"""
Datetimes in retrieved CDFs are stored as lists of numbers,
@@ -465,9 +480,13 @@ def get_data_for_target(target_config, started_at, stopped_at):
log.debug("%s: aggregating data from '%s'..." %
(target_config['name'], orbit_file))
for time, datum_hee in zip(times, data_hee):
- dtime = datetime_from_list(time)
+ try:
+ dtime = datetime_from_list(time)
+ except Exception as e:
+ log.error("Failed to parse time from %s." % time)
+ raise e
if s0 <= dtime <= s1:
- dkey = dtime.strftime(precision)
+ dkey = round_time(dtime, 60*60).strftime(precision)
orbit_data[dkey] = datum_hee
cdf_handle.close()
@@ -490,9 +509,13 @@ def get_data_for_target(target_config, started_at, stopped_at):
in zip(times, data_v, data_b, data_t, data_n, data_p, data_d):
vrad = datum_v[0]
vtan = datum_v[1]
- dtime = datetime_from_list(time)
+ try:
+ dtime = datetime_from_list(time)
+ except Exception as e:
+ log.error("Failed to parse time from %s." % time)
+ raise e
if started_at <= dtime <= stopped_at:
- dkey = dtime.strftime(precision)
+ dkey = round_time(dtime, 60*60).strftime(precision)
x_hee = None
y_hee = None
if dkey in orbit_data:
@@ -913,13 +936,20 @@ def cache_warmup():
return "To Do"
-@app.route("/run.log")
-def run_log():
- with open(get_path('run.log'), 'r') as f:
+@app.route("/log")
+def log_show():
+ with open(LOG_FILE, 'r') as f:
contents = f.read()
return contents
+@app.route("/log/clear")
+def log_clear():
+ with open(LOG_FILE, 'w') as f:
+ f.truncate()
+ return "Log cleared successfully."
+
+
# DEV TOOLS ###################################################################
# @app.route("/inspect")
@@ -951,6 +981,11 @@ def run_log():
# MAIN ########################################################################
if __name__ == "__main__":
+
+ a = "2015171150000001"
+
+
+
# Debug mode on, as the production server does not use this but run.wsgi
extra_files = [get_path('../config.yml')]
app.run(debug=True, extra_files=extra_files)
diff --git a/web/static/js/swapp.js b/web/static/js/swapp.js
index ba9042d..e78add5 100644
--- a/web/static/js/swapp.js
+++ b/web/static/js/swapp.js
@@ -43,7 +43,7 @@
"This is called by the inline bootstrap javascript code.\nThis ain't in the constructor because it might return a Promise later on.\n(for the loader, for example)";
var started_at, stopped_at, this$ = this;
started_at = moment().subtract(1, 'year').hours(0).minutes(0).seconds(0);
- stopped_at = moment().add(1, 'week').hours(0).minutes(0).seconds(0);
+ 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(){
diff --git a/web/static/js/swapp.ls b/web/static/js/swapp.ls
index a335ccc..b97e053 100644
--- a/web/static/js/swapp.ls
+++ b/web/static/js/swapp.ls
@@ -75,7 +75,7 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
# Default time interval is from two weeks ago to one week ahead.
# We set the h/m/s to zero to benefit from a daily cache.
started_at = moment().subtract(1, 'year').hours(0).minutes(0).seconds(0)
- stopped_at = moment().add(1, 'week').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)
diff --git a/web/view/home.html.jinja2 b/web/view/home.html.jinja2
index a241858..6043466 100755
--- a/web/view/home.html.jinja2
+++ b/web/view/home.html.jinja2
@@ -298,7 +298,7 @@
path.orbit.orbit_section {
fill: none;
stroke: steelblue;
- stroke-width: 3px;
+ stroke-width: 1.5px;
}
ellipse.orbit.orbit_ellipse {
fill: none;
diff --git a/web/view/layout.html.jinja2 b/web/view/layout.html.jinja2
index d4a44e9..ed38937 100755
--- a/web/view/layout.html.jinja2
+++ b/web/view/layout.html.jinja2
@@ -70,36 +70,30 @@
-{# #}
-