sarvey package

Submodules

sarvey.coherence module

Coherence module for SARvey.

sarvey.coherence.computeIfgs(*, slc, ifg_array)[source]

ComputeIfgs.

Parameters

slcnp.ndarray

SLC stack.

ifg_arraynp.ndarray

Array containing the indices of the reference and secondary images which are used to compute the interferograms.

Returns

ifgsnp.ndarray

Interferograms.

sarvey.coherence.computeIfgsAndTemporalCoherence(*, path_temp_coh, path_ifgs, path_slc, ifg_array, time_mask, wdw_size, num_boxes, box_list, num_cores, logger)[source]

ComputeIfgsAndTemporalCoherence.

Compute the interferograms and temporal coherence from the SLC stack for a given set of (spatial) patches.

Parameters

path_temp_cohstr

Path to the temporary coherence stack. The data will be stored in this file during processing.

path_ifgsstr

Path to the interferograms stack. The data will be stored in this file during processing.

path_slcstr

Path to the SLC stack. The data will be read from this file.

ifg_arraynp.ndarray

Array containing the indices of the reference and secondary images which are used to compute the interferograms.

time_masknp.ndarray

Binary mask indicating the selected images from the SLC stack.

wdw_sizeint

Size of the filter window. Has to be odd.

num_boxesint

Number of patches to enable reading and processing of larger SLC stacks.

box_listlist

List containing the indices of each patch.

num_coresint

Number of cores for parallel processing.

loggerLogger

Logger object.

Returns

mean_amp_imgnp.ndarray

Mean amplitude image.

sarvey.coherence.launchConvolve2d(args)[source]

LaunchConvolve2d.

Parameters

argstuple

Tuple containing the arguments for the convolution. Tuple contains:

idxint

Index of the processed interferogram.

ifgnp.ndarray

Interferogram.

filter_kernelnp.ndarray

Filter kernel.

Returns

idxint

Index of the processed interferogram.

avg_neighboursnp.ndarray

Low-pass filtered phase derived as average of neighbours.

sarvey.config module

sarvey.console module

Console module for SARvey.

sarvey.console.printCurrentConfig(*, config_section, config_section_default, logger)[source]

Print the current parameters and their default values from the config file to console.

Parameters

config_section: dict

Section of the configuration class which contains the selected parameters.

config_section_default: dict

Config section with default values.

logger: Logger

Logging handler.

sarvey.console.printStep(*, step, step_dict, logger)[source]

Print the current step to console.

Parameters

step: int

current step number

step_dict: dict

dictionary with step numbers and names

logger: Logger

Logging handler

sarvey.console.showLogoSARvey(*, logger, step)[source]

ShowLogoSARvey.

Parameters

logger: Logger

logging handler

step: str

Name of the step or script which is shown on the logo.

sarvey.densification module

Densification module for SARvey.

sarvey.densification.densificationInitializer(tree_p1, point2_obj, demod_phase1)[source]

DensificationInitializer.

Sets values to global variables for parallel processing.

Parameters

tree_p1KDTree

KDTree of the first-order network

point2_objPoints

Points object with second-order points

demod_phase1np.ndarray

demodulated phase of the first-order network

sarvey.densification.densifyNetwork(*, point1_obj, vel_p1, demerr_p1, point2_obj, num_conn_p1, max_dist_p1, velocity_bound, demerr_bound, num_samples, num_cores=1, logger)[source]

DensifyNetwork.

Densifies the network with second-order points by connecting the second-order points to the closest points in the first-order network.

Parameters

point1_objPoints

Points object with first-order points

vel_p1np.ndarray

Velocity array of the first-order points

demerr_p1np.ndarray

DEM error array of the first-order points

point2_objPoints

Points object with second-order points

num_conn_p1int

Number of nearest points in the first-order network

max_dist_p1float

Maximum allowed distance to the nearest points in the first-order network

velocity_boundfloat

Bound for the velocity estimate in temporal unwrapping

demerr_boundfloat

Bound for the DEM error estimate in temporal unwrapping

num_samplesint

Number of samples for the search of the optimal parameters

num_coresint

Number of cores for parallel processing (default: 1)

loggerLogger

Logger object

Returns

demerr_p2np.ndarray

DEM error array of the second-order points

vel_p2np.ndarray

Velocity array of the second-order points

gamma_p2np.ndarray

Estimated temporal coherence array of the second-order points resulting from temporal unwrapping

sarvey.densification.launchDensifyNetworkConsistencyCheck(args)[source]

LaunchDensifyNetworkConsistencyCheck.

Launches the densification of the network with second-order points inside parallel processing.

Parameters

argstuple

Tuple with the following parameters:

idx_rangenp.ndarray

Array with the indices of the second-order points

num_pointsint

Number of second-order points

num_conn_p1int

Number of nearest points in the first-order network

max_dist_p1float

Maximum allowed distance to the nearest points in the first-order network

velocity_boundfloat

Bound for the velocity estimate in temporal unwrapping

demerr_boundfloat

Bound for the DEM error estimate in temporal unwrapping

num_samplesint

Number of samples for the search of the optimal parameters

Returns

idx_rangenp.ndarray

Array with the indices of the second-order points

demerr_p2np.ndarray

DEM error array of the second-order points

vel_p2np.ndarray

Velocity array of the second-order points

gamma_p2np.ndarray

Estimated temporal coherence array of the second-order points resulting from temporal unwrapping

sarvey.filtering module

Filtering module for SARvey.

sarvey.filtering.estimateAtmosphericPhaseScreen(*, residuals, coord_utm1, coord_utm2, num_cores=1, bool_plot=False, logger)[source]

Estimate_atmospheric_phase_screen.

Estimates the atmospheric phase screen from a stack of phase time series for a sparse set of points. Kriging is used to estimate the spatial dependence and to interpolate the phase screen over a set of new points.

Return type:

tuple[ndarray, ndarray]

Parameters

residuals: np.ndarray

residual phase (size: num_points1 x num_images)

coord_utm1: np.ndarray

coordinates in UTM of the points for which the residuals are given (size: num_points1 x 2)

coord_utm2: np.ndarray

coordinates in UTM of the new points which shall be interpolated (size: num_points2 x 2)

num_cores: int

Number of cores

bool_plot: bool

boolean flag to plot intermediate results (default: False)

logger: Logger

Logging handler

Returns

aps1: np.ndarray

atmospheric phase screen for the known points (size: num_points1 x num_images)

aps2: np.ndarray

atmospheric phase screen for the new points (size: num_points2 x num_images)

sarvey.filtering.launchSpatialFiltering(parameters)[source]

Launch_spatial_filtering.

Launches the spatial filtering to estimate the atmospheric phase screen with low-pass filtering.

Parameters

parameters: tuple

Tuple containing the following parameters:

idx_range: np.ndarray

range of indices for the time series

num_time: int

number of time steps

residuals: np.ndarray

residual phase (size: num_points x num_ifgs)

coord_utm1: np.ndarray

coordinates in UTM of the first-order points for which the residuals are given (size: num_points_p1 x 2)

