Commit 29e95e28 authored by Klaus Zimmermann's avatar Klaus Zimmermann
Browse files

Store original parameters instead of converting units post-hoc (fixes #134)

parent 02dde888
......@@ -42,7 +42,5 @@ class PointLocalAggregator(Aggregator):
if proposed_standard_name is not None:
cube.attributes['proposed_standard_name'] = proposed_standard_name
for extra_coord in self.index_function.extra_coords:
change_units(extra_coord,
self.output_metadata.units, unit_standard_name)
cube.add_aux_coord(extra_coord)
return cube
......@@ -67,7 +67,7 @@ class CountOccurrences:
self.lazy_condition = DASK_OPERATORS[condition]
self.standard_name = None
self.units = Unit('days')
self.extra_coords = [threshold]
self.extra_coords = [threshold.copy()]
def prepare(self, input_cube):
change_units(self.threshold,
......@@ -95,7 +95,7 @@ class FirstOccurrence:
self.standard_name = None
self.units = Unit('days')
self.NO_OCCURRENCE = np.inf
self.extra_coords = [threshold]
self.extra_coords = [threshold.copy()]
def prepare(self, input_cube):
change_units(self.threshold,
......@@ -143,7 +143,7 @@ class LastOccurrence:
self.standard_name = None
self.units = Unit('days')
self.NO_OCCURRENCE = -np.inf
self.extra_coords = [threshold]
self.extra_coords = [threshold.copy()]
def prepare(self, input_cube):
change_units(self.threshold,
......@@ -192,7 +192,7 @@ class SpellLength:
self.reducer = NUMPY_REDUCERS[reducer]
self.standard_name = None
self.units = Unit('days')
self.extra_coords = [threshold]
self.extra_coords = [threshold.copy()]
def prepare(self, input_cube):
change_units(self.threshold,
......@@ -269,7 +269,7 @@ class ThresholdedStatistics:
self.reducer = NUMPY_REDUCERS[reducer]
self.lazy_condition = DASK_OPERATORS[condition]
self.lazy_reducer = DASK_REDUCERS[reducer]
self.extra_coords = [threshold]
self.extra_coords = [threshold.copy()]
def prepare(self, input_cube):
change_units(self.threshold,
......@@ -300,7 +300,7 @@ class TemperatureSum:
else:
self.fun = lambda d, t: np.maximum(t - d, 0)
self.lazy_fun = lambda d, t: da.maximum(t - d, 0)
self.extra_coords = [threshold]
self.extra_coords = [threshold.copy()]
def prepare(self, input_cube):
change_units(self.threshold,
......
Supports Markdown
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