I would like to downscale netcdf data from 0.5 degree to 0.25 (or lower) resolution by simply creating new finer resolution grid cells that have the same value as the coarser resolution cell. I have the foll. code which works fine for creating a coarser resolution file:
from mpl_toolkits.basemap import Basemap
from netCDF4 import Dataset
import numpy as np
import pdb
filename = '/Users/r/global_aug4.region.nc'
pdb.set_trace()
with Dataset(filename, mode='r') as fh:
lons = fh.variables['lon'][:]
lats = fh.variables['lat'][:]
biom = fh.variables['biomass'][:].squeeze()
lons_sub, lats_sub = np.meshgrid(lons[::4], lats[::4])
coarse = Basemap.interp(biom, lons, lats, lons_sub, lats_sub, order=1)
How do I create something which goes the other way i.e. from coarser to finer scale