-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
36f87d8
commit b041f8e
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,6 @@ interferometric synthetic aperture radar (InSAR). | |
:hidden: | ||
|
||
installation | ||
usage | ||
reference | ||
changelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Usage | ||
##### | ||
|
||
Basic usage with raster files | ||
============================= | ||
|
||
.. code-block:: python | ||
from tophu import RasterBand, SnaphuUnwrap, multiscale_unwrap | ||
import rasterio as rio | ||
# Create `RasterBand`s from the input interferogram and coherence. | ||
igram = RasterBand(ifg_filename) | ||
coherence = RasterBand(corr_filename) | ||
# Create the output raster bands. | ||
# Start by copying the input geographic metadata. | ||
with rio.open(ifg_filename) as src: | ||
profile = src.profile | ||
# The unwrapped phase will be float32. | ||
profile["dtype"] = np.float32 | ||
profile["driver"] = "GTiff" | ||
unw = RasterBand("unwrapped_phase.unw.tif", **profile) | ||
# Create the connected component labels raster. | ||
profile["dtype"] = np.uint16 | ||
conncomp = RasterBand("connected_components.tif", **profile) | ||
# Choose which unwrapper we will use. | ||
# Here we pick SNAPHU. | ||
unwrap_callback = SnaphuUnwrap( | ||
cost="smooth", | ||
init_method="mst", | ||
) | ||
# Set the number of looks used to form the coherence. | ||
nlooks = 40 | ||
# Choose the tiling scheme and the downsample factor for the coarse unwrap. | ||
ntiles = (2, 2) | ||
downsample_factor = (3, 3) | ||
# Run the multiscale unwrapping function. | ||
multiscale_unwrap( | ||
unw, | ||
conncomp, | ||
igram, | ||
coherence, | ||
nlooks=nlooks, | ||
unwrap_func=unwrap_callback, | ||
downsample_factor=downsample_factor, | ||
ntiles=ntiles, | ||
) |