# Raster to Numpy Array - No data values

I have several single band, 32 bit float raster datasets (fgdbr) that i want to use to build a raster stack (depth) in numpy by doing something like this dv = np.dstack((d_array, v_array))

With reference to the code snippet below,

import arcpy
d = r'P:\Sample.gdb\D_0100yr_Max'
dr  = arcpy.Raster(d)
dr.minimum # returns  0.000562695786356926
dr.maximum # returns 2.8690600395202637
dr.noDataValue # prints nothing
dr.pixelType # returns F32

d_array = arcpy.RasterToNumPyArray(dr.catalogPath, "#", "#", "#", dr.noDataValue)

d_array.max() # returns 2.86906
d_array.min() # returns -3.4028231e+38

If dr.noDataValue prints nothing, where does the RasterToNumpyArray function read the no data value from such that d_array.min() returns -3.4028231e+38 ?

• I think you didn't determine constant value for "NoData" I know in ArcGIS values (usually 0 or -9999) are representing "NoData" therefore the minimum value is correct and you have not any "NoData" in your raster. may be "ndppy" would be helpful, I'm not sure but I hope nasa-develop.github.io/dnppy/index.html Commented Nov 15, 2016 at 5:51

this is a sample code I found in ESRI Documents. as you see in code, defined a constant value for "NoData"

import arcpy
import numpy

# Get input Raster properties
inRas = arcpy.Raster('C:/data/inRaster')
lowerLeft = arcpy.Point(inRas.extent.XMin,inRas.extent.YMin)
cellSize = ras.meanCellWidth

# Convert Raster to numpy array
arr = arcpy.RasterToNumPyArray(inRas,nodata_to_value=0)

# Calculate percentage of the row for each cell value
arrSum = arr.sum(1)
arrSum.shape = (arr.shape[0],1)
arrPerc = (arr)/arrSum

#Convert Array to raster (keep the origin and cellsize the same as the input)
newRaster = arcpy.NumPyArrayToRaster(arrPerc,lowerLeft,cellSize,
value_to_nodata=0)
newRaster.save("C:/output/fgdb.gdb/PercentRaster")