paidiverpy.open_layer#

__init__.py for open_layer module.

Submodules#

Classes#

OpenLayer

Open raw image file.

Package Contents#

class paidiverpy.open_layer.OpenLayer(config_params: dict[str, Any] | paidiverpy.config.config_params.ConfigParams | None = None, config_file_path: str | None = None, config: paidiverpy.config.configuration.Configuration | None = None, metadata: paidiverpy.metadata_parser.MetadataParser | None = None, images: paidiverpy.images_layer.ImagesLayer | None = None, paidiverpy: paidiverpy.Paidiverpy | None = None, step_name: str = 'raw', client: dask.distributed.Client | None = None, parameters: dict[str, Any] | None = None, logger: logging.Logger | None = None, raise_error: bool = False, verbose: int = 2)[source]#

Bases: paidiverpy.Paidiverpy

Open raw image file.

Parameters:
  • config_params (dict | ConfigParams, optional) – The configuration parameters. It can contain the following keys / attributes: - input_path (str): The path to the input files. - output_path (str): The path to the output files. - metadata_path (str): The path to the metadata file. - metadata_type (str): The type of the metadata file. - track_changes (bool): Whether to track changes. - n_jobs (int): The number of n_jobs.

  • config_file_path (str) – The path to the configuration file.

  • config (Configuration) – The configuration object.

  • metadata (MetadataParser) – The metadata object.

  • images (ImagesLayer) – The images object.

  • paidiverpy (Paidiverpy) – The paidiverpy object.

  • step_name (str) – The name of the step.

  • parameters (dict) – The parameters for the step.

  • client (Client) – The Dask client.

  • logger (logging.Logger) – The logger object.

  • raise_error (bool) – Whether to raise an error.

  • verbose (int) – verbose level (0 = none, 1 = errors/warnings, 2 = info).

run() None[source]#

Run the open layer steps based on the configuration file or parameters.

import_image() None[source]#

Import images with optional Dask parallelization.

static process_single_image(img_path: str | pathlib.Path, func: collections.abc.Callable, metadata: xarray.DataArray, rename: str, image_type: str, image_open_args: dict[str, Any], storage_options: dict[str, Any]) tuple[numpy.ndarray[Any, Any] | dask.array.core.Array, dict[str, Any], str] | None[source]#

Process a single image.

Parameters:
  • img_path (str | Path) – The path to the image.

  • func (Callable) – The function to process the image.

  • metadata (xr.DataArray) – The metadata DataArray.

  • rename (str) – The rename strategy.

  • image_type (str) – The image type.

  • image_open_args (dict) – The image open arguments.

  • storage_options (dict) – The storage options.

create_dataset(images_info: dict[str, Any]) xarray.Dataset[source]#

Create a Dask array from the processed images and EXIF data.

Parameters:

images_info (dict) – A dictionary containing processed image information.

Returns:

The image dataset.

Return type:

xr.Dataset