@@ -227,16 +227,24 @@ def processAlgorithm(self, progress):
227
227
outFeat .setGeometry (geom )
228
228
229
229
attrs = f .attributes ()
230
- attrs .insert (idxMin , float (masked .min ()))
231
- attrs .insert (idxMax , float (masked .max ()))
232
- attrs .insert (idxSum , float (masked .sum ()))
230
+ v = float (masked .min ())
231
+ attrs .insert (idxMin , None if numpy .isnan (v ) else v )
232
+ v = float (masked .max ())
233
+ attrs .insert (idxMax , None if numpy .isnan (v ) else v )
234
+ v = float (masked .sum ())
235
+ attrs .insert (idxSum , None if numpy .isnan (v ) else v )
233
236
attrs .insert (idxCount , int (masked .count ()))
234
- attrs .insert (idxMean , float (masked .mean ()))
235
- attrs .insert (idxStd , float (masked .std ()))
237
+ v = float (masked .mean ())
238
+ attrs .insert (idxMean , None if numpy .isnan (v ) else v )
239
+ v = float (masked .std ())
240
+ attrs .insert (idxStd , None if numpy .isnan (v ) else v )
236
241
attrs .insert (idxUnique , numpy .unique (masked .compressed ()).size )
237
- attrs .insert (idxRange , float (masked .max ()) - float (masked .min ()))
238
- attrs .insert (idxVar , float (masked .var ()))
239
- attrs .insert (idxMedian , float (numpy .ma .median (masked )))
242
+ v = float (masked .max ()) - float (masked .min ())
243
+ attrs .insert (idxRange , None if numpy .isnan (v ) else v )
244
+ v = float (masked .var ())
245
+ attrs .insert (idxVar , None if numpy .isnan (v ) else v )
246
+ v = float (numpy .ma .median (masked ))
247
+ attrs .insert (idxMedian , None if numpy .isnan (v ) else v )
240
248
if hasSciPy :
241
249
attrs .insert (idxMode , float (mode (masked , axis = None )[0 ][0 ]))
242
250
0 commit comments