Commit f3a09722 authored by Javier Vegas-Regidor's avatar Javier Vegas-Regidor
Browse files

Append regions without spaces

parent 96de041b
...@@ -16,6 +16,8 @@ from earthdiagnostics.utils import Utils, TempFile ...@@ -16,6 +16,8 @@ from earthdiagnostics.utils import Utils, TempFile
from earthdiagnostics.publisher import Publisher from earthdiagnostics.publisher import Publisher
from earthdiagnostics.variable import VariableType from earthdiagnostics.variable import VariableType
import netCDF4
class LocalStatus(object): class LocalStatus(object):
"""Local file status enumeration""" """Local file status enumeration"""
...@@ -476,6 +478,14 @@ class DataFile(Publisher): ...@@ -476,6 +478,14 @@ class DataFile(Publisher):
Utils.rename_variables( Utils.rename_variables(
temp, renames, must_exist=False, rename_dimension=True) temp, renames, must_exist=False, rename_dimension=True)
Utils.move_file(temp, self.local_file) 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() self._correct_metadata()
def _rename_coordinate_variables(self): def _rename_coordinate_variables(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment