Module: sarpyx.utils.zarr_utils

File: sarpyx/utils/zarr_utils.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 (4)

save_array_to_zarr function

Save a numpy array to a Zarr file with maximum compression.

File location: sarpyx/utils/zarr_utils.py:66

Signature

save_array_to_zarr(array: 'np.ndarray', file_path: str, compressor_level: int=9, parent_product: str=None, metadata_df: pd.DataFrame=None, ephemeris_df: pd.DataFrame=None) -> None

Parameters

ParameterTypeRequiredDefaultDescription
array'np.ndarray'yes-The numpy array to save.
file_pathstryes-The path to the output Zarr file.
compressor_levelintno9Compression level for Blosc (default is 9, maximum).
parent_productstrnoNoneinferred from implementation.
metadata_dfpd.DataFramenoNoneOptional pandas DataFrame to save as zarr attributes.
ephemeris_dfpd.DataFramenoNoneOptional pandas DataFrame with ephemeris data to save as zarr attributes.

Return Type

None

None

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • io

Example Usage

from sarpyx.utils.zarr_utils import save_array_to_zarr

result = save_array_to_zarr(array=<array>, file_path=<file_path>)

Edge Cases

Includes optional parameters with implementation-defined fallback behavior. Documented return may be None for some execution paths.

dask_slice_saver function

Save SAR processing results to Zarr format with optimized compression.

File location: sarpyx/utils/zarr_utils.py:140

Signature

dask_slice_saver(result: Dict[str, Union[np.ndarray, pd.DataFrame, Dict[str, Any]]], zarr_path: Union[str, Path], chunks: Optional[Union[str, Tuple[int, ...]]]='auto', clevel: int=5) -> None

Parameters

ParameterTypeRequiredDefaultDescription
resultDict[str, Union[np.ndarray, pd.DataFrame, Dict[str, Any]]]yes-Processing results dictionary containing: - 'raw' (np.ndarray): Raw SAR data after initial processing - 'rc' (np.ndarray): Range compressed SAR data - 'rcmc' (np.ndarray): Range Cell Migration Corrected data - 'az' (np.ndarray): Azimuth compressed (focused) SAR data - 'metadata' (Union[pd.DataFrame, Dict]): Acquisition metadata - 'ephemeris' (Union[pd.DataFrame, Dict]): Satellite ephemeris data
zarr_pathUnion[str, Path]yes-Output path for the Zarr store directory. Will be created if it doesn't exist.
chunksOptional[Union[str, Tuple[int, ...]]]no'auto'Chunking strategy for array storage. Options: - 'auto': Use automatic chunking with 4096 element maximum per dimension - Tuple[int, ...]: Custom chunk shape matching array dimensions - None: Use default chunking (4096,) * ndim Defaults to 'auto'.
clevelintno5Blosc compression level from 1 (fastest) to 9 (best compression). Higher values provide better compression at the cost of processing time. Defaults to 5 for balanced performance.

Return Type

None

None: Function performs file I/O operations only.

Exceptions

  • ValueError

Side Effects

  • inferred from implementation

Example Usage

>>> # Save complete SAR processing results
    >>> processing_results = {
    ...     'raw': raw_data_array,
    ...     'rc': range_compressed_array, 
    ...     'rcmc': rcmc_corrected_array,
    ...     'az': azimuth_focused_array,
    ...     'metadata': metadata_dataframe,
    ...     'ephemeris': ephemeris_dataframe
    ... }
    >>> dask_slice_saver(processing_results, '/path/to/output.zarr')
    
    >>> # Use custom chunking and high compression
    >>> dask_slice_saver(
    ...     processing_results, 
    ...     '/path/to/output.zarr',
    ...     chunks=(1024, 1024),
    ...     clevel=9
    ... )
    
    >>> # Save with automatic chunking
    >>> dask_slice_saver(
    ...     processing_results,
    ...     Path('/data/sar_focused.zarr'),
    ...     chunks='auto',
    ...     clevel=7
    ... )

Edge Cases

May raise: ValueError. Includes optional parameters with implementation-defined fallback behavior. Documented return may be None for some execution paths.

concatenate_slices function

