I'm attempting to re-grid a 0.05 X 0.05-degree dataset to a 1X1-degree dataset, but am having problems where I encounter NaN values in the oceans.
Once you click on the link, you can see that a number of grid cells on the northern coast of Eurasia and in the Far East of Russia are supposed to be colored blue, but they are colored red because when they are interpolated, there are enough NaNs from the nearby water grid cells in the calculation that the entire grid cell is given a NaN value. I'm using xarray's interp function to do this and I'm wondering if there is a way for the function to ignore the NaNs in this region and only average and interpolate those 1X1 grid cells using only the 0.05X0.05 grid cells that have actual values. I've included my code below.
origfilin = 'CESM Files/b.e11.B20TRC5CNBDRD.f09_g16.001.clm2.h0.TSA.192001-200512_dyn_150_100_50_no_reg.nc'
orignc = nc.Dataset(origfilin)
lats = orignc.variables['lat'][:]
lons = orignc.variables['lon'][:]
filin = 'PZI.nc'
PZIdata = xr.open_dataset(filin)
PZI_interp = PZIdata.interp(method='linear',lat=lats, lon=lons)
PZI = np.asarray(PZI_interp.Band1)
Thank you in advance.