0

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!

Ethan Miller
  • 13
  • 1
  • 3
  • 1
    Check that the code you downloaded is compatible with the version of Python you are using. For example, you might be using Python 3.5 but the code might be written for 2.7 or earlier. – cdarke Feb 02 '16 at 21:13
  • Thanks for the response @cdarke, both the code and Python are 2.7 – Ethan Miller Feb 02 '16 at 21:24
  • Are you saying a warning is stopping your application? – Padraic Cunningham Feb 02 '16 at 21:26
  • The warning is valid, you should report it as a bug. You can suppress it, see https://docs.python.org/2/library/warnings.html, "Temporarily Suppressing Warning", or use the `-W` command-line option. See also http://stackoverflow.com/questions/14463277/how-to-disable-python-warnings – cdarke Feb 02 '16 at 21:29
  • @PadraicCunningham, it's not stopping it but when I call on one of the methods later to filter the array and then print the result I get 'None.' I thought that the two error messages may be linked. Would this warning message affect later processes? – Ethan Miller Feb 02 '16 at 21:33
  • @EthanMiller, I really doubt it, a warning is just that. You have not assigned anything to the result of an inplace operation anywhere? – Padraic Cunningham Feb 02 '16 at 21:37
  • @PadraicCunningham - No, I haven't, sounds like it's more of an inconvenient bug rather than a real problem with future coding--since I really just need this module to run one function. I appreciate the help and patience--I'm teaching myself right now so I still have a lot to learn. – Ethan Miller Feb 03 '16 at 02:05
  • No worries, if you post a link to the library i will have a look at it and see if I can replicate. – Padraic Cunningham Feb 03 '16 at 02:21
  • Here is the library: https://bitbucket.org/ecosynth/ecosynthaerial/overview I am working with the CloudRasterizer module within the postprocess folder. There is a test .txt file to use under tests>files>test_set_hr20130826>Outputs – Ethan Miller Feb 03 '16 at 12:29
  • http://stackoverflow.com/questions/33954216/comparison-to-none-will-result-in-an-elementwise-object may be helpful. – Brian Minton Feb 09 '17 at 14:07

1 Answers1

0

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

zondo
  • 19,901
  • 8
  • 44
  • 83