coord_utm2: np.ndarray

coordinates in UTM of the new points which shall be interpolated (size: num_points_p2 x 2)

bins: np.ndarray

bin edges for the variogram

bool_plot: bool

boolean flag to plot intermediate results

logger: Logger

Logging handler

Returns

idx_range: np.ndarray

range of indices for the time series

aps1: np.ndarray

atmospheric phase screen for the known points (size: num_points_p1 x num_ifgs)

aps2: np.ndarray

atmospheric phase screen for the new points (size: num_points_p2 x num_ifgs)

sarvey.filtering.simpleInterpolation(*, residuals, coord_utm1, coord_utm2, interp_method='linear')[source]

SimpleInterpolation.

Simple interpolation of atmospheric phase screen using scipy’s griddata function with options “linear” or “cubic”. For pixels outside the convex hull of the input points, the nearest neighbor is used.

Parameters

residuals: np.ndarray

residual phase (size: num_points x num_ifgs)

coord_utm1: np.ndarray

coordinates in UTM of the points for which the residuals are given (size: num_points_p1 x 2)

coord_utm2: np.ndarray

coordinates in UTM of the new points which shall be interpolated (size: num_points_p2 x 2)

interp_method: str

interpolation method (default: “linear”; options: “linear”, “cubic”)

Returns

aps1: np.ndarray

atmospheric phase screen for the known points (size: num_points_p1 x num_images)

aps2: np.ndarray

atmospheric phase screen for the new points (size: num_points_p2 x num_images)

sarvey.geolocation module

Module for correcting the geolocation of the scatterers.

sarvey.geolocation.calculateGeolocationCorrection(*, path_geom, point_obj, demerr, logger)[source]

Calculate geolocation correction.

Parameters

path_geom: str

Path to directory containing ‘slcStack.h5’ or ‘geometryRadar.h5’.

point_obj: Points

Point object with incidence angle for points

demerr: np.array

Array of dem error per pixel

logger: Logger

Logger handle

Returns

coord_correction: np.array

array of geolocation corrections, two columns [x_correction, y_correction] per point.

sarvey.geolocation.getHeading(input_path, logger)[source]

Read heading angle from slcStack.h5.

Parameters

input_path: str

Path to directory containing ‘slcStack.h5’ and ‘geometryRadar.h5’.

logger: Logger

Logger handle

Returns

heading_angle: float

heading angle of the satellite in radians for ascending ~ -12*pi/180 for descending ~ 190*pi/180

sarvey.ifg_network module

IfgNetwork module for SARvey.

class sarvey.ifg_network.DelaunayNetwork[source]

Bases: IfgNetwork

Delaunay network of interferograms which restricts both the temporal and perpendicular baselines.

Init.

configure(*, pbase, tbase, dates)[source]

Create list of interferograms containing the indices of the images and computes baselines.

Parameter

pbase: np.ndarray

perpendicular baselines of the SAR acquisitions, array

tbase: np.ndarray

temporal baselines of the SAR acquisitions, array

dates: list

Dates of the acquisitions, list.

class sarvey.ifg_network.IfgNetwork[source]

Bases: object

Abstract class/interface for different types of interferogram networks.

Init.

getDesignMatrix()[source]

Compute the design matrix for the smallbaseline network.

ifg_list: Union[list, ndarray] = None
open(*, path)[source]

Read stored information from already existing.h5 file.

Parameter

path: str

path to existing file to read from.

plot()[source]

Plot the network of interferograms.

writeToFile(*, path, logger)[source]

Write all existing data to .h5 file.

Parameters

path: str

path to filename

logger: Logger

Logging handler.

class sarvey.ifg_network.SmallBaselineNetwork[source]

Bases: IfgNetwork

Small baseline network of interferograms restricting both temporal and spatial baselines.

Init.

configure(*, pbase, tbase, num_link, max_tbase, dates)[source]

Create list of interferograms containing the indices of the images and computes baselines.

Parameter

pbase: np.ndarray

perpendicular baselines of the SAR acquisitions.

tbase: np.ndarray

temporal baselines of the SAR acquisitions.

max_tbase: int

maximum temporal baseline in [days] (default: None).

num_link: int

number of links within the range of maximum temporal baseline.

dates: list

Dates of the acquisitions.

class sarvey.ifg_network.SmallBaselineYearlyNetwork[source]

Bases: IfgNetwork

Small baseline network of interferograms with yearly connections.

Init.

configure(*, pbase, tbase, num_link=None, dates)[source]

Create list of interferograms containing the indices of the images and computes baselines.

Parameter

pbase: np.ndarray

perpendicular baselines of the SAR acquisitions, array

tbase: np.ndarray

temporal baselines of the SAR acquisitions, array

num_link: int

Number of consecutive links in time connecting acquisitions.

dates: list

Dates of the acquisitions, list.

class sarvey.ifg_network.SmallTemporalBaselinesNetwork[source]

Bases: IfgNetwork

Small temporal baselines network of interferograms without restrictions on the perpendicular baselines.

Init.

configure(*, pbase, tbase, num_link=None, dates)[source]

Create list of interferograms containing the indices of the images and computes baselines.

Parameter

pbase: np.ndarray

Perpendicular baselines of the SAR acquisitions.

tbase: np.ndarray

Temporal baselines of the SAR acquisitions.

num_link: int

Number of consecutive links in time connecting acquisitions.

dates: list

Dates of the acquisitions.

class sarvey.ifg_network.StarNetwork[source]

Bases: IfgNetwork

Star network of interferograms (single-reference).

Init.

configure(*, pbase, tbase, ref_idx, dates)[source]

Create list of interferograms containing the indices of the images and computes baselines.

Parameter

pbase: np.ndarray

Perpendicular baselines of the SAR acquisitions.

tbase: np.ndarray

Temporal baselines of the SAR acquisitions.

ref_idx: int

Index of the reference image.

dates: list

Dates of the acquisitions.

sarvey.objects module

Objects module for SARvey.

class sarvey.objects.AmplitudeImage(*, file_path)[source]

Bases: object

AmplitudeImage.

Init.

Parameters

file_path: str

path to filename

open()[source]

Open.

plot(*, ax=None, logger)[source]

Plot the mean amplitude image as a background map.

Parameters

ax: plt.Axes

axes for plotting (default: None, a new figure will be created).

logger: Logger

Logging handler.

Return

ax: plt.Axes

axes object.

prepare(*, slc_stack_obj, img, logger)[source]

Read the SLC stack, compute the mean amplitude image and store it into a file.

Parameters

slc_stack_obj: slcStack

object of class slcStack from MiaplPy

img: np.ndarray

amplitude image, e.g. the mean over time

logger: Logger

Logging handler

class sarvey.objects.BaseStack(*, file=None, logger)[source]

Bases: object

Class for 3D image-like data stacks.

Init.

Parameters

file: str

path to filename

logger: Logger

Logging handler.

close(*, print_msg=True)[source]

Close.

getShape(*, dataset_name)[source]

Open file and read shape of dataset.

