I am trying to perform an object-based classification using a python-based script with rsgislib. Although, when converting to dB, an error is appearing. Any ideas why is this happening?
Create and Calculate dB columns
ratDataset = gdal.Open(clumpsImg, gdal.GA_Update)
HHPow = rat.readColumn(ratDataset, 'HHPow')
HVPow = rat.readColumn(ratDataset, 'HVPow')
HHHVPow = rat.readColumn(ratDataset, 'HHHVPow')
HHdB = numpy.where(HHPow>0, 10*numpy.log10(HHPow), 0)
HVdB = numpy.where(HVPow>0, 10*numpy.log10(HVPow), 0)
HHHVdB = numpy.where(HHHVPow>0, 10*numpy.log10(HHHVPow), 0)
rat.writeColumn(ratDataset, "HHdB", HHdB)
rat.writeColumn(ratDataset, "HVdB", HVdB)
rat.writeColumn(ratDataset, "HHHVdB", HHHVdB)
ratDataset = None
And I keep getting the following error:
Writing Stats (Mean, ) to Output RAT
/data/3_to_5_copy/16_PerformObjClass.py:63: RuntimeWarning: divide by zero encountered in log10 HHdB = numpy.where(HHPow>0, 10numpy.log10(HHPow), 0) /data/3_to_5_copy/16_PerformObjClass.py:64: RuntimeWarning: divide by zero encountered in log10 HVdB = numpy.where(HVPow>0, 10numpy.log10(HVPow), 0) /data/3_to_5_copy/16_PerformObjClass.py:65: RuntimeWarning: divide by zero encountered in log10 HHHVdB = numpy.where(HHHVPow>0, 10*numpy.log10(HHHVPow), 0) Creating output image using input image
numpy.log10
, even non filtered data bynumpy.where
are computed so, if a0
value is in yourrat
columnsHHPow
,HVPow
orHHHVPow
, the warning appear.