Select to view content in your preferred language

Creating different normal rasters within each entry of a polygon shapefile

2753
10
05-31-2010 06:37 PM
AdamKilpatrick
Emerging Contributor
Howdy

I have a polygon shapefile (of model paddocks...I'm making several models of arid rangelands to test some methodologies), made up of 400 square paddocks in a 20 by 20 grid arrangement. The idea with this model is that each paddock in the polygon shp has a different value, ranging from 1 to 400.

I need to create a raster that covers the entire shp. Within the extent of each paddock, the cells or pixels of the raster need to have a normal distribution with a mean equal to the value of the paddock (standard deviation should be about 10% of mean).

I'm having a bit of trouble finding how to create this...I'm resorting to python scripting of loops to help.

I can create a normal raster of each paddock within the shp, using the "create constant raster" tool, after I've selected that paddock in the loop. From what I can tell, this makes a normal raster with a mean of 0 (zero), and a standard deviation of, from what I can tell visually, 1. There aren't any options (unfortunately) with this tool to set your own mean and s.d. (Seriously...why not!).

Anyone have any ideas for working around this issue? I'm thinking of somehow normalizing (hehe) these "normal" rasters to values of a range of 0 to 1 (with subsequent mean of 0.5), and then doing a multiplication by twice the paddock value. I need to get the minimum and maximum values of the normal raster first though (then do a calculation somehow of (x-min)/(max-min) to do the 0 to 1 normalization. Then do the 2*paddock value multiplication. I'm not sure how to script either of these. At the end of the loop I'll merge the rasters that I've created for each paddock into one raster of the entire shapefile.

Any help would be greatly appreciated...this is my first foray into creating a python script...and I'm a fair bit out of my depth.
0 Kudos
10 Replies
DanPatterson_Retired
MVP Emeritus
I discovered that you could spend a lifetime studying random number generators and there are rabidly held beliefs as to which is the best BUTapparently MERSENNE_TWISTER, which is a pseudo-random number generator gets a relucant nod in many quarters (as long as you aren't doing cryptography).  In any event, Python nods to this one in its stand "random" module, so it is good enough for me.   I will defer to others to comment on the merits or lack thereof of the various generators.  But as Bill has suggested several times in the above threads....testing is important if the results are to have any value.
0 Kudos