0

I am trying to calculate percentiles with gdal_calc.py using my command line. I have a raster stack (11bands) and I would like to calculate the 0.85 percentile for each pixel over the entire stack (time).

Is there a way to do this?

Right now, I am using the numpy bindings of gdal_calc:

gdal_calc.py -A stack.vrt allBands=A --calc='nanpercentile(A.astype(int16),85,axis=0)' --outfile out.tif

I am trying to use the nanpercentile function from numpy. But I am not sure which parameters to use for axis and keepdims: https://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.nanpercentile.html#numpy.nanpercentile

I am getting an output with this call, which however looks entirely wrong (the pixels look warped - it seems like the axis parameter is wrong).

3
  • Is the output image a single band? May 10, 2017 at 19:26
  • Yes a single band should be the output
    – maRtin
    May 10, 2017 at 19:36
  • Could you solve it someway? I am on the same problem right now. GRASS r.quantile cannot be used with percentile parameter. Metadata maximum doesn't seem correct...
    – pnz1337
    Dec 29, 2017 at 14:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.