Concatenate multiple slice Zarr files into a single Zarr store.

File location: sarpyx/utils/zarr_utils.py:296

Signature

concatenate_slices(slice_zarr_paths: List[Union[str, Path]], output_zarr_path: Union[str, Path], chunks: Optional[Union[str, Tuple[int, ...]]]='auto', clevel: int=7) -> None

Parameters

ParameterTypeRequiredDefaultDescription
slice_zarr_pathsList[Union[str, Path]]yes-List of paths to slice Zarr files to concatenate
output_zarr_pathUnion[str, Path]yes-Path where to save the concatenated Zarr store
chunksOptional[Union[str, Tuple[int, ...]]]no'auto'Chunking strategy for output arrays
clevelintno7Compression level (1-9)

Return Type

None

inferred from implementation.

Exceptions

  • FileNotFoundError
  • ValueError

Side Effects

  • filesystem
  • io

Example Usage

from sarpyx.utils.zarr_utils import concatenate_slices

result = concatenate_slices(slice_zarr_paths=<slice_zarr_paths>, output_zarr_path=<output_zarr_path>)

Edge Cases

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

concatenate_slices_efficient function

Memory-efficiently concatenate multiple slice Zarr files into a single Zarr store.

File location: sarpyx/utils/zarr_utils.py:428

Signature

concatenate_slices_efficient(slice_zarr_paths: List[Union[str, Path]], output_zarr_path: Union[str, Path], chunks: Optional[Union[str, Tuple[int, ...]]]='auto', clevel: int=5) -> None

Parameters

ParameterTypeRequiredDefaultDescription
slice_zarr_pathsList[Union[str, Path]]yes-List of paths to slice Zarr files to concatenate
output_zarr_pathUnion[str, Path]yes-Path where to save the concatenated Zarr store
chunksOptional[Union[str, Tuple[int, ...]]]no'auto'Chunking strategy for output arrays
clevelintno5Compression level (1-9)

Return Type

None

inferred from implementation.

Exceptions

  • FileNotFoundError
  • ValueError

Side Effects

  • filesystem
  • io

Example Usage

from sarpyx.utils.zarr_utils import concatenate_slices_efficient

result = concatenate_slices_efficient(slice_zarr_paths=<slice_zarr_paths>, output_zarr_path=<output_zarr_path>)

Edge Cases

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

Public Classes (2)

ZarrManager class

A comprehensive class for managing Zarr files, providing convenient methods for data access, slicing, metadata extraction, analysis, visualization, and export.

File location: sarpyx/utils/zarr_utils.py:602

Class Signature

class ZarrManager

Constructor Parameters

Return Type

ZarrManager instances.

Exceptions

Construction/runtime exceptions are inferred from implementation and method-level documentation.

Side Effects

See method-level side effects below.

Example Usage

from sarpyx.utils.zarr_utils import ZarrManager

obj = ZarrManager(...)  # inferred from implementation

Edge Cases

No class-level edge-case section is explicitly documented; rely on method-level checks and raised exceptions.

Public Methods (13)

ZarrManager.load method

Load the zarr array and cache it.

File location: sarpyx/utils/zarr_utils.py:622

Signature

load(self) -> zarr.Array

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

zarr.Array

zarr.Array: The loaded zarr array

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • filesystem

Example Usage

from sarpyx.utils.zarr_utils import ZarrManager

# Constructor arguments are inferred from implementation.
obj = ZarrManager(...)  # inferred from implementation
result = obj.load()

Edge Cases

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

ZarrManager.info method

Get basic info about the zarr array.

File location: sarpyx/utils/zarr_utils.py:681

Signature

info(self) -> Dict[str, Any]

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

Dict[str, Any]

Dict containing shape, dtype, chunks, nbytes, and size in MB

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ZarrManager

# Constructor arguments are inferred from implementation.
obj = ZarrManager(...)  # inferred from implementation
result = obj.info()

Edge Cases

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

ZarrManager.drop method

Drop specified rows and/or columns from the zarr array.

File location: sarpyx/utils/zarr_utils.py:700

Signature

