From c1a967629561c1287fef80e8656e407dfc358c70 Mon Sep 17 00:00:00 2001 From: Richard Hitier Date: Thu, 22 Sep 2022 10:07:06 +0200 Subject: [PATCH] Move duplicated to function --- web/run.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/web/run.py b/web/run.py index fe82ce0..2051c7f 100755 --- a/web/run.py +++ b/web/run.py @@ -328,6 +328,10 @@ def datetime_from_list(time_list): with DayOfYear starting at 0. We want it starting at 1 because it's what vendor parsers use, both in python and javascript. """ + try: + time_list = [str(i, 'UTF8') for i in time_list] + except Exception as e: + log.error(e) # Day Of Year starts at 0, but for our datetime parser it starts at 1 doy = '{:03d}'.format(int(''.join(time_list[4:7])) + 1) return datetime.datetime.strptime( @@ -711,10 +715,6 @@ def get_data_for_target(target_config, input_slug, (target_config['name'], orbit_file)) for ltime, datum_hee in zip(times, data_hee): try: - try: - ltime = [str(i, 'UTF8') for i in ltime] - except Exception as e: - print(e) dtime = datetime_from_list(ltime) except Exception: log.error("Failed to parse time from get__data_for_target %s." % ltime) @@ -776,10 +776,6 @@ def get_data_for_target(target_config, input_slug, in zip(times, data_v, data_b, data_t, data_n, data_p, data_a): try: - try: - ltime = [str(i, 'UTF8') for i in ltime] - except Exception as e: - print(e) dtime = datetime_from_list(ltime) except Exception: log.error("Failed to parse time from %s." % ltime) -- libgit2 0.21.2