0

Is there an ArcGIS function to sample x% where x lies between 0 and 100, of a raster?

I do not want point sampling and ArcGIS functions seem to focus on point sampling.

For ArcGIS, I use version 10.2

--EDIT: Desired output: This output raster will have x% of cells selected randomly

  • I'm not exactly sure what you have in mind as "raster sampling". Do you mean raster resampling? Do you want statistics on raster cell values within polygons? – Jae Jul 20 '17 at 14:14
  • What's your desired output, a vector of values from the sampled cells? – alaybourn Jul 20 '17 at 17:20
  • no, I just want a raster as output. This output raster will have x% of cells selected randomly – user1186 Jul 20 '17 at 17:58
  • Please use the edit button beneath your question to revise it with any requested clarifications. – PolyGeo Jul 20 '17 at 20:31
1

I tested following on raster called "DEM", which has 79540 cells with data and a lot of cells with NO DATA:

arcpy.CreateRandomRaster_management("../SCRATCH", INT_R", "UNIFORM 0.0 1.0")
arcpy.gp.RasterCalculator_sa('Con("INT_R" <= 0.50,"DEM")',"..SCRATCH/percent")

Output raster has 39955 cells with data. The ratio 39955/79540 = 0.502, i.e. result contains 50% of cells from original raster

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.