prepareDataset(dataset_name, dshape, dtype, metadata, mode='w', chunks=True)[source]

PrepareDataset. Creates a dataset in file with specified size without writing any data.

Parameters

dataset_name: str

name of dataset.

dshape: tuple

shape of dataset.

dtype: object

data type of dataset.

metadata: dict

metadata of dataset (e.g. WAVELENGTH, ORBIT_DIRECTION, etc.). Usually the same as in slcStack.h5.

mode: str

open mode (‘w’ for writing new file or ‘a’ for appending to existing file).

chunks: tuple

chunk size (‘True’/’False’ or tuple specifying the dimension of the chunks)

read(*, dataset_name, box=None, print_msg=True)[source]

Read dataset from slc file.

Parameters

dataset_name: str

name of dataset

box: tuple

tuple of 4 int, indicating x0,y0,x1,y1 of range, or tuple of 6 int, indicating x0,y0,z0,x1,y1,z1 of range

print_msg: bool

print message.

Returns

data: np.ndarray

2D or 3D dataset

writeToFile(*, data, dataset_name, metadata=None, mode='a', chunks=True)[source]

Write the whole dataset to the file (not block-by-block).

Parameters

data: np.ndarray

3D data array.

dataset_name: str

name of dataset.

metadata: dict

metadata of dataset (e.g. WAVELENGTH, ORBIT_DIRECTION, etc.). Usually the same as in slcStack.h5.

mode: str

mode for opening the h5 file (e.g. write: ‘w’ or append: ‘a’)

chunks: tuple

chunk size (‘True’/’False’ or tuple specifying the dimension of the chunks)

writeToFileBlock(*, data, dataset_name, block=None, mode='a', print_msg=True)[source]

Write data to existing HDF5 dataset in disk block by block.

Parameters

data: np.ndarray

1/2/3D matrix.

dataset_name: str

dataset name.

block: list

the list can contain 2, 4 or 6 integers indicating: [zStart, zEnd, yStart, yEnd, xStart, xEnd].

mode: str

open mode (‘w’ for writing new file or ‘a’ for appending to existing file).

print_msg: bool

print message.

Returns

file: str

path to file

class sarvey.objects.CoordinatesUTM(*, file_path, logger)[source]

Bases: object

Coordinates in UTM for all pixels in the radar image.

Init.

Parameters

file_path: str

path to filename

logger: Logger

Logging handler.

open()[source]

Open.

prepare(*, input_path)[source]

Read the slc stack, computes the mean amplitude image and stores it into a file.

Parameters

input_path: str

path to slcStack.h5 file.

class sarvey.objects.Network(*, file_path, logger)[source]

Bases: object

Spatial network of PS candidates.

Init.

Parameters

file_path: str

absolute path to working directory for creating/loading ‘psNetwork.h5’

logger: Logger

Logging handler.

computeArcObservations(*, point_obj, arcs)[source]

Compute the phase observations for each arc.

Compute double difference phase observations, i.e. the phase differences for each arc in the network from the phase of the two scatterers connected by the arc.

Parameters

point_obj: Points

object of class Points.

arcs: np.ndarray

Array with the indices of the points connected by an arc.

open(*, input_path)[source]

Read stored information from existing .h5 file.

openExternalData(*, input_path)[source]

Read data from slcStack.h5 and IfgNetwork.h5 files.

removeArcs(*, mask)[source]

Remove arcs from the list of arcs in the network.

Parameter

mask: np.ndarray

mask to select arcs to be kept, rest will be removed.

writeToFile()[source]

Write all existing data to psNetwork.h5 file.

class sarvey.objects.NetworkParameter(*, file_path, logger)[source]

Bases: Network

Spatial Network with the estimated parameters of each arc in the network.

Init.

open(*, input_path)[source]

Read data from file.

prepare(*, net_obj, demerr, vel, gamma)[source]

Prepare.

Parameter

net_obj: Network

object of class Network.

demerr: np.ndarray

estimated DEM error for each arc in the network.

vel: np.ndarray

estimated velocity for each arc in the network.

gamma: np.ndarray

estimated temporal coherence for each arc in the network.

writeToFile()[source]

Write DEM error, velocity and temporal coherence to file.

class sarvey.objects.Points(*, file_path, logger)[source]

Bases: object

Points class for storing information about the selected scatterers.

Init.

Parameters

file_path: str

ath to filename

logger: Logger

Logging handler.

addPointsFromObj(*, new_point_id, new_coord_xy, new_phase, new_num_points, input_path)[source]

Add new points and their attributes to the existing data.

Parameters

new_point_id: np.ndarray

point_id of the new scatterers.

new_coord_xy: np.ndarray

radar coordinates of the new scatterers.

new_phase: np.ndarray

phase of the new scatterers.

new_num_points: int

number of new points.

input_path: str

path to input files (slcStack.h5, geometryRadar.h5).

coord_xy: array
createMask()[source]

Create a mask.

Create a mask in the size of the radar image which is used to read the geometry and SLC data for the selected scatterers.

file_path: str
length: int
num_points: int
open(input_path, other_file_path=None)[source]

Read data from file.

Read stored information from already existing .h5 file. This can be the file of the object itself. If the data should be read from another file, the path to this file can be given as ‘other_file_path’. Thereby, a new Points object can be created with the data of another Points object.

Parameters

input_path: str

path to input files (slcStack.h5, geometryRadar.h5).

other_file_path: str

path to other .h5 file (default: None).

openExternalData(*, input_path)[source]

Load data which is stored in slcStack.h5, geometryRadar.h5, ifg_network.h5 and coordinates_utm.h5.

phase: array
point_id: array
prepare(*, point_id, coord_xy, input_path)[source]

Assign point_id and radar coordinates to the object.

Store the point_id and radar coordinates of the scatterers in the object (not file) and read further attributes from external files (ifg_network.h5, slcStack.h5, geometryRadar.h5, coordinates_utm.h5).

Parameters

point_id: np.ndarray

point_id of the scatterers.

coord_xy: np.ndarray

radar coordinates of the scatterers.

input_path: str

path to input files (slcStack.h5, geometryRadar.h5).

removePoints(mask=None, *, keep_id, input_path)[source]

Remove all entries from specified points.

The possible options exist for removing the points: a) Keep all points which are set to True in a ‘mask’ with size (num_points x 1). Or b) Keep all points whose ID is listed in keep_id. The rest of the points will be removed.

Parameters

mask: np.ndarray

mask to select points to be kept, rest will be removed (default: None).

keep_id: np.ndarray

list of point_id to keep.

input_path: str

path to input files (slcStack.h5, geometryRadar.h5).

times: None
wavelength: float
width: int
writeToFile()[source]

Write data to .h5 file (num_points, coord_xy, point_id, phase).

sarvey.osm_utils module

Osm utils module for SARvey.

sarvey.osm_utils.getSpatialExtend(*, geom_file, logger)[source]

Get spatial extend of the radar image.

Parameters

geom_file: str

path of geometryRadar.h5 file

logger: Logger

Logging handler.

Returns

ll_corner_wgs: list

