Skip to content
Snippets Groups Projects
Commit 25325a97 authored by Eva Schiffer's avatar Eva Schiffer Committed by GitHub
Browse files

Merge pull request #14 from adesmet-ssec/scalar-stats

Statistics now work on scalar values (0d arrays)
parents 0c15f78c 7470eaa5
No related branches found
No related tags found
No related merge requests found
......@@ -160,6 +160,23 @@ class DataObject (object) :
return DataObject(self.data.copy(), fillValue=self.fill_value, ignoreMask=self.masks.ignore_mask,
overrideFillValue=self.override_fill_value, defaultFillValue=self.default_fill_value)
def holding_array(self):
"""
Return a version of myself where self.data is always an array.
Suitable for code paths that insist on an array.
If self.data is already an array, returns self.
If self.data is a simple scalar, copies myself, changing the copy's
self.data to be an array with a single value, and return the copy.
"""
if len(self.data.shape) != 0:
return self
copy = self.copy()
copy.data = np.array([self.data.item()])
copy.self_analysis()
return copy
def self_analysis(self, re_do_analysis=False) :
"""
......
......@@ -1064,6 +1064,8 @@ class StatisticalInspectionAnalysis (StatisticalData) :
"""
build and set all of the statistics sets
"""
dataObject = dataObject.holding_array()
self.general = GeneralStatistics( dataObject=dataObject,
doExtras=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment