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

Fixed bug on climatological percentile

parent 690e315c
......@@ -246,23 +246,15 @@ class ClimatologicalPercentile(Diagnostic):
Log.warning('Different number of realizations in the data used by diagnostic {0}', self)
def _get_value_interval(self, data_cube):
if self.check_min_value:
if self.check_max_value:
for time_slice in data_cube.slices_over('time'):
for value in time_slice.data.flat:
if value < self.min_value:
self.min_value = value
if value > self.max_value:
self.max_value = value
else:
for time_slice in data_cube.slices_over('time'):
if self.check_min_value or self.check_max_value:
for time_slice in data_cube.slices_over('time'):
if self.check_min_value:
file_min = np.amin(time_slice.data)
if self.min_value is None:
self.min_value = file_min
self.max_value = min(self.min_value, file_min)
else:
if self.check_max_value:
for time_slice in data_cube.slices_over('time'):
self.min_value = min(self.min_value, file_min)
if self.check_max_value:
file_max = np.amax(time_slice.data)
self.max_value = max(self.min_value, file_max)
......
......@@ -178,13 +178,13 @@ class DaysOverPercentile(Diagnostic):
for perc in ClimatologicalPercentile.Percentiles:
iris.FUTURE.netcdf_no_unlimited = True
temp = TempFile.get()
iris.save(results_over[perc].merge_cube(), temp, zlib=True)
iris.save(results_over[perc].merge_cube(), temp, zlib=True, unlimited_dimensions=['time'])
Utils.rename_variables(temp, {'dim2': 'ensemble', 'dim1': 'ensemble'},
must_exist=False, rename_dimension=True)
self.days_over_file[perc].set_local_file(temp, rename_var='daysover')
temp = TempFile.get()
iris.save(results_below[perc].merge_cube(), temp, zlib=True)
iris.save(results_below[perc].merge_cube(), temp, zlib=True, unlimited_dimensions=['time'])
Utils.rename_variables(temp, {'dim2': 'ensemble', 'dim1': 'ensemble'},
must_exist=False, rename_dimension=True)
self.days_below_file[perc].set_local_file(temp, rename_var='daysbelow')
......
......@@ -324,7 +324,7 @@ class Utils(object):
hash_file.write(hash_value)
hash_file.close()
return hash
return hash_value
@staticmethod
def _get_hash_filename(filepath):
......
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