list of coordinates of the lower-left corner of the radar image in WGS84 coordinates.

ur_corner_wgs: list

list of coordinates of the upper-right corner of the radar image in WGS84 coordinates.

coord: np.ndarray

coordinates of all pixels in the radar image in WGS84.

atr: dict

metadata dictionary from geometryRadar.h5.

sarvey.osm_utils.runOsmQuery(*, ll_corner_wgs, ur_corner_wgs, type_list, logger)[source]

Query OSM database for transport infrastructure within the spatial extent of the radar image.

Return type:

Result

Parameters

ll_corner_wgs: np.ndarray

coordinates of the lower-left corner of the radar image in WGS84 coordinates.

ur_corner_wgs: np.ndarray

coordinates of the upper-right corner of the radar image in WGS84 coordinates.

type_list: list

List of street types that shall be queried at the OSM database.

logger: Logger

Logging handler.

Returns

result: overpy.Result

results of the overpy query to OSM database.

sarvey.osm_utils.runOsmQueryBridge(*, ll_corner_wgs, ur_corner_wgs, bridge_highway, bridge_railway, logger)[source]

Query OSM database for bridges of transport infrastructure within the spatial extent of the radar image.

Return type:

Result

Parameters

ll_corner_wgs: np.ndarray

coordinates of the lower-left corner of the radar image in WGS84 coordinates.

ur_corner_wgs: np.ndarray

coordinates of the upper-right corner of the radar image in WGS84 coordinates.

bridge_highway: bool

Set true to query highway bridges.

bridge_railway: bool

Set true to query railway bridges.

logger: Logger

Logging handler.

Returns

result: overpy.Result

results of the overpy query to OSM database.

sarvey.preparation module

Preparation module for SARvey.

sarvey.preparation.createArcsBetweenPoints(*, point_obj, knn=None, max_arc_length=inf, logger)[source]

Create a spatial network of arcs to triangulate the points.

All points are triangulated with a Delaunay triangulation. If knn is given, the triangulation is done with the k nearest neighbors. Too long arcs are removed from the network. If, afterward, the network is not connected, a delaunay triangulation is performed again to ensure connectivity in the network.

Return type:

ndarray

Parameters

point_obj: Points

Point object.

knn: int

Number of nearest neighbors to consider (default: None).

max_arc_length: float

Maximum length of an arc. Longer arcs will be removed. Default: np.inf.

logger: Logger

Logging handler.

Returns

arcs: np.ndarray

Arcs of the triangulation containing the indices of the points for each arc.

sarvey.preparation.createTimeMaskFromDates(*, start_date, stop_date, date_list, logger)[source]

Create a mask with selected dates within given time frame.

Parameters

start_date: str

Start date.

stop_date: str

Stop date.

date_list: list

all avaiable dates in the slcStack.h5.

logger: Logger

Logging handler.

Returns

time_mask: np.ndarray

mask with True for selected dates.

num_slc: int

number of selected images.

result_date_list: list

list of selected dates.

sarvey.preparation.readCoherenceFromMiaplpy(*, path, box=None, logger)[source]

Read the coherence image from phase-linking of MiaplPy.

Return type:

tuple[ndarray, dict]

Parameters

path: str

Path to phase_series.h5 file.

box: tuple

Bounding Box to read from.

logger: Logger

Logging handler.

Returns

temp_coh: np.ndarray

temporal coherence image from phase-linking results of MiaplPy.

sarvey.preparation.readSlcFromMiaplpy(*, path, box=None, logger)[source]

Read SLC data from phase-linking results of Miaplpy.

Return type:

ndarray

Parameters

path: str

Path to the phase_series.h5 file.

box: tuple

Bounding Box to read from.

logger: Logger

Logging handler.

Returns

slc: np.ndarray

slc stack created from phase-linking results.

sarvey.preparation.selectPixels(*, path, selection_method, thrsh, grid_size=None, bool_plot=False, logger)[source]

Select pixels based on temporal coherence.

Parameters

path: str

Path to the directory with the temporal_coherence.h5 file.

selection_method: str

Pixel selection method. Currently, only “temp_coh” is implemented.

thrsh: float

Threshold for pixel selection.

grid_size: int

Grid size for sparse pixel selection.

bool_plot: bool

Plot the selected pixels.

logger: Logger

Logging handler.

Returns

cand_mask: np.ndarray

Mask with selected pixels.

sarvey.processing module

sarvey.sarvey_export module

sarvey.sarvey_mask module

Generate mask from shape file.

class sarvey.sarvey_mask.CoordinateSearch[source]

Bases: object

CoordinateSearch.

Init.

createSearchTree(*, coord, logger)[source]

Create search tree.

Parameters

coord: utils.coordinate

Coordinates

logger: Logger

Logging handler.

getMeanDistanceBetweenPixels()[source]

Compute mean distance between adjacent pixels.

getNearestNeighbour(*, node)[source]

Query the kd-tree for the nearest neighbour.

Parameters:

node (Node) – Node object

class sarvey.sarvey_mask.Node(*, lat=None, lon=None)[source]

Bases: object

Define simple class for a node at a road (similar to overpy.Node).

Init.

sarvey.sarvey_mask.computeLastRoadPixel(*, cur_node, prev_node, found_node)[source]

Compute the location of the pixel at the border of the radar image that is part of the road.

Parameters

cur_node: Node

Current node of the road.

prev_node: Node

Previous node of the road.

found_node: Node

Found node of the road.

Returns

new_lon: float

Longitude of the pixel at the border of the radar image that is part of the road.

new_lat: float

Latitude of the pixel at the border of the radar image that is part of the road.

sarvey.sarvey_mask.convertToRadarCoord(*, gdf_infra, csearch, width, logger)[source]

Convert Polyline to a mask in shape of radar image. Apply a buffer of size ‘width’ in pixels.

Parameters

gdf_infra: gpd.geodataframe

The queried infrastructures containing polygons.

csearch: CoordinateSearch

The coordinate search object.

width: int

Width of the mask in pixel.

logger: Logger

Logging handler.

Returns

img_np: np.ndarray

Mask image.

sarvey.sarvey_mask.convertToRadarCoordPolygon(*, gdf_infra, csearch, logger)[source]

Convert Polygon to a mask in shape of radar image.

Parameters

gdf_infra: gpd.geodataframe

The queried infrastructures containing polygons.

csearch: CoordinateSearch

The coordinate search object.

logger: Logger

Logging handler.

Returns

img_np: np.ndarray

Mask image.

sarvey.sarvey_mask.createMask(*, input_file, width, work_dir, out_file_name, geom_file, logger)[source]

Create a mask for the radar image from a shapefile containing lines or polygons.

Parameters

input_file: str

Path to input file.

width: int

Width of the mask in pixel. Applied to the lines only.

work_dir: str

Working directory.

out_file_name: str

Output file name.

geom_file: str

Path to geometryRadar.h5 file.

logger: logging.Logger

Logging handler.

sarvey.sarvey_mask.create_parser()[source]

Create_parser.

