paidiverpy#
Paidiverpy base package.
Submodules#
- paidiverpy.colour_layer
- paidiverpy.config
- paidiverpy.convert_layer
- paidiverpy.custom_layer
- paidiverpy.frontend
- paidiverpy.images_layer
- paidiverpy.investigation_layer
- paidiverpy.metadata_parser
- paidiverpy.models
- paidiverpy.open_layer
- paidiverpy.paidiverpy
- paidiverpy.pipeline
- paidiverpy.position_layer
- paidiverpy.sampling_layer
- paidiverpy.utils
Classes#
Main class for the paidiverpy package. |
Functions#
|
Print the versions of paidiverpy and its dependencies. |
Package Contents#
- class paidiverpy.Paidiverpy(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, client: dask.distributed.Client | None = None, paidiverpy: Paidiverpy | None = None, track_changes: bool | None = None, logger: logging.Logger | None = None, raise_error: bool = False, verbose: int = 2)[source]#
Main class for the paidiverpy package.
- 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. - image_open_args (str): The type of the images. - 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, optional) – The path to the configuration file.
config (Configuration, optional) – The configuration object.
metadata (MetadataParser, optional) – The metadata object.
images (ImagesLayer, optional) – The images object.
client (Client, optional) – The Dask client object.
paidiverpy (Paidiverpy, optional) – The paidiverpy object.
track_changes (bool) – Whether to track changes. Defaults to None, which means it will be set to the value of the configuration file.
logger (logging.Logger, optional) – The logger object.
raise_error (bool, optional) – Whether to raise an error.
verbose (int, optional) – verbose level (0 = none, 1 = errors/warnings, 2 = info).
- run(add_new_step: bool = True) paidiverpy.images_layer.ImagesLayer | None[source]#
Run the paidiverpy pipeline.
- Parameters:
add_new_step (bool, optional) – Whether to add a new step. Defaults to True.
- Returns:
The images object.
- Return type:
ImagesLayer | None
- process_images(method: collections.abc.Callable, params: dict[str, Any] | paidiverpy.utils.base_model.BaseModel) xarray.Dataset[source]#
Process the images sequentially.
Method to process the images sequentially.
- calculate_output_image(images: xarray.Dataset, func: collections.abc.Callable) tuple[dict[str, Any], numpy.dtype[Any]][source]#
Calculate the output image dimensions and data type.
- Parameters:
images (xr.Dataset) – The input images.
func (Callable) – The processing function.
- Returns:
A tuple containing the dask_gufunc_kwargs and the output data type.
- Return type:
- process_dataset(images: xarray.Dataset, method: collections.abc.Callable, params: paidiverpy.utils.base_model.BaseModel) xarray.Dataset[source]#
Process the images as a dataset.
- Parameters:
images (xr.Dataset) – The dataset of images to process.
method (Callable) – The method to apply to the images.
params (BaseModel) – The parameters for the method.
- Returns:
A dataset containing the processed images
- Return type:
xr.Dataset
- set_metadata(metadata: pandas.DataFrame | None = None, dataset_metadata: dict[str, Any] | None = None) None[source]#
Set the metadata.
- Parameters:
metadata (pd.DataFrame | None) – The metadata to set.
dataset_metadata (dict | None) – The dataset metadata to set.
- save_images(step: str | int | None = None, image_format: str = 'png', output_path: str | pathlib.Path | None = None) None[source]#
Save the images.
- load_custom_algorithm(file_path: str, class_name: str, algorithm_name: str) collections.abc.Callable[source]#
Load a custom algorithm class.
- static process_single(img: numpy.ndarray[Any, Any], flag: int, height: int, width: int, filename: str, output_bands: int | None, func: collections.abc.Callable, metadata: pandas.DataFrame) tuple[numpy.ndarray[Any, Any], int, int][source]#
Wrapper to process a single image with its metadata.
- Parameters:
img (np.ndarray) – The padded image (H, W, bands).
flag (int) – The flag indicating the processing step.
height (int) – The height of the valid image area.
width (int) – The width of the valid image area.
filename (str) – The filename of the image.
output_bands (int) – The number of output bands.
func (Callable) – The processing function.
metadata (pd.DataFrame) – The metadata DataFrame.
- Returns:
A tuple containing the processed image, height, and width.
- Return type:
- paidiverpy.show_versions(file: TextIO = sys.stdout, conda: bool = False) None[source]#
Print the versions of paidiverpy and its dependencies.
- Parameters:
file (TextIO, optional) – The file to write the versions to. Defaults to sys.stdout.
conda (bool, optional) – Whether to format the output for conda. Defaults to False.