I am using ArcGIS focal statistics tool to add spatial autocorrelation to a random raster to model error in DEMs. The input DEM has a 1.5m pixel size and the semivariogram exhibits a sill around 2000m. I want to make sure to model the extent of the autocorrelation in the input in my model.
Unfortunately, ArcGIS requires that the input kernel be in ASCII format, where the first line defines the size and the subsequent lines define the weights.
Example:
5 5
1 1 1 1 1
1 2 2 2 1
1 2 3 2 1
1 2 2 2 1
1 1 1 1 1
I need to generate a 1333x1333 kernel with an inverse distance weighting and immediately went to python to get this done. Is it possible to generate a matrix in numpy and assign values by ring? Does a better programmatic tool within numpy exist to generate a plain text matrix.
This is similar to this question, but I need to have a fixed central value and descending rings, as per the example above.
Note: I am a student, but this not a homework assignment...those ended years ago. This is a part of a larger research project that I am working on and any help (even just a nudge in the right direction) would be appreciated. The focus of this work is not programming kernels, but exploring errors in DEMs.
scipy.ndimage
with what you're doing) can be very capable if you understand how to "glue" a few lower-level functions together to do what you want. That having been said, the python community is still lacking a good kriging/flexible-interpolation-of-any-sort library, at the moment.