diff --git a/web/run.py b/web/run.py index 2051c7f..f9a37cf 100755 --- a/web/run.py +++ b/web/run.py @@ -29,13 +29,13 @@ from flask import url_for, send_from_directory, abort as abort_flask from jinja2 import Environment, FileSystemLoader from jinja2.utils import markupsafe from yaml import load as yaml_load, dump + try: from yaml import CLoader as Loader except ImportError: from yaml import Loader from netCDF4 import Dataset, date2num - # PATH RELATIVITY ############################################################# THIS_DIRECTORY = dirname(abspath(__file__)) @@ -242,6 +242,7 @@ def escapejs_filter(value): return markupsafe.Markup("".join(escaped)) + tpl_engine = Environment(loader=FileSystemLoader([get_path('view')]), trim_blocks=True, lstrip_blocks=True) @@ -339,6 +340,7 @@ def datetime_from_list(time_list): "%Y%j%H%M%S%f" ) + # Override these using the model configuration in config.yml default_nc_keys = { 'hee': 'HEE', @@ -350,6 +352,7 @@ default_nc_keys = { 'atse': 'Delta_angle', } + def _sta_sto(_cnf, _sta, _sto): if 'started_at' in _cnf: _s0 = datetime.datetime.strptime(_cnf['started_at'], FILE_DATE_FMT) @@ -493,11 +496,11 @@ ORDER BY time_min, granule_gid jday_start=timestamp_to_jday(t_started_at), jday_stop=timestamp_to_jday(t_stopped_at) ) -# AND processing_level = 4 + # AND processing_level = 4 -# query = """ -# SELECT DISTINCT target_name FROM apis.epn_core -# """ + # query = """ + # SELECT DISTINCT target_name FROM apis.epn_core + # """ try: response = requests.post(api_url, { @@ -523,7 +526,6 @@ ORDER BY time_min, granule_gid 'external_link': row[3].text, }) - return rows except Exception as e: print("Failed to retrieve auroral emissions :") @@ -690,7 +692,6 @@ def get_data_for_target(target_config, input_slug, # abort(500, "Invalid orbit configuration for '%s' : %s" # % (target_config['slug'], str(e))) - precision = "%Y-%m-%dT%H" # model and orbits times are only equal-ish orbit_data = {} # keys are datetime as str, values arrays of XY @@ -1642,7 +1643,7 @@ def cache_clear(): removed_files = remove_all_files(CACHE_DIR) count = len(removed_files) return "Cache cleared! Removed %d file%s." \ - % (count, 's' if count != 1 else '') + % (count, 's' if count != 1 else '') @app.route("/cache/cleanup") @@ -1655,7 +1656,7 @@ def cache_cleanup(): removed_files = remove_files_created_before(a_month_ago, CACHE_DIR) count = len(removed_files) return "Cache cleaned! Removed %d old file%s." \ - % (count, 's' if count != 1 else '') + % (count, 's' if count != 1 else '') @app.route("/cache/warmup") -- libgit2 0.21.2