-
Notifications
You must be signed in to change notification settings - Fork 16
Downscaling
The downscaling methods in gridpp interpolates data on one grid to another (usually higher resolution) grid.
Downscaling methods require Grid
objects that describe the metadata of the gridpoints.
This downscaler uses the closest neighbour for each point in the fine grid. The approach will give box like fields if the output field is much higher resolution than the input field. The advantage of the method is that if the values in the input field are physically realistic, then the values in the output field are also realistic.
ovalues = gridpp.nearest(igrid, ogrid, temp_analysis[:, :, 0])
Uses the four nearest neighbours and interpolates bilinearly between those.
ovalues = gridpp.bilinear(igrid, ogrid, temp_analysis[:, :, 0])
Some meteorological variables such as temperature change predictably with elevation. When a high resolution topography is available, coarse resolution models can be downscaled by fitting the variable to the new topography. Currently, the API supports a constant elevation gradient:
gradient = -0.0065 # C/m
ovalues = gridpp.simple_gradient(igrid, ogrid,
temp_analysis[:, :, 0], gradient)
A more advanced methods can be used, where the gradient is allowed to vary dynamically in space. First, compute a local gradient:
gradient_type = gridpp.LinearRegression
half_width = 5
min_num = 10
min_range = 100 # m
default_gradient = -0.0065 # C/m
gradient = gridpp.calc_gradient(igrid.get_elevs(), temp_analysis[:, :, 0], gradient_type, half_width, min_num, min_range, default_gradient)
This creates a vertical gradient for each gridpoint. This can then be applied to the downscaled grid:
ovalues = gridpp.full_gradient(igrid, ogrid, temp_analysis[:, :, 0], gradient)