drop(self, rows: Optional[Union[Tuple[int, int], slice, List[int]]]=None, cols: Optional[Union[Tuple[int, int], slice, List[int]]]=None) -> Tuple[np.ndarray, Optional[pd.DataFrame], Optional[pd.DataFrame]]

Parameters

ParameterTypeRequiredDefaultDescription
rowsOptional[Union[Tuple[int, int], slice, List[int]]]noNoneRow dropping specification. Can be: - Tuple of (start_idx, end_idx) for row range to drop - slice object for custom dropping - List of specific row indices to drop - None to keep all rows Defaults to None.
colsOptional[Union[Tuple[int, int], slice, List[int]]]noNoneColumn dropping specification. Can be: - Tuple of (start_idx, end_idx) for column range to drop - slice object for custom dropping - List of specific column indices to drop - None to keep all columns Defaults to None.

Return Type

Tuple[np.ndarray, Optional[pd.DataFrame], Optional[pd.DataFrame]]

Tuple[np.ndarray, Optional[pd.DataFrame], Optional[pd.DataFrame]]: A 3-element tuple containing: - np.ndarray: The array data with specified rows/columns dropped - Optional[pd.DataFrame]: Metadata with corresponding rows dropped (if rows were dropped) - Optional[pd.DataFrame]: Ephemeris information for the dataset

Exceptions

  • ValueError

Side Effects

  • inferred from implementation

Example Usage

>>> # Drop specific row and column ranges
    >>> data, meta, eph = zarr_obj.drop(rows=(100, 200), cols=(50, 150))
    >>> # Drop specific indices
    >>> data, meta, eph = zarr_obj.drop(rows=[10, 20, 30], cols=[5, 15, 25])
    >>> # Drop using slice objects
    >>> data, meta, eph = zarr_obj.drop(rows=slice(100, 200, 2))
    >>> # Drop only rows, keep all columns
    >>> data, meta, eph = zarr_obj.drop(rows=(0, 50))

Edge Cases

May raise: ValueError. Includes optional parameters with implementation-defined fallback behavior. Documented return may be None for some execution paths.

ZarrManager.get_slice method

Extract a slice from the zarr array with optional row and column indexing.

File location: sarpyx/utils/zarr_utils.py:806

Signature

get_slice(self, rows: Optional[Union[Tuple[int, int], slice]]=None, cols: Optional[Union[Tuple[int, int], slice]]=None, step: Optional[int]=None) -> Tuple[np.ndarray, Optional[pd.DataFrame], Optional[pd.DataFrame]]

Parameters

ParameterTypeRequiredDefaultDescription
rowsOptional[Union[Tuple[int, int], slice]]noNoneRow indexing specification. Can be: - Tuple of (start_idx, end_idx) for row range - slice object for custom slicing - None to select all rows Defaults to None.
colsOptional[Union[Tuple[int, int], slice]]noNoneColumn indexing specification. Can be: - Tuple of (start_idx, end_idx) for column range - slice object for custom slicing - None to select all columns Defaults to None.
stepOptional[int]noNoneStep size for slicing when using tuple indexing. Only applied when rows or cols are provided as tuples. Ignored for slice objects. Defaults to None.

Return Type

Tuple[np.ndarray, Optional[pd.DataFrame], Optional[pd.DataFrame]]

Tuple[np.ndarray, Optional[pd.DataFrame], Optional[pd.DataFrame]]: A 3-element tuple containing: - np.ndarray: The sliced array data - Optional[pd.DataFrame]: Metadata associated with the zarr array - Optional[pd.DataFrame]: Ephemeris information for the dataset

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

>>> # Get full array
    >>> data, meta, eph = zarr_obj.get_slice()
    >>> # Get specific row and column ranges
    >>> data, meta, eph = zarr_obj.get_slice(rows=(100, 200), cols=(50, 150))
    >>> # Get every 2nd element in specified range
    >>> data, meta, eph = zarr_obj.get_slice(rows=(0, 100), step=2)
    >>> # Use slice objects for advanced indexing
    >>> data, meta, eph = zarr_obj.get_slice(rows=slice(None, None, 2))

Edge Cases

Includes optional parameters with implementation-defined fallback behavior. Documented return may be None for some execution paths.