sarvey.sarvey_mask.euclDist(*, node1, node2)[source]

Compute the euclidean distance between two nodes.

sarvey.sarvey_mask.findLastRoadPixel(*, csearch, cur_node, prev_node, dist_thrsh)[source]

Find the index of the last road pixel that is within the image extend.

Idea: the pixel with the shortest distance to the current node of a road is not necessarily on the road, if the current node is outside the image extend. Split the road in further linear parts and find the last road pixel recursively that is still inside the image. Hint: all nodes are instances from class Node

Parameters

csearch: CoordinateSearch

Search tree for efficient spatial search of the coordinate of a pixel in the radar image.

cur_node: Node

Current node of the road that is outside the image extend.

prev_node: Node

Previous node of the road that is inside the image extend.

dist_thrsh: float

Distance threshold for stop criterion (derived from average distance between two pixels in the image).

Returns

node_idx: int

Node of the pixel which is the last pixel on the road inside the image.

sarvey.sarvey_mask.main(iargs=None)[source]

Create mask from lines or polygons given in geographic coordinates (EPSG:4326). Input as shp or gpkg.

sarvey.sarvey_mask.saveMask(*, work_dir, mask, atr, out_file_name)[source]

Save the mask to ‘maskRoads.h5’.

Parameters

work_dir: str

Working directory.

mask: np.ndarray

Mask image.

atr: dict

Metadata data, e.g. from the geometryRadar.h5 file.

out_file_name: str

Output file name.

sarvey.sarvey_mti module

sarvey.sarvey_osm module

Download openstreetmap data for area of interest.

sarvey.sarvey_osm.create_parser()[source]

Create_parser.

sarvey.sarvey_osm.downloadOSM(*, railway, highway, bridge, work_dir, out_file_name, logger, geom_file)[source]

Download openstreetmap data and store to file.

Parameters

railway: bool

download railway data.

highway: bool

download highway data.

bridge: bool

download bridge data.

work_dir: str

working directory.

out_file_name: str

output file name.

logger: logging.Logger

logger.

geom_file: str

path to geometryRadar.h5 file.

sarvey.sarvey_osm.main(iargs=None)[source]

Download openstreetmap data and store to file.

sarvey.sarvey_plot module

sarvey.triangulation module

Triangulation module for SARvey.

class sarvey.triangulation.PointNetworkTriangulation(*, coord_xy, coord_utmxy, logger)[source]

Bases: object

PointNetworkTriangulation.

Triangulate points in space based on distance.

Parameters

coord_xy: np.ndarray

Radar coordinates of the points.

coord_utmxy: np.ndarray

UTM coordinates of the points.

logger: Logger

Logging handler.

getArcsFromAdjMat()[source]

Convert the adjacency matrix into a list of arcs.

Returns

arcs: np.ndarray

List of arcs with indices of the start and end point.

isConnected()[source]

Check if the network is connected.

removeLongArcs(*, max_dist)[source]

Remove arcs from network which are longer than given threshold.

Parameter

max_dist: float

distance threshold on arc length in [m]

triangulateGlobal()[source]

Connect the points with a GLOBAL delaunay triangulation.

triangulateKnn(*, k)[source]

Connect points to the k-nearest neighbours.

sarvey.unwrapping module

Unwrapping module for SARvey.

sarvey.unwrapping.computeAvgCoherencePerPoint(*, net_obj, point_id, logger)[source]

Compute the average coherence from all arcs that a point is connected with. Used to remove incoherent points.

Return type:

ndarray

Parameters

net_obj: Network

The Network object.

point_id: np.ndarray

ID of the points in the network.

logger: Logger

Logging handler.

Returns

mean_gamma_point: np.ndarray

Average coherence per point

sarvey.unwrapping.computeNumArcsPerPoints(*, net_obj, point_id, logger)[source]

Remove Points with less than specified number of arcs.

Return type:

tuple[ndarray, ndarray]

Parameters

net_obj: Network

The spatial Network object.

point_id: np.ndarray

ID of the points in the network.

logger: Logger

Logging handler.

Returns

design_mat: np.ndarray

Design matrix of the spatial network

arcs_per_point: np.ndarray

Number of arcs that each point is connected with.

sarvey.unwrapping.findOptimum(*, obs_phase, design_mat, val_range)[source]

Find optimal value within a one dimensional search space that fits to the observed phase.

Parameters

obs_phase: np.ndarray

Observed phase of the arc.

design_mat: np.ndarray

Design matrix for estimating parameters from arc phase.

val_range: np.ndarray

Range of possible values for the solution. Can be either for DEM error or velocity.

Returns

opt_val: scipy.optimize.minimize return value gamma: float pred_phase: np.ndarray

sarvey.unwrapping.gradientSearchTemporalCoherence(*, scale_vel, scale_demerr, obs_phase, design_mat, x0)[source]

GradientSearchTemporalCoherence.

Parameters

scale_demerr: float

Scaling factor for DEM error to equalize the axis of the search space.

scale_vel: float

Scaling factor for velocity to equalize the axis of the search space.

design_mat: np.ndarray

Design matrix for estimating parameters from arc phase.

obs_phase: np.ndarray

Observed phase of the arc.

x0: np.ndarray

Initial values for optimization.

Returns

demerr: float vel: float gamma: float

sarvey.unwrapping.gridSearchTemporalCoherence(*, demerr_grid, vel_grid, design_mat, obs_phase)[source]

Grid search which maximizes the temporal coherence as the objective function.

Parameters

demerr_grid: np.ndarray

Search space for the DEM error in a 2D grid.

vel_grid: np.ndarray

Search space for the velocity in a 2D grid.

design_mat: np.ndarray

Design matrix for estimating parameters from arc phase.

obs_phase: np.ndarray

Observed phase of the arc.

Returns

demerr: float

estimated DEM error.

vel: float

estimated velocity.

gamma: float

estimated temporal coherence.

sarvey.unwrapping.launchAmbiguityFunctionSearch(parameters)[source]

Wrap for launching ambiguity function for temporal unwrapping in parallel.

Parameters

parameters: tuple

Arguments for temporal unwrapping in parallel.

Returns

arc_idx_range: np.ndarray demerr: np.ndarray vel: np.ndarray gamma: np.ndarray

sarvey.unwrapping.launchSpatialUnwrapping(parameters)[source]

LaunchSpatialUnwrapping.

Return type:

tuple[ndarray, ndarray]

Parameters

parameters: tuple

idx_range, num_ifgs, num_points, edges, phase

Returns

idx_range: np.ndarray unw_phase: np.ndarray

sarvey.unwrapping.objFuncTemporalCoherence(x, *args)[source]

Compute temporal coherence from parameters and phase. To be used as objective function for optimization.

Parameters

x: np.ndarray

Search space for the DEM error in a 1D grid.

args: tuple

Additional arguments: (design_mat, obs_phase, scale_vel, scale_demerr).

Returns

1 - gamma: float

sarvey.unwrapping.oneDimSearchTemporalCoherence(*, demerr_range, vel_range, obs_phase, design_mat)[source]

