I have read the relevant PySal documentation and I still have not found a way to solve this problem. Basically, my goal is to compute the average value in contiguous cells for each cell in a raster file but only for valid contiguous cells. My raster file is made up of both land and water cells but I only want to work with the land cells. When I compute spatial lags, however, values from water cells are introduced. Is there any way to modify the weights so that water cells are automatically given a zero and not factored into the spatial lag calculation?
Thanks so much!