ZarrManager.get_slice_block method

Internal method to handle block slicing for large arrays.

File location: sarpyx/utils/zarr_utils.py:872

Signature

get_slice_block(self, N_blocks: int=5, slice_idx: int=0, outDict: bool=True, verbose: bool=False) -> None

Parameters

ParameterTypeRequiredDefaultDescription
N_blocksintno5inferred from implementation.
slice_idxintno0inferred from implementation.
outDictboolnoTrueinferred from implementation.
verboseboolnoFalseinferred from implementation.

Return Type

None

inferred from implementation.

Exceptions

  • ValueError

Side Effects

  • io

Example Usage

from sarpyx.utils.zarr_utils import ZarrManager

# Constructor arguments are inferred from implementation.
obj = ZarrManager(...)  # inferred from implementation
result = obj.get_slice_block()

Edge Cases

May raise: ValueError. Includes optional parameters with implementation-defined fallback behavior.

ZarrManager.get_metadata method

Extract metadata from zarr attributes.

File location: sarpyx/utils/zarr_utils.py:903

Signature

get_metadata(self) -> Optional['pd.DataFrame']

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

Optional['pd.DataFrame']

pandas DataFrame containing metadata if available, None otherwise

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ZarrManager

# Constructor arguments are inferred from implementation.
obj = ZarrManager(...)  # inferred from implementation
result = obj.get_metadata()

Edge Cases

Documented return may be None for some execution paths.

ZarrManager.get_ephemeris method

Extract ephemeris data from zarr attributes.

File location: sarpyx/utils/zarr_utils.py:917

Signature

get_ephemeris(self) -> Optional['pd.DataFrame']

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

Optional['pd.DataFrame']

pandas DataFrame containing ephemeris data if available, None otherwise

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ZarrManager

# Constructor arguments are inferred from implementation.
obj = ZarrManager(...)  # inferred from implementation
result = obj.get_ephemeris()

Edge Cases

Documented return may be None for some execution paths.

ZarrManager.stats method

Get statistical summary of the data.

File location: sarpyx/utils/zarr_utils.py:933

Signature

stats(self, sample_size: int=1000) -> Dict[str, Optional[float]]

Parameters

ParameterTypeRequiredDefaultDescription
sample_sizeintno1000Number of samples to use for statistics (for large arrays)

Return Type

Dict[str, Optional[float]]

Dictionary containing statistical measures (mean, std, min, max, etc.)

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ZarrManager

# Constructor arguments are inferred from implementation.
obj = ZarrManager(...)  # inferred from implementation
result = obj.stats()

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.

ZarrManager.visualize_slice method

Visualize a slice of the data.

File location: sarpyx/utils/zarr_utils.py:964

Signature

visualize_slice(self, rows: Tuple[int, int]=(0, 100), cols: Tuple[int, int]=(0, 100), plot_type: str='magnitude') -> None

Parameters

ParameterTypeRequiredDefaultDescription
rowsTuple[int, int]no(0, 100)Tuple for row range (start, end)
colsTuple[int, int]no(0, 100)Tuple for column range (start, end)
plot_typestrno'magnitude'Type of plot - 'magnitude', 'phase', 'real', 'imag'

Return Type

None

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ZarrManager

# Constructor arguments are inferred from implementation.
obj = ZarrManager(...)  # inferred from implementation
result = obj.visualize_slice()

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.

ZarrManager.get_compression_info method

Get compression statistics.

File location: sarpyx/utils/zarr_utils.py:1003

Signature

get_compression_info(self) -> Dict[str, float]

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

Dict[str, float]

Dictionary containing compression information (sizes, ratio, space saved)

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ZarrManager

# Constructor arguments are inferred from implementation.
obj = ZarrManager(...)  # inferred from implementation
result = obj.get_compression_info()

Edge Cases

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

ZarrManager.export_slice method

Export a slice to various formats.

File location: sarpyx/utils/zarr_utils.py:1026

Signature

export_slice(self, output_path: str, rows: Optional[Union[Tuple[int, int], slice]]=None, cols: Optional[Union[Tuple[int, int], slice]]=None, format: str='npy') -> None

Parameters

