FutureWarning:与 'None' 错误的比较
FutureWarning: comparison to 'None' error
我是 Python 的新手,我在互联网上搜索过帮助,但没有解决我眼前的问题,所以希望得到任何反馈。有谁知道为什么我会收到此警告?
我已经下载并尝试使用开源模块 (CloudRasterizer.py) 从 EcosynthAerial 工具箱 Windows 编辑点云 (LiDAR/spatial 数据)。在模块中有一个 class 'CloudRasterizer',我将从中调用特定的方法。但是,每当我尝试启动 class 时,我都会收到以下警告,并且无法通过此...
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
这是模块代码的开头:
_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 在 post 进程文件夹中):
C:\Users\MillerEF\Documents\Miniconda2\Lib\site-packages\ecosynth\postprocess
非常感谢您的帮助!
在模块的第 290 行,将 if (xyzrgb_array==None):
更改为 if (xyzrgb_array is None):
。
我是 Python 的新手,我在互联网上搜索过帮助,但没有解决我眼前的问题,所以希望得到任何反馈。有谁知道为什么我会收到此警告?
我已经下载并尝试使用开源模块 (CloudRasterizer.py) 从 EcosynthAerial 工具箱 Windows 编辑点云 (LiDAR/spatial 数据)。在模块中有一个 class 'CloudRasterizer',我将从中调用特定的方法。但是,每当我尝试启动 class 时,我都会收到以下警告,并且无法通过此...
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
这是模块代码的开头:
_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 在 post 进程文件夹中):
C:\Users\MillerEF\Documents\Miniconda2\Lib\site-packages\ecosynth\postprocess
非常感谢您的帮助!
在模块的第 290 行,将 if (xyzrgb_array==None):
更改为 if (xyzrgb_array is None):
。