I have a netCDF that looks like the following ad is available here:
import xarray as xr
ds=xr.open_dataset('merged_new.nc')
ds
The dataset has a spatial resolution of 300m
. The variable Forest
is a binary variable 0
or 1
.
For each pixel (point) I would like to count the sum of Forest
in a radius of 30km
(i.e. ~300 closest pixels). I would like to do a sort of moving windows that allow me to assign to each pixel the sum of Forest
in a radius of 30km
.
Ideally I would like to add a variable to the dataset called ForestSum
that is the sum of Forest
in the surrounding.
Is there a way to do this?