ParameterTypeRequiredDefaultDescription
output_pathstryes-Path for output file
rowsOptional[Union[Tuple[int, int], slice]]noNoneRow slice specification
colsOptional[Union[Tuple[int, int], slice]]noNoneColumn slice specification
formatstrno'npy'Export format - 'npy', 'csv', 'hdf5'

Return Type

None

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • filesystem
  • io

Example Usage

from sarpyx.utils.zarr_utils import ZarrManager

# Constructor arguments are inferred from implementation.
obj = ZarrManager(...)  # inferred from implementation
result = obj.export_slice(output_path=<output_path>)

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.

ZarrManager.find_peaks method

Find peaks in the data (useful for SAR analysis).

File location: sarpyx/utils/zarr_utils.py:1059

Signature

find_peaks(self, rows: Optional[Union[Tuple[int, int], slice]]=None, cols: Optional[Union[Tuple[int, int], slice]]=None, threshold_percentile: float=95) -> Dict[str, Any]

Parameters

ParameterTypeRequiredDefaultDescription
rowsOptional[Union[Tuple[int, int], slice]]noNoneRow slice to analyze
colsOptional[Union[Tuple[int, int], slice]]noNoneColumn slice to analyze
threshold_percentilefloatno95Percentile for peak detection (0-100)

Return Type

Dict[str, Any]

Dictionary containing peak information (indices, values, threshold, count)

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ZarrManager

# Constructor arguments are inferred from implementation.
obj = ZarrManager(...)  # inferred from implementation
result = obj.find_peaks()

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.

ZarrManager.memory_efficient_operation method

Apply an operation to the data in chunks to save memory.

File location: sarpyx/utils/zarr_utils.py:1086

Signature

memory_efficient_operation(self, operation: Callable[[np.ndarray], Any], chunk_size: int=1000) -> List[Any]

Parameters

ParameterTypeRequiredDefaultDescription
operationCallable[[np.ndarray], Any]yes-Function to apply to each chunk
chunk_sizeintno1000Size of chunks to process (number of rows)

Return Type

List[Any]

List of results from applying operation to each chunk

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ZarrManager

# Constructor arguments are inferred from implementation.
obj = ZarrManager(...)  # inferred from implementation
result = obj.memory_efficient_operation(operation=<operation>)

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.

ProductHandler class

A specialized ZarrManager subclass for handling concatenated Zarr data with multiple arrays. This class manages Zarr stores containing multiple arrays (az, raw, rc, rcmc) and their associated metadata and ephemeris information stored as JSON attributes.

File location: sarpyx/utils/zarr_utils.py:1154

Class Signature

class ProductHandler

Constructor Parameters

Return Type

ProductHandler instances.

Exceptions

Construction/runtime exceptions are inferred from implementation and method-level documentation.

Side Effects

See method-level side effects below.

Example Usage

from sarpyx.utils.zarr_utils import ProductHandler

obj = ProductHandler(...)  # inferred from implementation

Edge Cases

No class-level edge-case section is explicitly documented; rely on method-level checks and raised exceptions.

Public Methods (11)

ProductHandler.load method

Override parent load method to return the zarr group instead of single array.

File location: sarpyx/utils/zarr_utils.py:1191

Signature

load(self) -> zarr.Group

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

zarr.Group

zarr.Group: The loaded zarr store

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ProductHandler

# Constructor arguments are inferred from implementation.
obj = ProductHandler(...)  # inferred from implementation
result = obj.load()

Edge Cases

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

ProductHandler.get_array method

Get a specific array from the concatenated zarr store.

File location: sarpyx/utils/zarr_utils.py:1200

Signature

get_array(self, array_name: str) -> zarr.Array

Parameters

ParameterTypeRequiredDefaultDescription
array_namestryes-Name of the array ('az', 'raw', 'rc', 'rcmc')

Return Type

zarr.Array

zarr.Array: The requested zarr array

Exceptions

  • ValueError

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ProductHandler

# Constructor arguments are inferred from implementation.
obj = ProductHandler(...)  # inferred from implementation
result = obj.get_array(array_name=<array_name>)

Edge Cases

May raise: ValueError.

ProductHandler.info method

