geodata.Mask
============

.. toctree::
   :hidden:

   /autoapi/geodata/Mask.add_layer
   /autoapi/geodata/Mask.remove_layer
   /autoapi/geodata/Mask.rename_layer
   /autoapi/geodata/Mask.get_res
   /autoapi/geodata/Mask.get_bounds
   /autoapi/geodata/Mask.find_inner_bound
   /autoapi/geodata/Mask.crop_layer
   /autoapi/geodata/Mask.trim_layer
   /autoapi/geodata/Mask.filter_layer
   /autoapi/geodata/Mask.merge_layer
   /autoapi/geodata/Mask.remove_merge_layer
   /autoapi/geodata/Mask.add_shape_layer
   /autoapi/geodata/Mask.extract_shapes
   /autoapi/geodata/Mask.remove_shapes
   /autoapi/geodata/Mask.load_merged_xr
   /autoapi/geodata/Mask.load_shape_xr
   /autoapi/geodata/Mask.close_files
   /autoapi/geodata/Mask.save_mask
   /autoapi/geodata/Mask.from_name

.. py:class:: geodata.Mask(name: str, layer_path: Optional[str | list | dict] = None, layer_name: str | list | None = None, mask_dir: str = MASK_DIR, **kwargs)

   A class to create, manipulate, and load geodata mask object that takes GeoTIFF
   or shp files as input.

   Creating a new mask object. Layer_path will take the file name(s) without extension
   as the default layer name. If layer name(s) is/are specified, it will take the corresponding
   layer_name(s) as the name for new layer(s). Layer path can also be a dictionary of
   `{layer_name: layer_path(str)}` key-value pairs.

   :param name: Name for the new mask object.
   :type name: str
   :param layer_path: Path(s) of new layers to beadded to the mask object.
                      It can be None. In that case, nothing will be added.
   :type layer_path: str or dict
   :param layer_name: Names for the incoming layers.
                      If layer_path is a dictionary, layer_name will be ignored.
   :type layer_name: str or list
   :param mask_dir: The path to where the mask object would be saved/stored.
                    By default, it should be the MASK_PATH constant in config.py.
   :type mask_dir: str
   :param \*\*kwargs: Additional arguments passed to the `add_layer` method, only used if layers need to be added.


   .. py:attribute:: MergingMethods


   .. py:attribute:: name


   .. py:attribute:: layers
      :type:  dict[str, rasterio.DatasetReader]


   .. py:attribute:: merged_mask
      :value: None



   .. py:attribute:: shape_mask


   .. py:attribute:: saved
      :value: False



   .. py:attribute:: mask_dir

Methods
-------

.. autoapisummary::

   geodata.Mask.add_layer
   geodata.Mask.remove_layer
   geodata.Mask.rename_layer
   geodata.Mask.get_res
   geodata.Mask.get_bounds
   geodata.Mask.find_inner_bound
   geodata.Mask.crop_layer
   geodata.Mask.trim_layer
   geodata.Mask.filter_layer
   geodata.Mask.merge_layer
   geodata.Mask.remove_merge_layer
   geodata.Mask.add_shape_layer
   geodata.Mask.extract_shapes
   geodata.Mask.remove_shapes
   geodata.Mask.load_merged_xr
   geodata.Mask.load_shape_xr
   geodata.Mask.close_files
   geodata.Mask.save_mask
   geodata.Mask.from_name


