-
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. A simple method for downscaling is to use a constant elevation gradient:
gradient = -0.0065 # C/m
ovalues = gridpp.simple_gradient(igrid, ogrid, temp_analysis[:, :, 0], gradient)
Griddpp also supports downscaling using an elevation gradient that varies from gridpoint to gridpoint. An elevation gradient can be computed by looking at how temepature varies with elevation in a neighbourhood surrounding a given point. You can use the calc_gradient
function to compute the 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)
The full_gradient
function also supports downscaling using gradients with respect to the land_area_fraction.
The smart neighbour approach picks a nearby gridpoint from the coarse grid that has similar characteristics to the lookup point. The nearest neighbour may for example not be at the same elevation as the lookup point.
This method requires you to specify how two points are considered to be similar. We use a structure function to define this. For more information, see the section on structure function under the optimal interpolation description. The structure function defines the correlation between two points, and the smart downscaling method will pick the nearby points with the highest correlation.
It is important to fine-tune the horizontal and vertical scales. Longer horizontal scales will allow the method to find points further away. However, picking a far away point can be problematic if there are horizontal gradients in the field. Another parameter is the number of neighbours to average. If this is set to 5, then the 5 best neighbours will be averaged. This will generally be more robust.
Here is an example of a downscaling method that looks for smart neighbours where the horizontal scale of 10km and vertical scale of 100m:
structure = gridpp.BarnesStructure(10000, 100)
ovalues = gridpp.smart(igrid, ogrid, temp_analysis[:, :, 0], structure)