Get comprehensive info about all arrays in the concatenated zarr store.

File location: sarpyx/utils/zarr_utils.py:1226

Signature

info(self) -> Dict[str, Any]

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

Dict[str, Any]

Dict[str, Any]: Dictionary containing info for each array and total size

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ProductHandler

# Constructor arguments are inferred from implementation.
obj = ProductHandler(...)  # inferred from implementation
result = obj.info()

Edge Cases

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

ProductHandler.get_metadata method

Extract metadata from zarr store attributes.

File location: sarpyx/utils/zarr_utils.py:1255

Signature

get_metadata(self) -> Optional['pd.DataFrame']

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

Optional['pd.DataFrame']

Optional[pd.DataFrame]: Metadata DataFrame if available, None otherwise

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ProductHandler

# Constructor arguments are inferred from implementation.
obj = ProductHandler(...)  # inferred from implementation
result = obj.get_metadata()

Edge Cases

Documented return may be None for some execution paths.

ProductHandler.get_ephemeris method

Extract ephemeris data from zarr store attributes.

File location: sarpyx/utils/zarr_utils.py:1269

Signature

get_ephemeris(self) -> Optional['pd.DataFrame']

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

Optional['pd.DataFrame']

Optional[pd.DataFrame]: Ephemeris DataFrame if available, None otherwise

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ProductHandler

# Constructor arguments are inferred from implementation.
obj = ProductHandler(...)  # inferred from implementation
result = obj.get_ephemeris()

Edge Cases

Documented return may be None for some execution paths.

ProductHandler.get_slice method

Extract slices from specified arrays with associated metadata and ephemeris.

File location: sarpyx/utils/zarr_utils.py:1284

Signature

get_slice(self, array_names: Union[str, List[str]], rows: Optional[Union[Tuple[int, int], slice]]=None, cols: Optional[Union[Tuple[int, int], slice]]=None, step: Optional[int]=None, include_metadata: bool=True) -> Dict[str, Any]

Parameters

ParameterTypeRequiredDefaultDescription
array_namesUnion[str, List[str]]yes-Name(s) of arrays to slice ('az', 'raw', 'rc', 'rcmc')
rowsOptional[Union[Tuple[int, int], slice]]noNoneRow indexing specification
colsOptional[Union[Tuple[int, int], slice]]noNoneColumn indexing specification
stepOptional[int]noNoneStep size for tuple-based indexing
include_metadataboolnoTrueWhether to include metadata and ephemeris in output

Return Type

Dict[str, Any]

Dict[str, Any]: Dictionary containing sliced arrays and optionally metadata/ephemeris

Exceptions

  • ValueError

Side Effects

  • inferred from implementation

Example Usage

>>> # Get slice from single array
    >>> result = manager.get_slice('raw', rows=(100, 200), cols=(50, 150))
    >>> # Get slices from multiple arrays
    >>> result = manager.get_slice(['raw', 'rc'], rows=(0, 500))
    >>> # Access results
    >>> raw_data = result['arrays']['raw']
    >>> metadata = result['metadata']

Edge Cases

May raise: ValueError. Includes optional parameters with implementation-defined fallback behavior.

ProductHandler.get_array_slice method

Get a slice from a single array (convenience method).

File location: sarpyx/utils/zarr_utils.py:1374

Signature

get_array_slice(self, array_name: str, rows: Optional[Union[Tuple[int, int], slice]]=None, cols: Optional[Union[Tuple[int, int], slice]]=None, step: Optional[int]=None) -> np.ndarray

Parameters

ParameterTypeRequiredDefaultDescription
array_namestryes-Name of the array to slice
rowsOptional[Union[Tuple[int, int], slice]]noNoneRow indexing specification
colsOptional[Union[Tuple[int, int], slice]]noNoneColumn indexing specification
stepOptional[int]noNoneStep size for tuple-based indexing

Return Type

np.ndarray

np.ndarray: Sliced array data

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ProductHandler

# Constructor arguments are inferred from implementation.
obj = ProductHandler(...)  # inferred from implementation
result = obj.get_array_slice(array_name=<array_name>)

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.

ProductHandler.get_metadata_slice method

