-
Notifications
You must be signed in to change notification settings - Fork 18
Gridpp API
Thomas Nipen edited this page Apr 3, 2020
·
44 revisions
Under development
import gridpp
import numpy as np
data = np.random.rand([100, 100])
radius = 7
data_mean = gridpp.neighbourhood(data, radius, 'mean')The functions bilinear and nearest can be used to interpolate from one grid to another.
import gridpp
import numpy as np
# Input grid definitions
lons, lats = np.meshgrid(np.arange(0, 30), np.arange(0, 20))
grid = gridpp.Grid(lats, lons)
data = np.random.rand(lons.shape[0], lons.shape[1])
# Output grid definitions
lons_d, lats_d = np.meshgrid(np.arange(0, 30, 0.1), np.arange(0, 20, 0.1))
grid_d = gridpp.Grid(lats_d, lons_d)
data_downscaled = gridpp.bilinear(grid, data, grid_d)import gridpp
import numpy as np
# Input grid definitions
lons, lats = np.meshgrid(np.arange(0, 30), np.arange(0, 20))
grid = gridpp.Grid(lats, lons)
data = np.random.rand(lons.shape[0], lons.shape[1])
# Output points definitions
lons_d = np.random.rand(20) * 30
lats_d = np.random(20) * 30
points = gridpp.Points(lats_d, lons_d)
data_downscaled = gridpp.bilinear(grid, data, points)