AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Raster calculation1/7/2024 ![]() ![]() Here we create a random sample of cells, create an empty raster and pipe the sum of rasters 1 and 2 (in the stack) based on the random sample cell index. If you are wanting to apply a function to a limited random selection of cells, you could create a random sample of the raster that would be used as an index. Here is an example that grabs a random sample of n size, across the raster layers values and sums them. If you are wanting a random sample of the values across rasters, for every cell, you could write a function that is passed to calc. In this case, rasters 1 and 3 in the stack would be the only ones summed. If you're working with a raster with an attribute table (and it sounds like you are), a better tool might be the Field Calculator, which can incorporate python scripts to process if/else statements. I am going to take a few guesses on summing specified rasters in the stack, drawing a random sample, across rasters to be summed and finally, drawing a random sample of cells to be summed.įor a sum on specified rasters in a stack, you can just index what you are after in the stack using a double bracket. In the future, please try to be more clear on what your expected outcome is.īased on your code, I really don't know what you are getting at. Licensed under cc by-sa 3 Raster Calculator tool does the same job in Model Builder However, there are a number of different ways to use Raster Calculator functions in Python, as shown in the example below With ArcFuels10, complex raster value replacements are easily made on the individual raster data components, rather than on the landscape. Why are you coercing into arrays? You can easily collapse a raster into a vector but, that does not even seem necessary here.
0 Comments
Read More
Leave a Reply. |