I want to calculate resistance distance based on circuit theory for a set of species for the city of Berlin, GER. For the city area I use land cover, sealed soil and building height data. This data is freely available via http://fbinter.stadt-berlin.de/fb/index.jsp. I use ArcMap 10.3.
As proposed by Koen et al. 2010 (http://dx.doi.org/10.1371/journal.pone.0011785 ). To sum up the paper, I want to create a buffer around Berlin to account for edge effects. This buffer should show the same frequency distribution of resistance values as the city raster.
Scenario - Frequency Distribution (low/medium/high)
Berlin - (46/50/98)
Random - (46/50/98)
I started an attempt using R 3.3.3 on MacOS 10.11.6. So far I can import the sealed.tif (which is the city area), transform to a matrix and get the frequency distribution. I then created a new randomized matrix with values from 0 to 100.
setwd("/Users/franzxaverpoellinger/Desktop/Statistics/Raster/raster") library(raster) library(sp) library(rgdal) library(raster) str_name<-'sealed.tif' sealed=raster(str_name) plot(sealed) # convert from .tif to a matrix sealed.matrix <- as.matrix(sealed) seal.cut = cut(sealed.matrix, breaks = seq(0, 100, by = 10), right=FALSE) seal.cut.freq = table(seal.cut) (seal.cut.freq/sum(seal.cut.freq))*100 # this is the aimed frequency # and now the same for the buffer .tif str_name.buffer <-'buffer.tif' buffer=raster(str_name.buffer) buffer.matrix <- as.matrix(buffer) str(buffer.matrix) # create a matrix the same size as buffer.hist new.buffer.matrix <- matrix(sample.int(100, size= 457*537, replace = TRUE), nrow = 457, ncol = 537) new.buffer.matrix buffer.cut = cut(new.buffer.matrix, breaks = seq(0, 100, by = 10), right=FALSE) buffer.cut.freq = table(buffer.cut) (buffer.cut.freq/sum(buffer.cut.freq))*100
Now I want the new.buffer.matrix to show the same frequency distribution of as does sealing.matrix. If I had the same distribution I would (somehow) go back from matrix to .tif and then just clip it to the extend that I need.