geodata.Cutout.mask

geodata.Cutout.mask#

geodata.Cutout.mask(dataset: xarray.Dataset, true_area: bool = True, merged_mask: bool = True, shape_mask: bool = True)#

Mask a converted xarray.Dataset from cutout with previously added mask attribute with optional area inclusion, and return a dictionary of xarray Dataset.

The program will search for ‘merged_mask’ and ‘shape_mask’ attributes in the cutout object, these Xarray data can be generate through ‘add_mask’, unless the user specify ‘merged_mask = False’ or ‘shape_mask = False’, the masks in shape_mask will have the same key in the dictionary returned, and the mask for merged_mask will have the key name “merged_mask”.

Parameters:
  • dataset (xr.Dataset) – The dataset to be masked.

  • true_area (bool) – Whether the returned masks will have the area variable. Defaults to True.

  • merged_mask (bool) – If true, the program will try to include the merged_mask from the cutout object. Defaults to True.

  • shape_mask (bool) – If true, the program will try to include the extracted dictionary of shape_mask from the cutout object. Defaults to True.

Returns:

A dictionary of xarray Dataset with masks combined with the dataset.

Return type:

dict[xr.Dataset]