I have a raster dataset containing z values. Besides this i have a shapefile with +/- 50.000 records. Each record represents an area of 400m2. For each record i would like to get the maximum height within the record. Using zonal statistics gives me the MAX z value of the raster within each record of the shapefile. To rule out outlyers in the rasterdataset instead of the maximum value of a cell within each record i would like the quantile 99% value. I reckon this should be possible but I cant seem to figure out how. Im guessing pythons numpy.quantile will be needed.
You have to convert the raster to a numpy array (arcpy.da.RasterToNumPyArray(….)
and if you have nodata values, then you should be using the 'nan' versions of either the percentile or quantile
numpy.nanpercentile — NumPy v1.16 Manual
numpy.nanquantile — NumPy v1.16 Manual
otherwise, their non-nan versions are fine.