Module: sarpyx.processor.core.utilis

File: sarpyx/processor/core/utilis.py

No module docstring available; module purpose is inferred from implementation.

Exported Symbols (__all__)

No explicit __all__ list. Public symbols inferred from implementation.

Public Functions (13)

delete function

Deletes the specified file or directory.

File location: sarpyx/processor/core/utilis.py:12

Signature

delete(path_to_delete)

Parameters

ParameterTypeRequiredDefaultDescription
path_to_deleteinferred from implementationyes-The path to the file or directory to delete. Can be provided as a string or a pathlib.Path object.

Return Type

inferred from implementation

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.processor.core.utilis import delete

result = delete(path_to_delete=<path_to_delete>)

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

unzip function

Extracts the contents of a ZIP file to the directory containing the ZIP file.

File location: sarpyx/processor/core/utilis.py:36

Signature

unzip(path_to_zip_file)

Parameters

ParameterTypeRequiredDefaultDescription
path_to_zip_fileinferred from implementationyes-The file path to the ZIP file to be extracted.

Return Type

inferred from implementation

None

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.processor.core.utilis import unzip

result = unzip(path_to_zip_file=<path_to_zip_file>)

Edge Cases

Documented return may be None for some execution paths.

delProd function

Deletes a product file and its associated data folder, while ensuring the last

File location: sarpyx/processor/core/utilis.py:51

Signature

delProd(prodToDelete)

Parameters

ParameterTypeRequiredDefaultDescription
prodToDeleteinferred from implementationyes-The product file to delete. Can be a Path object or a string representing the file path.

Return Type

inferred from implementation

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.processor.core.utilis import delProd

result = delProd(prodToDelete=<prodToDelete>)

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

command_line function

Executes a shell command provided as a string and prints its output.

File location: sarpyx/processor/core/utilis.py:72

Signature

command_line(cmd: str)

Parameters

ParameterTypeRequiredDefaultDescription
cmdstryes-The shell command to execute. The command should be provided as a single string, with arguments separated by spaces.

Return Type

inferred from implementation

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • io
  • subprocess

Example Usage

from sarpyx.processor.core.utilis import command_line

result = command_line(cmd=<cmd>)

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

iterNodes function

Recursively iterates through the children of an XML element tree and populates a dictionary

File location: sarpyx/processor/core/utilis.py:92

Signature

iterNodes(root, Val_Dict={})

Parameters

ParameterTypeRequiredDefaultDescription
rootinferred from implementationyes-The root element of the XML tree to iterate through.
Val_Dictinferred from implementationno{}A dictionary to store the tags and text values of the leaf nodes.

Return Type

inferred from implementation

dict: The updated dictionary containing tags as keys and their corresponding text values as values from the leaf nodes of the XML tree.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.processor.core.utilis import iterNodes

result = iterNodes(root=<root>)

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.

get_annotations function

Retrieves the list of annotation files from the .SAFE directory.

File location: sarpyx/processor/core/utilis.py:121

Signature

get_annotations(filepath)

Parameters

ParameterTypeRequiredDefaultDescription
filepathinferred from implementationyes-inferred from implementation.

Return Type

inferred from implementation

inferred from implementation.

Exceptions

  • RuntimeError
  • ValueError

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.processor.core.utilis import get_annotations

result = get_annotations(filepath=<filepath>)

Edge Cases

May raise: RuntimeError, ValueError.

read_annotation function

Reads the content of the first annotation file.

File location: sarpyx/processor/core/utilis.py:143

Signature

read_annotation(annotations)

Parameters

ParameterTypeRequiredDefaultDescription
annotationsinferred from implementationyes-inferred from implementation.

Return Type

inferred from implementation

inferred from implementation.

Exceptions

  • RuntimeError

Side Effects

  • filesystem

Example Usage

from sarpyx.processor.core.utilis import read_annotation

result = read_annotation(annotations=<annotations>)

Edge Cases

May raise: RuntimeError.

create_complex_image_from_file function

Create a complex image array from the in-phase and quadrature components files in a beam-dimap file.

File location: sarpyx/processor/core/utilis.py:157

Signature

create_complex_image_from_file(i_path, q_path)

Parameters

ParameterTypeRequiredDefaultDescription
i_pathinferred from implementationyes-inferred from implementation.
q_pathinferred from implementationyes-inferred from implementation.

Return Type

inferred from implementation

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • filesystem

Example Usage

from sarpyx.processor.core.utilis import create_complex_image_from_file

result = create_complex_image_from_file(i_path=<i_path>, q_path=<q_path>)

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

get_image_shape_from_file function

Return (nRows, nCols) of an ENVI/rasterio image without loading data.

File location: sarpyx/processor/core/utilis.py:176

Signature

get_image_shape_from_file(img_path)

Parameters

ParameterTypeRequiredDefaultDescription
img_pathinferred from implementationyes-inferred from implementation.

Return Type

inferred from implementation

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • filesystem

Example Usage

from sarpyx.processor.core.utilis import get_image_shape_from_file

result = get_image_shape_from_file(img_path=<img_path>)

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

randomize_subset_origins function

Get set of random origins for subsetting to, adjusted to image shape and desired subset dimension (square subset)

File location: sarpyx/processor/core/utilis.py:184

Signature

randomize_subset_origins(file_path, subset_count=500, sub_dims=1024)

Parameters

ParameterTypeRequiredDefaultDescription
file_pathinferred from implementationyes-inferred from implementation.
subset_countinferred from implementationno500inferred from implementation.
sub_dimsinferred from implementationno1024inferred from implementation.

Return Type

inferred from implementation

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • filesystem

Example Usage

from sarpyx.processor.core.utilis import randomize_subset_origins

result = randomize_subset_origins(file_path=<file_path>)

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.

find_measurement_image function

Get path to a tiff image for an asset.

File location: sarpyx/processor/core/utilis.py:198

Signature

find_measurement_image(asset_path)

Parameters

ParameterTypeRequiredDefaultDescription
asset_pathinferred from implementationyes-inferred from implementation.

Return Type

inferred from implementation

Path to the first matching tiff image in the measurement folder.

Exceptions

  • FileNotFoundError

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.processor.core.utilis import find_measurement_image

result = find_measurement_image(asset_path=<asset_path>)

Edge Cases

May raise: FileNotFoundError.

create_complex_image_from_array function

Create a complex64 image array from in-phase and quadrature numpy arrays.

File location: sarpyx/processor/core/utilis.py:213

Signature

create_complex_image_from_array(i_image, q_image)

Parameters

ParameterTypeRequiredDefaultDescription
i_imageinferred from implementationyes-inferred from implementation.
q_imageinferred from implementationyes-inferred from implementation.

Return Type

inferred from implementation

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.processor.core.utilis import create_complex_image_from_array

result = create_complex_image_from_array(i_image=<i_image>, q_image=<q_image>)

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

check_file function

Check for existence and completeness of input file with attempts and time delay. Returns file path.

File location: sarpyx/processor/core/utilis.py:225

Signature

check_file(file_path, max_retries=5, retry_delay=0.5)

Parameters

ParameterTypeRequiredDefaultDescription
file_pathinferred from implementationyes-inferred from implementation.
max_retriesinferred from implementationno5inferred from implementation.
retry_delayinferred from implementationno0.5inferred from implementation.

Return Type

inferred from implementation

inferred from implementation.

Exceptions

  • FileNotFoundError
  • e

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.processor.core.utilis import check_file

result = check_file(file_path=<file_path>)

Edge Cases

May raise: FileNotFoundError, e. Includes optional parameters with implementation-defined fallback behavior.

Public Classes (0)

No public classes detected.