Skip to content
Snippets Groups Projects
Commit 5bac26ae authored by (no author)'s avatar (no author)
Browse files

adding a check to stop some of the calculated statistics from crashing when a...

adding a check to stop some of the calculated statistics from crashing when a variable is all fill data

git-svn-id: https://svn.ssec.wisc.edu/repos/glance/trunk@228 8a9318a1-56ba-4d59-b755-99d26321be01
parent e3192066
No related branches found
No related tags found
No related merge requests found
...@@ -567,14 +567,15 @@ class GeneralStatistics (StatisticalData) : ...@@ -567,14 +567,15 @@ class GeneralStatistics (StatisticalData) :
# grab the valid data for some calculations # grab the valid data for some calculations
tempGoodData = dataObject.data[dataObject.masks.valid_mask] tempGoodData = dataObject.data[dataObject.masks.valid_mask]
noData = (tempGoodData.size <= 0)
# fill in our statistics # fill in our statistics
self.missing_value = dataObject.select_fill_value() self.missing_value = dataObject.select_fill_value()
self.max = np.max(tempGoodData) self.max = np.max(tempGoodData) if not noData else np.nan
self.min = np.min(tempGoodData) self.min = np.min(tempGoodData) if not noData else np.nan
self.mean = np.mean(tempGoodData) self.mean = np.mean(tempGoodData) if not noData else np.nan
self.median = np.median(tempGoodData) self.median = np.median(tempGoodData) if not noData else np.nan
self.std_val = np.std(tempGoodData) self.std_val = np.std(tempGoodData) if not noData else np.nan
# also calculate the invalid points # also calculate the invalid points
self.spatially_invalid_pts_ignored = np.sum(dataObject.masks.ignore_mask) self.spatially_invalid_pts_ignored = np.sum(dataObject.masks.ignore_mask)
......
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