I have a DEM of a crop canopy. It's pretty trivial in QGIS to draw a polygon and calculate the average or median height using zonal statistics. However that often underestimates the overal crop height due to averaging effects. A paper I read discusses taking the 99% centile of heights in the plot and taking the mean/median of that, which gives a much more comparable height measurement to that of a manual one. I realise this isn't possible using zonal statistics directly, but does anyone know how I might be able to do this with existing QGIS tools and plugins (raster calculator, GRASS etc)? e.g. calculate the 99th% height value in a plot, mask those that are below that and then calculate zonal statistics on the remaining pixels? Or is there a better way?