diff --git a/climetlab/loaders/__init__.py b/climetlab/loaders/__init__.py index 65ce481c..a401fec1 100644 --- a/climetlab/loaders/__init__.py +++ b/climetlab/loaders/__init__.py @@ -257,7 +257,8 @@ class FastWriter(ArrayLike): def __init__(self, array, shape): self.array = array self.shape = shape - self.cache = np.zeros(shape) + self.dtype = array.dtype + self.cache = np.zeros(shape, dtype=self.dtype) def __setitem__(self, key, value): self.cache[key] = value @@ -323,6 +324,7 @@ class OffsetView(ArrayLike): def __init__(self, large_array, *, offset, axis, shape): self.large_array = large_array + self.dtype = large_array.dtype self.offset = offset self.axis = axis self.shape = shape diff --git a/climetlab/utils/config.py b/climetlab/utils/config.py index 127568ff..9461535c 100644 --- a/climetlab/utils/config.py +++ b/climetlab/utils/config.py @@ -1191,18 +1191,16 @@ def parse_config(self): assert isinstance(self.end, datetime.date), (type(self.end), self.end) self.step = datetime.timedelta(days=self.step) - if isinstance(self.group_by, int) and self.group_by > 1: + if isinstance(self.group_by, int) and self.group_by > 0: self.grouper_key = GroupByDays(self.group_by) else: self.grouper_key = { - 1: lambda dt: 0, # only one group + 0: lambda dt: 0, # only one group "monthly": lambda dt: (dt.year, dt.month), "daily": lambda dt: (dt.year, dt.month, dt.day), "MMDD": lambda dt: (dt.month, dt.day), }[self.group_by] - # assert False, self.grouper_key - def format(self, x): return x.isoformat() diff --git a/climetlab/version b/climetlab/version index f9b0c0dc..3f2bb467 100644 --- a/climetlab/version +++ b/climetlab/version @@ -1 +1 @@ -0.18.14 +0.18.15