Interpolating data to the model gridΒΆ

For most interpolation operations where geo-located data are sampled to the model grid, Modflow-setup uses a barycentric (triangular) interpolation scheme similar to scipy.interpolate.griddata(). This n-dimensional unstructured method allows for interpolation between grids that are aligned with different coordinate references systems, as well as interpolation between unstructured grids. As described here, setup of the barycentric interpolation involves:

  1. Construction of a triangular mesh linking the source points

  2. Searching the mesh to find the containing simplex for each destination point

  3. Computation of barycentric coordinates (weights) that describe where each destination point is in terms of the n nearest source points (where n-1 is the number of dimensions)

  4. Computing the interpolated values at the destination points from the source values and the weights

Steps 1-3 are time-consuming. Therefore, for each interpolation problem, Modflow-setup performs these steps once and caches the results, so that step 4 can be repeated quickly on subsequent calls. This can greatly speed, for example, the computation of hydraulic conductivity or bottom elevation values for models with many layers, or interpolation of boundary conditions for models with many stress periods.

A few more notes:
  • Linear interpolation is the default method in most instances, except for recharge, which is often based on categorical data such as land cover and soil types, and therefore has nearest-neighbor as the default method.

  • The interpolation method can generally be specified explicitly for a given dataset by including a resample_method argument. Available methods are listed in the documentation for scipy.interpolate.griddata(). For example, if we wanted to override the 'nearest' default for the Recharge Package:

rch:
  options:
    print_input: True
    print_flows: False
    save_flows: True
    readasarrays: True
  source_data:
    # resample recharge from NetCDF file with time-series of grids
    recharge:
      filename: 'shellmound/net_infiltration__2000-01-01_to_2017-12-31__414_by_394.nc'
      variable: 'net_infiltration'
      length_units: 'inches'
      time_units: 'days'
      crs: 5070
      resample_method: 'linear'