One dimensional search for maximum temporal coherence that fits the observed arc phase.

Parameters

demerr_range: np.ndarray

Search space for the DEM error in a 1D grid.

vel_range: np.ndarray

Search space for the velocity in a 1D grid.

design_mat: np.ndarray

Design matrix for estimating parameters from arc phase.

obs_phase: np.ndarray

Observed phase of the arc.

Returns

demerr: float vel: float gamma: float

sarvey.unwrapping.parameterBasedNoisyPointRemoval(*, net_par_obj, point_id, coord_xy, design_mat, rmse_thrsh=0.02, num_points_remove=1, bmap_obj=None, bool_plot=False, logger)[source]

Remove Points during spatial integration step if residuals at many connected arcs are high.

The idea is similar to outlier removal in DePSI, but without hypothesis testing. It can be used as a preprocessing step to spatial integration. The points are removed based on the RMSE computed from the residuals of the parameters (DEM error, velocity) per arc. The point with the highest RMSE is removed in each iteration. The process stops when the maximum RMSE is below a threshold.

Parameters

net_par_obj: NetworkParameter

The spatial NetworkParameter object containing the parameters estimates at each arc.

point_id: np.ndarray

ID of the points in the network.

coord_xy: np.ndarray

Radar coordinates of the points in the spatial network.

design_mat: np.ndarray

Design matrix describing the relation between arcs and points.

rmse_thrsh: float

Threshold for the RMSE of the residuals per point. Default = 0.02.

num_points_remove: int

Number of points to remove in each iteration. Default = 1.

bmap_obj: AmplitudeImage

Basemap object for plotting. Default = None.

bool_plot: bool

Plot the RMSE per point. Default = False.

logger: Logger

Logging handler.

Returns

spatial_ref_id: int

ID of the spatial reference point.

point_id: np.ndarray

ID of the points in the network without the removed points.

net_par_obj: NetworkParameter

The NetworkParameter object without the removed points.

sarvey.unwrapping.removeArcsByPointMask(*, net_obj, point_id, coord_xy, p_mask, design_mat, logger)[source]

Remove all entries related to the arc observations connected to the points which have a False value in p_mask.

Return type:

tuple[Network, ndarray, ndarray, ndarray]

Parameters

net_obj: Network

The Network object.

point_id: np.ndarray

ID of the points in the network.

coord_xy: np.ndarray

Radar coordinates of the points in the spatial network.

p_mask: np.ndarray

Boolean mask with True for points to keep, and False for points to remove.

design_mat: np.ndarray

Design matrix describing the relation between arcs and points.

logger: Logger

Logging handler.

Returns

net_obj: Network

Network object without the removed arcs and points.

point_id: np.ndarray

ID of the points in the network without the removed points.

coord_xy: np.ndarray

Radar coordinates of the points in the spatial network without the removed points.

design_mat: np.ndarray

Design matrix describing the relation between arcs and points without the removed points and arcs.

sarvey.unwrapping.removeGrossOutliers(*, net_obj, point_id, coord_xy, min_num_arc=3, quality_thrsh=0.0, logger)[source]

Remove both gross outliers which have many low quality arcs and points which are not well connected.

Return type:

tuple[Network, ndarray, ndarray, ndarray]

Parameters

net_obj: Network

The spatial Network object.

point_id: np.ndarray

ID of the points in the network.

coord_xy: np.ndarray

Radar coordinates of the points in the spatial network.

min_num_arc: int

Threshold on the minimal number of arcs per point. Default = 3.

quality_thrsh: float

Threshold on the temporal coherence of the arcs. Default = 0.0.

logger: Logger

Logging handler.

Returns

net_obj: Network

Network object without the removed arcs and points.

point_id: np.ndarray

ID of the points in the network without the removed points.

coord_xy: np.ndarray

Radar coordinates of the points in the spatial network without the removed points.

a: np.ndarray

Design matrix describing the relation between arcs and points without the removed points and arcs.

sarvey.unwrapping.spatialParameterIntegration(*, val_arcs, arcs, coord_xy, weights, spatial_ref_idx=0, logger)[source]

Unwrapping double-difference arc parameters spatially.

The parameters at the arcs are integrated spatially to the points. The integration is done using least-squares.

Parameters

val_arcs: np.ndarray

Value at the arcs (e.g. DEM error, velocity).

arcs: np.ndarray

Arcs of the spatial network.

coord_xy: np.ndarray

Radar coordinates of the points in the spatial network.

weights: np.ndarray

Weights of the arcs (e.g. temporal coherence from temporal unwrapping)

spatial_ref_idx: int

Index of the spatial reference point (default = 0). Can be arbitrary.

logger: Logger

Logging handler

Returns

val_points: np.ndarray

Estimated parameters at the points resulting from the integration of the parameters at the arcs.

sarvey.unwrapping.spatialParameterIntegrationIterative(*, val_arcs, all_arcs, coord_xy, all_weights, spatial_ref_idx=0, res_tol=0.001, max_rm_fraction=0.001, logger)[source]

Unwrapping double-difference arc parameters spatially.

The parameters at the arcs are integrated spatially to the points. The integration is done iteratively using least-squares by removing the arcs with the highest residuals in each iteration. The integration stops when the sum of the residuals is below a threshold. Function is adopted from StaMPS software (Hooper et al., 2007).

Parameters

val_arcs: np.ndarray

Value at the arcs (e.g. DEM error, velocity).

all_arcs: np.ndarray

Arcs of the spatial network.

coord_xy: np.ndarray

Radar coordinates of the points in the spatial network.

all_weights: np.ndarray

Weights of the arcs (e.g. temporal coherence from temporal unwrapping)

spatial_ref_idx: int

Index of the spatial reference point (default = 0). Can be arbitrary.

res_tol: float

Threshold on the sum of the residual phase (default = 1e-3). Convergence criterion.

max_rm_fraction: float

Fraction of the arcs that are removed in each iteration (default = 0.001).

logger: Logger

Logging handler

Returns

val_points: np.ndarray

Estimated parameters at the points resulting from the integration of the parameters at the arcs.

sarvey.unwrapping.spatialUnwrapping(*, num_ifgs, num_points, phase, edges, method, num_cores, logger)[source]

Spatial unwrapping of interferograms for a set of points.

Parameters

num_ifgs: int

Number of interferograms.

num_points: int

Number of points.

phase: np.ndarray

Phase of the interferograms at the points.

edges: np.ndarray

Edges/arcs of the graph.

method: str

Method for spatial unwrapping (puma or ilp).

num_cores: int

Number of cores to be used in multiprocessing.

logger: Logger

Logging handler.

Returns

unw_phase: np.ndarray

Unwrapped phase of the interferograms at the points.

sarvey.unwrapping.temporalUnwrapping(*, ifg_net_obj, net_obj, wavelength, velocity_bound, demerr_bound, num_samples, num_cores=1, logger)[source]

Solve ambiguities for every arc in spatial Network object.

Return type:

tuple[ndarray, ndarray, ndarray]

Parameters

ifg_net_obj: IfgNetwork

