paidiverpy.position_layer#

__init__.py for position_layer module.

Submodules#

Classes#

PositionLayer

Position layer class.

Package Contents#

class paidiverpy.position_layer.PositionLayer(parameters: dict[str, Any], 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 | None = None, client: dask.distributed.Client | None = None, config_index: int | None = None, add_new_step: bool = True, logger: logging.Logger | None = None, raise_error: bool = False, verbose: int = 2)[source]#

Bases: paidiverpy.Paidiverpy

Position layer class.

This class processes the images in the position layer.

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

  • 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.

  • client (Client) – The Dask client.

  • config_index (int) – The index of the configuration.

  • add_new_step (bool) – Whether to add a new step.

  • 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() pandas.DataFrame | None[source]#

Run the resample layer steps on the images based on the configuration.

Run the resample layer steps on the images based on the configuration.

Raises:

ValueError – The mode is not defined in the configuration file.

Returns:

The metadata with the corners if not adding a new step, else None.

Return type:

pd.DataFrame | None

calculate_corners(step_order: int | None = None, params: paidiverpy.models.position_params.CalculateCornersParams = None, test: bool = False) pandas.DataFrame | None[source]#

Calculate the corners of the images.

Parameters:
  • step_order (int, optional) – The order of the step. Defaults to None.

  • test (bool, optional) – Whether to test the step. Defaults to False.

  • params (CalculateCornersParams, optional) – The parameters for the position.

Defaults to CalculateCornersParams().

Returns:

The metadata with the corners if not testing, else None.

Return type:

pd.DataFrame | None

static calculate_limits(metadata: pandas.DataFrame) pandas.DataFrame[source]#

Calculate the corners.

Parameters:

metadata (pd.DataFrame) – The metadata.

Returns:

The metadata with the corners.

Return type:

pd.DataFrame

static calculate_corner(lat: float, lon: float, heading_deg: float, headingoffset_rad: float, cornerdist_m: float, angle_offset: float) tuple[float, float][source]#

Calculate the corner coordinates.

Parameters:
  • lat (float) – The latitude.

  • lon (float) – The longitude.

  • heading_deg (float) – The heading in degrees.

  • headingoffset_rad (float) – The heading offset in radians.

  • cornerdist_m (float) – The corner distance in meters.

  • angle_offset (float) – The angle offset.

Returns:

The corner coordinates.

Return type:

tuple