Unverified Commit c881afd7 authored by Dion Häfner's avatar Dion Häfner Committed by GitHub

Merge pull request #66 from dionhaefner/attrs

Fix attributes in netCDF output
parents d91e8d94 674a6e89
......@@ -39,4 +39,12 @@ def test_progress_format(capsys):
prog = prog.strip()
return prog
assert sanitize(captured_log.out) == sanitize(captured_tqdm.out)
def deduplicate(prog):
# remove repeated identical lines
out = []
for line in prog.split('\n'):
if not out or out[-1] != line:
out.append(line)
return '\n'.join(out)
assert sanitize(captured_log.out) == deduplicate(sanitize(captured_tqdm.out))
......@@ -68,10 +68,12 @@ def initialize_variable(vs, key, var, ncfile):
chunks=tuple(chunksize[::-1]),
**kwargs
)
v.long_name = var.name
v.units = var.units
v.missing_value = variables.FILL_VALUE
v.attrs.update(var.extra_attributes)
v.attrs.update(
long_name=var.name,
units=var.units,
**var.extra_attributes
)
@veros_method
......@@ -118,8 +120,8 @@ def write_variable(vs, key, var, var_data, ncfile, time_step=None):
var_obj[chunk] = var_data
@veros_method
@contextlib.contextmanager
@veros_method
def threaded_io(vs, filepath, mode):
"""
If using IO threads, start a new thread to write the netCDF data to disk.
......
......@@ -156,6 +156,7 @@ class FancyProgressBar:
def __exit__(self, *args, **kwargs):
logs.setup_logging(loglevel=rs.loglevel)
self._pbar.__exit__(*args, **kwargs)
def advance_time(self, amount):
self._iteration += 1
......
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