gaussian_random_field.grf_module.gridding

Gridding functions for the GRF module.

Functions

grid_mesh_data(ds, mesh, grid_res_x, grid_res_y)

Interpolate mesh data onto a grid defined by xs and ys.

grid_mesh_data(ds: Dataset, mesh: SpdeMesh, grid_res_x: int, grid_res_y: int) → Dataset

Interpolate mesh data onto a grid defined by xs and ys.

Parameters:
  • ds (xr.Dataset) –

    The xarray dataset containing the mesh data to be gridded. This must have the following dimensions:

    • time

    • vertex_id (corresponding to the mesh vertices)

    The dataset must also contain any number of spatial variables, with dimensions (“time”, “vertex_id”).

  • mesh (SpdeMesh) – The SPDE mesh containing the vertices and triangles of the original data.

  • grid_res_x (int) – Number of grid points in the x-direction.

  • grid_res_y (int) – Number of grid points in the y-direction.

Returns:

A dataset containing the gridded data, with dimensions:

  • time

  • y

  • x

Each of the spatial variables in the input dataset will be interpolated onto the new spatial coordinates, with the same name and attributes. Any other variables will be copied to the output dataset as-is.

Return type:

xr.Dataset