Last active
January 23, 2024 22:33
-
-
Save scottstanie/a4619b7a4dc438bb6cc35b5f1cddd0c8 to your computer and use it in GitHub Desktop.
Burst Overlap Interferometry with geocoded SLCs
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
from os import fspath | |
import numpy as np | |
from osgeo import gdal | |
from dolphin import io, stitching, utils | |
def compute_boi(ifg_file1: str, ifg_file2: str, looks: tuple[int, int] = (1, 1)) -> np.ndarray: | |
assert io.get_raster_crs(ifg_file1) == io.get_raster_crs(ifg_file2) | |
(left, bottom, right, top), nodata = stitching.get_combined_bounds_nodata( | |
ifg_file1, ifg_file2 | |
) | |
def grow_bounds(file): | |
return gdal.Translate( | |
"", | |
fspath(file), | |
format="VRT", # Just creates a file that will warp on the fly | |
resampleAlg="nearest", # nearest neighbor for resampling | |
projWin=(left, top, right, bottom), | |
).ReadAsArray() | |
out1 = grow_bounds(ifg_file1) | |
out2 = grow_bounds(ifg_file2) | |
return utils.take_looks(out1 * out2.conj(), *looks) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment