From c33004ca34d8f7c7b3a871c0e7777999770c8e7c Mon Sep 17 00:00:00 2001 From: Javier Vegas-Regidor Date: Mon, 4 May 2020 12:20:54 +0200 Subject: [PATCH 1/4] Remove mixdiags --- src/mixdiags | 1 - 1 file changed, 1 deletion(-) delete mode 160000 src/mixdiags diff --git a/src/mixdiags b/src/mixdiags deleted file mode 160000 index 19997970..00000000 --- a/src/mixdiags +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 199979700e38d3918a82bd2052855d46375e48ab -- GitLab From 6d2334897f6ab796b562de1722cecbae5c9ab4b2 Mon Sep 17 00:00:00 2001 From: Javier Vegas-Regidor Date: Mon, 4 May 2020 12:36:08 +0200 Subject: [PATCH 2/4] Fix CI --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 684f1213..ee51183f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,7 @@ test: - git submodule update --init --recursive - conda env update -f environment.yml -n earthdiagnostics3 python=3.7 - source activate earthdiagnostics3 - - rm -r ../diagonals + - rm -r ../diagonals || exit_code=$? - git clone https://earth.bsc.es/gitlab/es/diagonals.git ../diagonals - pip install ../diagonals - pip install .[develop] -- GitLab From 12fd6955bb8e043d313e759526c56d389ceb4b69 Mon Sep 17 00:00:00 2001 From: Javier Vegas-Regidor Date: Mon, 4 May 2020 12:42:23 +0200 Subject: [PATCH 3/4] Fix flake8 test --- earthdiagnostics/general/timemean.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/earthdiagnostics/general/timemean.py b/earthdiagnostics/general/timemean.py index a55310ac..042f113d 100644 --- a/earthdiagnostics/general/timemean.py +++ b/earthdiagnostics/general/timemean.py @@ -6,6 +6,7 @@ import iris.analysis import iris.exceptions import numpy as np +from bscearth.utils.log import Log from earthdiagnostics.diagnostic import ( Diagnostic, @@ -157,7 +158,22 @@ class TimeMean(Diagnostic): def compute(self): """Run the diagnostic""" + def tracefunc(frame, event, arg, indent=[0]): + if event == "call": + indent[0] += 2 + Log.info( + "-" * indent[0] + "> call function {0}", frame.f_code) + elif event == "return": + Log.info( + "<" + "-" * indent[0] + "exit function {0}", frame.f_code) + indent[0] -= 2 + return tracefunc + + import sys + # sys.setprofile(tracefunc) + temp = TempFile.get() + Log.info('Load data') cube = iris.load_cube(self.variable_file.local_file) time_centered = [ coord @@ -169,7 +185,7 @@ class TimeMean(Diagnostic): iris.coord_categorisation.add_day_of_month(cube, "time") iris.coord_categorisation.add_month_number(cube, "time") iris.coord_categorisation.add_year(cube, "time") - + Log.info('Compute mean') cube = self.compute_mean(cube) cube.remove_coord("day_of_month") cube.remove_coord("month_number") @@ -179,7 +195,7 @@ class TimeMean(Diagnostic): cube.remove_coord(region_coord) except iris.exceptions.CoordinateNotFoundError: region_coord = None - + cube.data iris.save(cube, temp) if region_coord: handler = Utils.open_cdf(temp) -- GitLab From 68adccf374521f504ee49a3c09ed91a4689e97d5 Mon Sep 17 00:00:00 2001 From: Javier Vegas-Regidor Date: Mon, 4 May 2020 12:47:11 +0200 Subject: [PATCH 4/4] Fix flake8 --- earthdiagnostics/data_convention.py | 2 +- earthdiagnostics/general/timemean.py | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/earthdiagnostics/data_convention.py b/earthdiagnostics/data_convention.py index 0ac704f0..eb137782 100644 --- a/earthdiagnostics/data_convention.py +++ b/earthdiagnostics/data_convention.py @@ -887,7 +887,7 @@ class Cmor3Convention(DataConvention): versions = os.listdir(os.path.dirname(folder_path)) versions.sort(reverse=True) self.config.cmor.version = versions[0] - fodler_path = folder_path.replace('/latest/', f'/{versions[0]}/') + folder_path = folder_path.replace('/latest/', f'/{versions[0]}/') return folder_path diff --git a/earthdiagnostics/general/timemean.py b/earthdiagnostics/general/timemean.py index 042f113d..0dafc6ef 100644 --- a/earthdiagnostics/general/timemean.py +++ b/earthdiagnostics/general/timemean.py @@ -158,20 +158,6 @@ class TimeMean(Diagnostic): def compute(self): """Run the diagnostic""" - def tracefunc(frame, event, arg, indent=[0]): - if event == "call": - indent[0] += 2 - Log.info( - "-" * indent[0] + "> call function {0}", frame.f_code) - elif event == "return": - Log.info( - "<" + "-" * indent[0] + "exit function {0}", frame.f_code) - indent[0] -= 2 - return tracefunc - - import sys - # sys.setprofile(tracefunc) - temp = TempFile.get() Log.info('Load data') cube = iris.load_cube(self.variable_file.local_file) -- GitLab