From 89139ea586c2b908c7f57bed097629f35834b119 Mon Sep 17 00:00:00 2001 From: sloosvel Date: Wed, 26 Feb 2020 18:17:51 +0100 Subject: [PATCH 1/4] Append regions without spaces --- earthdiagnostics/datafile.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/earthdiagnostics/datafile.py b/earthdiagnostics/datafile.py index f43b83b0..0d6abd52 100644 --- a/earthdiagnostics/datafile.py +++ b/earthdiagnostics/datafile.py @@ -16,6 +16,7 @@ from earthdiagnostics.utils import Utils, TempFile from earthdiagnostics.publisher import Publisher from earthdiagnostics.variable import VariableType +import netCDF4 class LocalStatus(object): """Local file status enumeration""" @@ -476,6 +477,14 @@ class DataFile(Publisher): Utils.rename_variables( temp, renames, must_exist=False, rename_dimension=True) Utils.move_file(temp, self.local_file) + handler2 = Utils.open_cdf(self.local_file) + region_var = handler2.variables['region'] + for i, cube in enumerate(cube_list): + encode = 'utf-8' + name = region_var[i,...].tobytes().strip().decode(encode) + length = handler2.dimensions['region_length'].size + region_var[i, ...] = netCDF4.stringtoarr(name, length) + handler2.close() self._correct_metadata() def _rename_coordinate_variables(self): -- GitLab From 6724b23f959c182e89d14b3d6cd80837fe7d8280 Mon Sep 17 00:00:00 2001 From: Javier Vegas-Regidor Date: Thu, 27 Feb 2020 15:48:46 +0100 Subject: [PATCH 2/4] Fix style --- earthdiagnostics/datafile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/earthdiagnostics/datafile.py b/earthdiagnostics/datafile.py index 0d6abd52..63a3f336 100644 --- a/earthdiagnostics/datafile.py +++ b/earthdiagnostics/datafile.py @@ -18,6 +18,7 @@ from earthdiagnostics.variable import VariableType import netCDF4 + class LocalStatus(object): """Local file status enumeration""" @@ -481,7 +482,7 @@ class DataFile(Publisher): region_var = handler2.variables['region'] for i, cube in enumerate(cube_list): encode = 'utf-8' - name = region_var[i,...].tobytes().strip().decode(encode) + name = region_var[i, ...].tobytes().strip().decode(encode) length = handler2.dimensions['region_length'].size region_var[i, ...] = netCDF4.stringtoarr(name, length) handler2.close() -- GitLab From 71a577de3ba05c484090e52bed3b01825d3e1e71 Mon Sep 17 00:00:00 2001 From: sloosvel Date: Wed, 26 Feb 2020 18:17:51 +0100 Subject: [PATCH 3/4] Append regions without spaces --- earthdiagnostics/datafile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/earthdiagnostics/datafile.py b/earthdiagnostics/datafile.py index d29956c4..1d445f79 100644 --- a/earthdiagnostics/datafile.py +++ b/earthdiagnostics/datafile.py @@ -17,6 +17,10 @@ from earthdiagnostics.publisher import Publisher from earthdiagnostics.variable import VariableType import netCDF4 +<< << << < HEAD + +== == == = +>>>>>> > Append regions without spaces class LocalStatus(object): -- GitLab From ebe8b19bfda50064bcbb9f7f1eb412e3dfbd0903 Mon Sep 17 00:00:00 2001 From: Javier Vegas-Regidor Date: Thu, 27 Feb 2020 15:48:46 +0100 Subject: [PATCH 4/4] Fix style --- earthdiagnostics/datafile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/earthdiagnostics/datafile.py b/earthdiagnostics/datafile.py index 1d445f79..ec70195b 100644 --- a/earthdiagnostics/datafile.py +++ b/earthdiagnostics/datafile.py @@ -23,6 +23,7 @@ import netCDF4 >>>>>> > Append regions without spaces + class LocalStatus(object): """Local file status enumeration""" -- GitLab