-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
kind/bugCategorizes issue related to bug.Categorizes issue related to bug.
Description
I have come across some slightly anomalous data (see CDAT/cdms#235 for details) that led to a completely masked array. But minmax reports very big values instead of masked
>>> genutil.minmax(U_avg)
(1.7976931348623157e+308, -1.7976931348623157e+308)
2 interesting things to note here:
1.7976931348623157e+308is the exact max value for IEEE real*8- the max reported above,
-1.797...is negative and therefore lower than the min...
Should minmax report (np.ma.masked, np.ma.masked) instead ?
The following lines generated masked data
>>> import cdms2, MV2, cdutil, genutil, numpy as np
>>> f = cdms2.open('/home/scratch01/jypeter/time_counter_bounds_pb.nc')
>>> U = f('U')
>>> f.close()
>>> genutil.minmax(U)
(-31.189350128173828, 23.517915725708008)
>>> U.shape
(10, 1, 90, 180)
>>> 10*90*180
162000
>>> MV2.count(U)
162000
>>> U_avg = cdutil.averager(U, axis='t')
>>> U_avg.shape
(1, 90, 180)
>>> MV2.count(U_avg)
0
>>> genutil.minmax(U_avg)
(1.7976931348623157e+308, -1.7976931348623157e+308)
>>> U_avg.min()
masked
>>> U_avg.max()
masked
Note that I also get the same crazy big values when working with some dummy data
>>> U.dtype
dtype('float32')
>>> U_avg.dtype
dtype('float64')
>>> dummy_ma = np.ma.zeros(U_avg.shape, U_avg.dtype)
>>> MV2.count(dummy_ma)
16200
>>> dummy_ma[...] = np.ma.masked
>>> MV2.count(dummy_ma)
0
>>> genutil.minmax(dummy_ma)
(1.7976931348623157e+308, -1.7976931348623157e+308)
>>> dummy_ma.min()
masked
>>> dummy_ma.max()
masked
Oh, I also get the same crazy big values when working with real*4 data
>>> dummy_ma = np.ma.zeros(U_avg.shape, np.float32)
>>> dummy_ma[...] = np.ma.masked
>>> MV2.count(dummy_ma)
0
>>> dummy_ma.dtype
dtype('float32')
>>> genutil.minmax(dummy_ma)
(1.7976931348623157e+308, -1.7976931348623157e+308)
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue related to bug.Categorizes issue related to bug.