Get a slice of metadata corresponding to specified rows.

File location: sarpyx/utils/zarr_utils.py:1394

Signature

get_metadata_slice(self, rows: Optional[Union[Tuple[int, int], slice]]=None) -> Optional['pd.DataFrame']

Parameters

ParameterTypeRequiredDefaultDescription
rowsOptional[Union[Tuple[int, int], slice]]noNoneRow indexing specification

Return Type

Optional['pd.DataFrame']

Optional[pd.DataFrame]: Sliced metadata DataFrame if available

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ProductHandler

# Constructor arguments are inferred from implementation.
obj = ProductHandler(...)  # inferred from implementation
result = obj.get_metadata_slice()

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.

ProductHandler.compare_arrays method

Compare multiple arrays side by side with statistics.

File location: sarpyx/utils/zarr_utils.py:1425

Signature

compare_arrays(self, array_names: List[str], rows: Optional[Union[Tuple[int, int], slice]]=None, cols: Optional[Union[Tuple[int, int], slice]]=None, comparison_type: str='magnitude') -> Dict[str, Any]

Parameters

ParameterTypeRequiredDefaultDescription
array_namesList[str]yes-Names of arrays to compare
rowsOptional[Union[Tuple[int, int], slice]]noNoneRow slice for comparison
colsOptional[Union[Tuple[int, int], slice]]noNoneColumn slice for comparison
comparison_typestrno'magnitude'Type of comparison ('magnitude', 'phase', 'real', 'imag')

Return Type

Dict[str, Any]

Dict[str, Any]: Comparison results with statistics and data

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ProductHandler

# Constructor arguments are inferred from implementation.
obj = ProductHandler(...)  # inferred from implementation
result = obj.compare_arrays(array_names=<array_names>)

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.

ProductHandler.export_arrays method

Export multiple arrays to files.

File location: sarpyx/utils/zarr_utils.py:1475

Signature

export_arrays(self, output_dir: str, array_names: Optional[List[str]]=None, rows: Optional[Union[Tuple[int, int], slice]]=None, cols: Optional[Union[Tuple[int, int], slice]]=None, format: str='npy') -> None

Parameters

ParameterTypeRequiredDefaultDescription
output_dirstryes-Directory to save exported files
array_namesOptional[List[str]]noNoneArrays to export (default: all)
rowsOptional[Union[Tuple[int, int], slice]]noNoneRow slice to export
colsOptional[Union[Tuple[int, int], slice]]noNoneColumn slice to export
formatstrno'npy'Export format ('npy', 'hdf5')

Return Type

None

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • filesystem
  • io

Example Usage

from sarpyx.utils.zarr_utils import ProductHandler

# Constructor arguments are inferred from implementation.
obj = ProductHandler(...)  # inferred from implementation
result = obj.export_arrays(output_dir=<output_dir>)

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.

ProductHandler.visualize_arrays method

Visualize multiple arrays side by side.

File location: sarpyx/utils/zarr_utils.py:1528

Signature

visualize_arrays(self, array_names: Union[str, List[str]], rows: Tuple[int, int]=(0, 100), cols: Tuple[int, int]=(0, 100), plot_type: str='magnitude', show: bool=True, vminmax: Optional[Union[Tuple[float, float], str]]=(0, 1000), figsize: Tuple[int, int]=(15, 15)) -> None

Parameters

ParameterTypeRequiredDefaultDescription
array_namesUnion[str, List[str]]yes-Array name(s) to visualize
rowsTuple[int, int]no(0, 100)Row range for visualization
colsTuple[int, int]no(0, 100)Column range for visualization
plot_typestrno'magnitude'Type of plot ('magnitude', 'phase', 'real', 'imag')
showboolnoTrueWhether to show the plot or not
vminmaxOptional[Union[Tuple[float, float], str]]no(0, 1000)Min/max values for colorbar or 'auto'
figsizeTuple[int, int]no(15, 15)Figure size for matplotlib

Return Type

None

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.zarr_utils import ProductHandler

# Constructor arguments are inferred from implementation.
obj = ProductHandler(...)  # inferred from implementation
result = obj.visualize_arrays(array_names=<array_names>)

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.