Skip to content

Observation gridding

Thomas Nipen edited this page Oct 16, 2022 · 4 revisions

Gridpp includes functions to take observations at points and interpolate them onto a grid, also called gridding.

Gridding functions

The gridding function takes all observations within a radius of a gridpoint, and aggregates the using a statistic (e.g. mean):

radius = 30000    # m
min_num = 5
statistic = gridpp.Mean
gridpp.gridding(igrid, points, temp_analysis[:, :, 0], radius, min_num, statistic)

A NaN value will be used in gridpoints where there are fewer than min_num observations within the radius.

The gridding_nearest function assigns each observation to its nearest gridpoint. The resulting gridded value is then the aggregation of all observations assign to the gridpoint.

min_num = 5
statistic = gridpp.Mean
gridpp.gridding(igrid, points, temp_analysis[:, :, 0], min_num, statistic)

This differs from gridding in that each observation is only used once. The gridding will in general let you create a smoother field, by increasing the radius argument.

Counting functions

Gridpp also has functions for count the number of observations within a radius. The following counts, for each gridpoint, how many points are within the radius:

radius = 30000 # m
gridpp.count(points, igrid, radius)

Reversing the first two arguments computes the number of gridpoints that are close to each point:

gridpp.count(igrid, points, radius)

Distance functions

You can also compute the distance to the nearest point, for each gridpoint:

radius = 30000 # m
gridpp.distance(points, igrid, radius)

The first two arguments can also be reversed to compute the distance to the nearest gridpoint, for each point.

Clone this wiki locally