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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
path_to_delete | inferred from implementation | yes | - | 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
path_to_zip_file | inferred from implementation | yes | - | 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
prodToDelete | inferred from implementation | yes | - | 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
cmd | str | yes | - | 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
root | inferred from implementation | yes | - | The root element of the XML tree to iterate through. |
Val_Dict | inferred from implementation | no | {} | 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
filepath | inferred from implementation | yes | - | inferred from implementation. |
Return Type
inferred from implementation
inferred from implementation.
Exceptions
RuntimeErrorValueError
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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
annotations | inferred from implementation | yes | - | 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
i_path | inferred from implementation | yes | - | inferred from implementation. |
q_path | inferred from implementation | yes | - | 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
img_path | inferred from implementation | yes | - | 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
file_path | inferred from implementation | yes | - | inferred from implementation. |
subset_count | inferred from implementation | no | 500 | inferred from implementation. |
sub_dims | inferred from implementation | no | 1024 | 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 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
asset_path | inferred from implementation | yes | - | 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
i_image | inferred from implementation | yes | - | inferred from implementation. |
q_image | inferred from implementation | yes | - | 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
file_path | inferred from implementation | yes | - | inferred from implementation. |
max_retries | inferred from implementation | no | 5 | inferred from implementation. |
retry_delay | inferred from implementation | no | 0.5 | inferred from implementation. |
Return Type
inferred from implementation
inferred from implementation.
Exceptions
FileNotFoundErrore
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.