windkit.spatial.clip_with_margin

windkit.spatial.clip_with_margin(obj_to_clip, obj_clipper, margin_dx_factor=5.0, cap_style=1, join_style=1)[source]

Clip a ‘raster’ or ‘cuboid’ dataset to the bounding box of another ‘raster’, ‘cuboid’, ‘stacked_point’, or ‘point’ dataset including a margin around that dataset to ensure several points are avaiable around the clipper dataset from the clipped one.

Parameters:
  • obj_to_clip (xarray Dataset or DataArray) – The dataset to clip

  • obj_clipper (xarray Dataset or DataArray) – The dataset to clip to

  • margin_dx_factor (float, optional) – The margin to add to the bounding box of the clipper dataset, by default 5.0, i.e. 5 times the grid spacing of the dataset to clip

  • cap_style (int, optional) – The cap style to use for buffering the bounding box of the clipper dataset, by default 1 (round buffering)

  • join_style (int, optional) – The join style to use for buffering the bounding box of the clipper dataset, by default 1 (round buffering)

Returns:

The clipped dataset

Return type:

xarray Dataset or DataArray