The IfgNetwork object.

net_obj: Network

The Network object.

wavelength: float

The wavelength.

velocity_bound: float

The velocity bound.

demerr_bound: float

The DEM error bound.

num_samples: int

The number of samples for the search space.

num_cores: int

Number of cores to be used. Default is 1.

logger: Logger

Logging handler.

Returns

demerr: np.ndarray vel: np.ndarray gamma: np.ndarray

sarvey.utils module

Utils module for SARvey.

sarvey.utils.checkIfRequiredFilesExist(*, path_to_files, required_files, logger)[source]

Check if all required files exist from previous processing steps.

Parameters

path_to_files: str

path to the files

required_files: list

list of required files which are all checked

logger: Logger

logging handler

Raises

FileNotFoundError

if a required file is missing

sarvey.utils.convertBboxToBlock(*, bbox)[source]

ConvertBboxToBlock. read box and write2hdf5_block block have different definitions.

sarvey.utils.createSpatialGrid(*, coord_utm_img, length, width, grid_size)[source]

Create a spatial grid over the image.

Parameters

coord_utm_img: np.ndarray

coordinates of all image pixels in UTM

length: int

number of pixels in length of the image

width: int

number of pixels in width of the image

grid_size: int

size of the grid in [m]

Returns

box_list: list

of tuples with the radar coordinates of the boxes

num_box: int

actual number of boxes created by the function

sarvey.utils.detectValidAreas(*, bmap_obj, logger)[source]

Detect valid areas based on amplitude image.

Parameters

bmap_obj: AmplitudeImage

instance of class AmplitudeImage

logger: Logger

logging handler

Returns

mask_valid_area: np.ndarray

boolean mask of the valid areas

sarvey.utils.estimateParameters(*, obj, estimate_ref_atmo=True, ifg_space=True)[source]

Estimate the parameters either per point or per arc.

Parameters are velocity and DEM error (or additionally reference APS).

Parameters

obj: Union[Points, Network]

object of either network, networkParameter, points or pointsParameters

estimate_ref_atmo: bool

set to True if APS of reference date shall be estimated. corresponds to offset of linear motion model (default: False).

ifg_space: bool

set to True if the phase shall be predicted in interferogram space. If False, phase will be predicted in acquisition space. (default: True)

Returns

vel: np.ndarray

velocity for each point

demerr: np.ndarray

dem error for each point

ref_atmo: np.ndarray

reference APS for each point

omega:

sum of squared residuals

v_hat:

residuals

sarvey.utils.invertIfgNetwork(*, phase, num_points, ifg_net_obj, num_cores, ref_idx, logger)[source]

Wrap the ifg network inversion running in parallel.

Parameters

phase: np.ndarray

interferometric phases of the points.

num_points: int

number of points.

ifg_net_obj: IfgNetwork

instance of class IfgNetwork.

num_cores: int

number of cores to use for multiprocessing.

ref_idx: int

index of temporal reference date for interferogram network inversion.

logger: Logger

logging handler

Returns

phase_ts: np.ndarray

inverted phase time series of the points.

sarvey.utils.launchInvertIfgNetwork(parameters)[source]

Launch the inversion of the interferogram network in parallel.

Parameters

parameters: tuple

parameters for inversion

Tuple contains:
idx_range: np.ndarray

range of point indices to be processed

num_points: int

number of points

phase: np.ndarray

interferometric phases of the points

design_mat: np.ndarray

design matrix

num_images: int

number of images

ref_idx: int

index of temporal reference date for interferogram network inversion

Returns

idx_range: np.ndarray

range of indices of the points processed

phase_ts: np.ndarray

inverted phase time series

sarvey.utils.predictPhase(*, obj, vel=None, demerr=None, ifg_space=True, logger)[source]

Predicts the phase time series based on the estimated parameters DEM error and mean velocity.

Can be used for both arc phase or point phase. Wrapper function for ‘predictPhaseCore(…)’

Parameters

obj: Union[NetworkParameter, Points]

object of either ‘networkParameter’ or ‘points’. If instance of ‘points’ is given, ‘vel’ and ‘demerr’ also need to be specified.

vel: np.ndarray

velocity for each sample (default: None)

demerr: np.ndarray

dem error for each sample (default: None).

ifg_space: bool

set to True if the phase shall be predicted in interferogram space. If False, phase will be predicted in acquisition space. (default: True)

logger: Logger

Logging handler.

Returns

pred_phase_demerr: np.ndarray

predicted phase from DEM error

pred_phase_vel: np.ndarray

predicted phase from velocity

Raises

ValueError

vel or demerr is none

TypeError

obj is of the wrong type

sarvey.utils.predictPhaseCore(*, ifg_net_obj, wavelength, vel, demerr, slant_range, loc_inc, ifg_space=True)[source]

Predicts the phase time series based on the estimated parameters DEM error and mean velocity.

Can be used for both arc phase or point phase.

Parameters

ifg_net_obj: IfgNetwork

instance of class ifgNetwork

wavelength: float

wavelength in [m]

vel: np.ndarray

velocity for each sample

demerr: np.ndarray

dem error for each sample

slant_range: np.ndarray

slant range distance for each sample

loc_inc: np.ndarray

local incidence angle for each sample

ifg_space: bool

set to True if the phase shall be predicted in interferogram space. If False, phase will be predicted in acquisition space. (default: True)

Returns

pred_phase_demerr: np.ndarray

predicted phase from DEM error

pred_phase_vel: np.ndarray

predicted phase from velocity

sarvey.utils.predictPhaseSingle(*, demerr, vel, slant_range, loc_inc, ifg_net_obj, wavelength, only_vel=False, ifg_space=True)[source]

Predict the phase time series for only one point based on the estimated parameters DEM error and mean velocity.

Can be used for both arc phase or point phase.

Parameters

demerr: float

DEM error (scalar)

vel: float

mean velocity (scalar)

slant_range: float

slant range distance in [m] (scalar)

loc_inc: float

local incidence angle in [rad] (scalar)

ifg_net_obj: IfgNetwork

object of class IfgNetwork

wavelength: float

radar wavelength in [m]

only_vel: bool

set to True if only the mean velocity shall be predicted (default: False)

ifg_space: bool

set to True if the phase shall be predicted in interferogram space. If False, phase will be predicted in acquisition space. (default: True)

Returns

pred_phase: np.ndarray

predicted phase

sarvey.utils.preparePatches(*, num_patches, width, length, logger)[source]

Create patches to subset the image stack for parallel processing to reduce memory usage.

Parameters

num_patches: int

number of patches to split the image into

width: int

width of the image

length: int

length of the image

logger: Logger

logging handler

Returns

box_list: list

tuples with the radar coordinates of the boxes

num_patches: int

number of actual patches created by the function

sarvey.utils.readPhasePatchwise(*, stack_obj, dataset_name, num_patches, cand_mask, point_id_img, logger)[source]

Read the phase from a file in a patchwise manner to reduce memory usage.

Parameters

stack_obj: BaseStack

instance of class BaseStack

dataset_name: str

