I have computed Hydrologic Sensitivity Index (HSI) as a raster for a region using slope, Hydraulic conductivity, Depth to the Restrictive Layer and Flow accumulation. All the files are in rasters of same pixel size. The rasters are float type rasters.
Now, I would like to plot Hydraulic conductivity vs HSI, Depth vs HSI for every pixel etc.. In other words, for each pixel, I need the computed HSI value, Depth, Hydraulic conductivity, and Flow accumulation in a column or dataframe.
How can I accomplish this in ArcMap?
What I tried:
- First I tried to use the Combine tool. But Combine tool doesn't seem to work with float raster even if I convert it into integers there will be too many unique values to make this combination.
What if two different pixels had same values?
In that case, I do not think this tool will show those two pixel separately (right?).
- Convert each Raster to Int Raster than to Polygon than use Union tool. I couldn't accomplish this because the HSI raster file is very detailed and takes too long to convert to polygon and seems to crash in the middle.
What I think could work:
- I know there is a way to convert Raster data into a Numpytable. This way I will have four separate Numpy table for each of the four data but how will I map the value in such a way that i ensure that they are for the same pixel?
I know I can use arcpy.Describe.polygon.OIDFieldName
to create id in Polygon but is there similar tool for Raster. But i am also not sure when I am using this tool for four different raster.
Will the pixel in the same location get the same oid values?
arcpy.NumpyArrayToRaster()
4 times,np.dstack()
to create a(y_size, x_size, 4)
-shaped array, thenstack.reshape((-1, 4))
to achieve your 4 columnsnp.dstack()
how does the function know that it is maping the values for the same pixel without us providing any id to compare to (like we do while doing a polygon join)?dstack()
will always preserve the order as appropriate (see the examples)arcpy.RasterToNumpyArray()
i get extremely large negative values in my array. I checked my Raster file and it seems to be fine. Also, all three raster shows exactly the same value and all large negative number. 2.i ignored the large values and went to the next step. I was able to stack the values from three raster together but i couldnt convert the array into gistable. Is there a easy way to export the final array out of arcpy environment? Any suggestions?