0

I am attempting to use the python lidar package function lidar.ExtractSinks(). I have a raster dataset that looks like the following.

enter image description here

Not a very useful image, but it gets the point across that I am only interested in the white area. The rest of it has been clipped, masked, or something to remove actual elevation values. This area is causing problems with the function.

At this stage, I have attempted to replace 0 values with nodata I believe based on another post using rasterio src.nodata = 0 # set the nodata value. The reason I think This worked is that my data histogram now looks like the following, whereas before the histogram showed that I had a huge number of cells of value 0.

enter image description here

Regardless of whether I apply this change to the black cells in the raster image, I receive the following error: AttributeError: module 'numpy' has no attribute 'float'., which can be traced back to a line in the source code of the function: max_elev = np.float(np.max(dem[dem != no_data])). This line is what makes me think this is a NoData cells issue. The documentation of the error suggests that np.float is deprecated and to use float instead, but this is not my code, so I cannot change it.

Any suggestions as to how to get around this, or if I am even correct about the issue?

Also, if it would be helpful to post more of the code I have used please let me know.

Thanks!

Max Duso
  • 305
  • 1
  • 4
  • 15
  • Do you happen to have a file named `numpy.py` somewhere in your project? The actual `numpy` module **does** have a `float` attribute, so that error suggests something has somehow imported the wrong thing. – larsks Feb 10 '23 at 20:45
  • @larsks I believe that the issue is that in the source code it is referred to as `numpy.float` whereas the new syntax is just `float` . I so have the source code from here: https://github.com/giswqs/lidar/blob/master/lidar/filling.py and am just trying to figure out how to alter it and then refer to the altered version from my script – Max Duso Feb 10 '23 at 20:54

0 Answers0