FutureWarning:与'None'错误比较

时间:2016-02-02 21:00:20

标签: python class module point-clouds miniconda

我是Python的新手,已经在互联网上寻求帮助,没有什么能解决我的直接问题,所以会喜欢任何反馈。有谁知道为什么我会收到这个警告?

我已下载并尝试使用开源模块(CloudRasterizer.py)从Windows的EcosynthAerial工具箱编辑点云(LiDAR /空间数据)。在模块中是一个类'CloudRasterizer',我将从中调用一个特定的方法。但是,每当我尝试启动课程时,我都会收到以下警告,并且无法通过此...

  

在Python命令行中

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:与'None'的比较将导致将来进行元素对象比较。 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

以下是模块代码的开头:

_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)

如果有帮助,这里是我导入CloudRasterizer时的当前目录(CloudRasterizer.py位于后期处理文件夹中):

C:\用户\ MillerEF \文件\ Miniconda2 \ LIB \站点包\ ecosynth \后处理

非常感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

在模块的第290行,将if (xyzrgb_array==None):更改为if (xyzrgb_array is None):