How to create a percentile raster from .gdb containing multiple rasters?

296
2
Jump to solution
03-11-2019 10:29 AM
Highlighted
New Contributor

Hi,

I am trying to create a 5th and 95th percentile raster from a geodatabase containing multiple rasters (ranging from 26-60 rasters per .gdb).  Essentially, I would like to perform the same function as cell stats (mean, max, median, etc) but calculating percentiles rather than simple stats.  I've seen a few threads on this matter (this one in particular seems useful: Pool of raster values to calculate percentile) but none that seem to address how to do make an output percentile raster using rasters located in a .gdb.  I haven't begun developing the code yet and wanted to solicit answers to these questions before beginning.  A few questions:

1. Is there a tool that can do this or will I need to develop Python code using numpy?

2. Is it easier to do this with rasters located inside a folder or can I perform this calculation with rasters located in a .gdb?

Any help would be greatly appreciated.  Thanks!

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
MVP Esteemed Contributor

with numpy, there is np.nanpercentile which accounts for nodata cells

How to calculate the percentile for each cell from timeseries raster 

A raster stack (3D) can be easily created

/blogs/dan_patterson/2018/02/06/cell-statistics-made-easy-raster-data-over-time 

and any statistic can be done.

If you have a ridiculously large data set, then it would be useful to split into chunks and read from a *.npy file using numpy memory management.  

As for your questions, the tools to make the raster stack are given in your thread.

Rasters in a gdb are not really the preferred rasters, but if that is all you have, just make sure you specify an output raster as a tif in a folder.  I would also np.save(…) your array in numpy format, they are very easy to work with for future work.

View solution in original post

2 Replies
Highlighted
MVP Esteemed Contributor

with numpy, there is np.nanpercentile which accounts for nodata cells

How to calculate the percentile for each cell from timeseries raster 

A raster stack (3D) can be easily created

/blogs/dan_patterson/2018/02/06/cell-statistics-made-easy-raster-data-over-time 

and any statistic can be done.

If you have a ridiculously large data set, then it would be useful to split into chunks and read from a *.npy file using numpy memory management.  

As for your questions, the tools to make the raster stack are given in your thread.

Rasters in a gdb are not really the preferred rasters, but if that is all you have, just make sure you specify an output raster as a tif in a folder.  I would also np.save(…) your array in numpy format, they are very easy to work with for future work.

View solution in original post

Highlighted
MVP Esteemed Contributor

resolved? or still open?

Reply
0 Kudos