Search code examples
pythonclassmodulepoint-cloudsminiconda

FutureWarning: comparison to 'None' error


I'm new to Python and have scoured the internet for help and nothing has solved my immediate issue, so would love any feedback. Does anyone know why I would be getting this warning?

I have downloaded and am trying to use an open-source module (CloudRasterizer.py) to edit point clouds (LiDAR/spatial data) from the EcosynthAerial toolbox with Windows. Within the module is a class 'CloudRasterizer', from which I will call a specific method. However, whenever I try to initiate the class I get the following warning, and can't get past this...

In the Python command line

EastAreaTest = np.loadtxt("C:\....TestFile.txt", use cols=(0,1,2,3,4,5))  
EastAreaArray = np.array(EastAreaTest)  
Import CloudRasterizer  
from CloudRasterizer import CloudRasterizer  
RasterizedTest = CloudRasterizer(EastAreaArray)

CloudRasterizer.py:290: FutureWarning: comparison to 'None' will result in an elementwise object comparison in the future. If (xyzrgb_array==None): get_aoi time:0.0 subset_cloud_ array time: 0.0 get_aoi time: 0.015 cloud_to_grid time: 0.015

Here is the beginning of the module code:

_all__ = ['CloudRasterizer']

    import time

    import numpy as np
    import pylab as pl
    import scipy.stats as stats


    class CloudRasterizer(object):
    """
         CloudRasterizer Class for processing Point Cloud and enabling 2D analysis

    :param np.array xyzrgb_array: XYZRGB numpy array
    :param int resolution: (Optional) grid size relative to units of
        point cloud (assumed to be meters)
    :pararm list aoi: (Optional) [xMin, xMax, yMin, yMax, zMin, zMax]

    :var int resolution: grid size relative to units of point cloud
    :var np.array cloud_array: points in given AOI
    :var int xMin:
    :var int yMin:
    :var int zMin:
    :var np.array grid: 2D grid of arrays filled with XYZRGB points

    """
    def __init__(self, xyzrgb_array, resolution=1):
        """

        """
        self.aoi = self.get_aoi(xyzrgb_array=xyzrgb_array)
        self.resolution = resolution
        self.cloud_array = self.subset_cloud_array(xyzrgb_array, self.aoi)
        self.grid = self.cloud_to_grid(self.cloud_array, resolution)

And if it helps, here is my current directory when I import CloudRasterizer (CloudRasterizer.py is in the post process folder):

C:\Users\MillerEF\Documents\Miniconda2\Lib\site-packages\ecosynth\postprocess

Thanks so much for any help!


Solution

  • On line 290 in the module, change if (xyzrgb_array==None): to if (xyzrgb_array is None):.