Here is the API reference for the sarxarray package.
SLC stack module
sarxarray.stack.Stack
Methods:
-
mrm–Compute a Mean Reflection Map (MRM).
-
multi_look–Perform multi-looking on a Stack, and return a Stack.
-
point_selection–Select pixels from a Stack, and return a Space-Time Matrix.
mrm
multi_look
Perform multi-looking on a Stack, and return a Stack.
Parameters:
-
data(Dataset) –The data to be multi-looked.
-
window_size(tuple) –Window size for multi-looking, in the format of (azimuth, range)
-
method(str, default:'coarsen') –Method of multi-looking, by default "coarsen"
-
statistics(str, default:'mean') –Statistics method for multi-looking, by default "mean"
-
compute(bool, default:True) –Whether to compute the result, by default True. If False, the result will be
dask.delayed.Delayed. This is useful when the multi_look is used as an intermediate result.
Returns:
-
Dataset–An
xarray.Datasetwith coarsen shape ifcomputeis True, otherwise adask.delayed.Delayedobject.
Source code in sarxarray/stack.py
point_selection
Select pixels from a Stack, and return a Space-Time Matrix.
The selection method is defined by method and threshold.
The selected pixels will be reshaped to (space, time), where space is
the number of selected pixels. The unselected pixels will be discarded.
The original azimuth and range coordinates will be persisted.
Parameters:
-
threshold(float) –Threshold value for selection
-
method(str, default:'amplitude_dispersion') –Method of selection, by default "amplitude_dispersion"
-
chunks(int, default:1000) –Chunk size in the space dimension, by default 1000
Returns:
-
Dataset–An xarray.Dataset with two dimensions: (space, time).
Source code in sarxarray/stack.py
I/O module
sarxarray._io.from_dataset
Create a SLC stack or from an Xarray Dataset.
This function create tasks graph converting the two data variables of complex data:
real and imag, to three variables: complex, amplitude, and phase.
The function is intented for an SLC stack in xr.Dataset loaded from a Zarr file.
For other datasets, such as lat, lon, etc., please use xr.open_zarr directly.
Parameters:
-
ds(Dataset) –SLC stack loaded from a Zarr file. Must have three dimensions:
(azimuth, range, time). Must have two variables:realandimag.
Returns:
-
Dataset–Converted SLC stack. An xarray.Dataset with three dimensions:
(azimuth, range, time), and three variables:complex,amplitude,phase.
Raises:
-
ValueError–The input dataset should have three dimensions:
(azimuth, range, time). -
ValueError–The input dataset should have the following variables:
('real', 'imag').
Source code in sarxarray/_io.py
sarxarray._io.from_binary
Read a SLC stack or related variables from binary files.
Parameters:
-
slc_files(Iterable) –Paths to the SLC files.
-
shape(Tuple) –Shape of each SLC file, in (n_azimuth, n_range)
-
vlabel(str, default:'complex') –Name of the variable to read, by default "complex".
-
dtype(dtype, default:complex64) –Data type of the file to read, by default np.float32
-
chunks(list, default:None) –2-D chunk size, by default None
-
ratio–Ratio of resolutions (azimuth/range), by default 1
Returns:
-
Dataset–An xarray.Dataset with three dimensions: (azimuth, range, time).
Source code in sarxarray/_io.py
Utility
sarxarray.utils.multi_look
Perform multi-looking on a Stack, and return a Stack.
Parameters:
-
data(Dataset or DataArray) –The data to be multi-looked.
-
window_size(tuple) –Window size for multi-looking, in the format of (azimuth, range)
-
method(str, default:'coarsen') –Method of multi-looking, by default "coarsen"
-
statistics(str, default:'mean') –Statistics method for multi-looking, by default "mean"
-
compute(bool, default:True) –Whether to compute the result, by default True. If False, the result will be
dask.delayed.Delayed. This is useful when the multi_look is used as an intermediate result.
Returns:
-
Dataset or DataArray–An
xarray.Datasetorxarray.DataArraywith coarsen shape ifcomputeis True, otherwise adask.delayed.Delayedobject.
Source code in sarxarray/utils.py
sarxarray.utils.complex_coherence
Calculate complex coherence of two images.
Assume two images reference (R) and other (O), the complex coherence is
defined as:
numerator = mean(R * O) in a window
denominator = mean(R * R) * mean(O * O`) in a window
coherence = abs( numerator / sqrt(denominator) ),
See the equation in chapter 28 in doris
documentation
Parameters:
-
reference(DataArray) –The reference image to calculate complex coherence with.
-
other(DataArray) –The other image to calculate complex coherence with.
-
window_size(tuple) –Window size for multi-looking, in the format of (azimuth, range)
-
compute(bool, default:True) –Whether to compute the result, by default True. If False, the result will be
dask.delayed.Delayed. This is useful when the complex_coherence is used as an intermediate result.
Returns:
-
DataArray–An
xarray.DataArrayifcomputeis True, otherwise adask.delayed.Delayedobject.