name of the dataset to read (e.g. ‘ifgs’ or ‘phase’)

num_patches: int

number of patches to split the image into

cand_mask: np.ndarray

boolean mask of the selected pixels

point_id_img: np.ndarray

image with point IDs for each pixel

logger: Logger

logging handler

Returns

phase_points: np.ndarray

phase time series of the selected pixels

sarvey.utils.selectBestPointsInGrid(*, box_list, quality, sel_min=True)[source]

Select the best point inside a grid.

If several pixel fullfil the criteria, the first one is selected.

Parameters

box_list: list

of tuples with the radar coordinates of the boxes

quality: np.ndarray

quality of the pixels

sel_min: bool

set to True if the minimum value shall be selected (default: True)

Returns

cand_mask_sparse: np.ndarray

boolean mask of the selected pixels

sarvey.utils.setReferenceToPeakOfHistogram(*, phase, vel, num_bins=100)[source]

Set reference phase value to peak of the velocity histogram.

It assumes that no velocity (i.e. stable area) is occuring most frequently.

Parameters

phase: np.ndarray

phase time series of the points

vel: np.ndarray

velocity of the points

num_bins: int

number of bins for the histogram (default: 100)

Returns

phase: np.ndarray

phase time series adjusted by the new reference phase

sarvey.utils.spatiotemporalConsistency(*, coord_utm, phase, wavelength, min_dist=15, max_dist=inf, knn=50)[source]

Spatiotemporal consistency proposed by Hanssen et al. (2008) and implemented in DePSI (van Leijen, 2014).

Parameters

coord_utm: np.ndarray

UTM coordinates of the points

phase: np.ndarray

phase time series of the points

wavelength: float

radar wavelength in [m]

min_dist: int

minimum distance to other points in [m] (default: 15)

max_dist: float

maximum distance to other points in [m] (default: np.inf)

knn: int

number of nearest neighbors to consider (default: 50)

Returns

stc: np.ndarray

spatiotemporal consistency of the points

sarvey.utils.splitDatasetForParallelProcessing(*, num_samples, num_cores)[source]

Split the dataset into chunks of similar size for processing them in parallel.

Parameters

num_samples: int

number of samples to be split

num_cores: int

number of cores to split among

Returns

idx: list

list of sample ranges for each core

sarvey.utils.splitImageIntoBoxesRngAz(*, length, width, num_box_az, num_box_rng)[source]

Split the image into several boxes.

(adapted from mintpy.ifgram_inversion.split2boxes)

Parameters

num_box_rng: int

Number of boxes in range direction

num_box_az:

Number of boxes in azimuth direction

length: int

length of the image

width: int

width of the image

Returns

box_list: list

of tuple of 4 int (xmin, ymin, xmax, ymax)

num_box: int

number of boxes

sarvey.utils.temporalAutoCorrelation(*, residuals, lag)[source]

Compute the temporal autocorrelation for given time lag from the residuals.

Parameters

residuals: np.ndarray

residual phase time series (dim: num_points x num_time_steps)

lag: int

time lag used for computing the correlation

Returns

auto_corr: np.ndarray

auto-correlation of each point (dim: num_points x lag)

sarvey.version module

Version module for SARvey.

sarvey.viewer module

Viewer Module for SARvey.

class sarvey.viewer.TimeSeriesViewer(*, point_obj, vel_scale='mm', input_path, logger)[source]

Bases: object

TimeSeriesViewer.

Init.

initFigureMap()[source]

InitFigureMap.

initFigureTimeseries()[source]

InitFigureTimeseries.

onClick(event)[source]

Event function to get y/x from button press.

plotMap(val)[source]

Plot velocity map and time series.

plotPointTimeseries(val)[source]

Plot_point_timeseries.

updateButtonStatus(val)[source]

Set to true.

updateReference()[source]

Change the phase of all points according to the new reference point.

Update the plot of the velocity and time series.

sarvey.viewer.plotColoredPointNetwork(*, x, y, arcs, val, ax=None, linewidth=2, cmap_name='seismic', clim=None)[source]

Plot a network of points with colored arcs.

Parameters

x: np.ndarray

x-coordinates of the points (dim: no. points x 1)

y: np.ndarray

y-coordinates of the points (dim: no. points x 1)

arcs: np.ndarray

indices of the points to be connected (dim: no. arcs x 2)

val: np.ndarray

values for the color of the arcs (dim: no. arcs x 1)

ax: plt.Axes

axis for plotting (default: None)

linewidth: float

line width of the arcs (default: 2)

cmap_name: str

name of the colormap (default: “seismic”)

clim: tuple

color limits for the colormap (default: None)

Returns

ax: plt.Axes

current axis

cbar: plt.colorbar

current colorbar

sarvey.viewer.plotGridFromBoxList(*, box_list, ax=None, edgecolor='k', linewidth=1)[source]

Plot a grid into an axis.

Parameters

box_list: list

boxes to be plotted. box_list can be created with ‘splitImageIntoBoxesRngAz’ or ‘splitImageIntoBoxes’

ax: plt.Axes

axis for plotting (default: None)

edgecolor: str

edge color for the boxes (default: “k”)

linewidth: float

line width for the boxes (default: 1)

Returns

ax: plt.Axes

current axis

sarvey.viewer.plotIfgs(*, phase, coord, spatial_ref_idx=None, ttl=None, cmap='cmy')[source]

Plot one interferogram per subplot.

Parameters

phase: np.ndarray

phase per point and ifg, e.g. wrapped or unwrapped phase (dim: no. psPoints x no. ifgs)

coord: np.ndarray

coordinates of the psPoints, e.g. pixel or lat lon (dim: no. psPoints x 2)

spatial_ref_idx: int

index of the spatial reference point (default: None)

ttl: str

title for the figure (default: None)

cmap: str

colormap, use “cmy” for wrapped phase data (default) or “?” for unwrapped or residual phase

sarvey.viewer.plotScatter(*, value, coord, bmap_obj=None, ttl=None, unit=None, s=5.0, cmap=<matplotlib.colors.LinearSegmentedColormap object>, symmetric=False, logger, **kwargs)[source]

Plot a scatter map for given value.

Parameters

value: np.ndarray

value to be plotted per point giving the colour of the point (dim: no. points x 1)

coord: np.ndarray

coordinates of the points, e.g. radar or lat lon (dim: no. points x 2). If bmapObj is given, the coordinates must be radar coordinates!

bmap_obj: AmplitudeImage

instance of amplitudeImage for plotting background image (default: None)

ttl: str

title for the figure (default: None)

unit: str

unit as title for the colorbar axis (default: None)

s: float

size of the scatter points (default: 5.0)

cmap: str

colormap (default: “jet_r”)

symmetric: bool

plot symmetric colormap extend, i.e. abs(vmin) == abs(vmax) (default: False)

logger: Logger

logging Handler

kwargs: Any

additional keyword arguments for scatter plot

Returns

fig: plt.Figure

current figure,

ax: plt.Axes

current axis

cb: plt.colorbar

current colorbar

Module contents

Top-level package for SARvey.