source
download_dl_model
download_dl_model (models:str|list=None, path:str=None)
models |
str | list |
None |
deep learning models to be downloaded, all available models by default |
path |
str |
None |
directory to save these models, inside installed Moraine package by default |
Deep learning models have to be installed before use, download them by:
Downloading https://raw.githubusercontent.com/kanglcn/n2f/refs/heads/main/n2f.onnx to /work/projects/jinwook/radarlab/kangl/moraine/moraine/dl_model/n2f.onnx
File '/work/projects/jinwook/radarlab/kangl/moraine/moraine/dl_model/n2f.onnx' downloaded successfully.
Downloading https://raw.githubusercontent.com/kanglcn/n2f/refs/heads/main/n2fs3d.onnx to /work/projects/jinwook/radarlab/kangl/moraine/moraine/dl_model/n2fs3d.onnx
File '/work/projects/jinwook/radarlab/kangl/moraine/moraine/dl_model/n2fs3d.onnx' downloaded successfully.
Downloading https://raw.githubusercontent.com/kanglcn/n2ft/refs/heads/main/n2ft.onnx to /work/projects/jinwook/radarlab/kangl/moraine/moraine/dl_model/n2ft.onnx
File '/work/projects/jinwook/radarlab/kangl/moraine/moraine/dl_model/n2ft.onnx' downloaded successfully.
Downloading https://raw.githubusercontent.com/kanglcn/n2ft/refs/heads/main/n2ft.onnx.data to /work/projects/jinwook/radarlab/kangl/moraine/moraine/dl_model/n2ft.onnx.data
File '/work/projects/jinwook/radarlab/kangl/moraine/moraine/dl_model/n2ft.onnx.data' downloaded successfully.
source
n2f
n2f (intf:numpy.ndarray, chunks:tuple=None, depths:tuple=(0, 0),
model:str=None)
intf |
ndarray |
|
interferogram, 2d np.complex64 or cp.complex64 |
chunks |
tuple |
None |
chunksize, intf.shape by default |
depths |
tuple |
(0, 0) |
width of the boundary |
model |
str |
None |
path to the model in onnx format, use the model comes with this package by default |
Usage:
import zarr
import numpy as np
import holoviews as hv
hv.extension('bokeh')
hv.output(widget_location='bottom')
from bokeh.models import WheelZoomTool
from holoviews import opts
ⓘ
rslc_zarr = zarr.open('../CLI/raw/rslc.zarr/',mode='r')
intf = rslc_zarr[:,:,7]*rslc_zarr[:,:,13].conj()
filtered_intf = n2f(intf,depths=(10,10))
CPU times: user 3min 56s, sys: 40.6 s, total: 4min 36s
Wall time: 4.16 s
raw_intf_plot = mr.ras_plot(np.angle(intf))
filtered_intf_plot = mr.ras_plot(np.angle(filtered_intf))
(raw_intf_plot+filtered_intf_plot).opts(
opts.Image(
cmap='colorwheel',width=600, height=600, colorbar=True,invert_yaxis=True,
default_tools=['pan',WheelZoomTool(zoom_on_axis=False),'save','reset','hover'],
active_tools=['wheel_zoom'])
)
source
n2fs3d
n2fs3d (adi:numpy.ndarray, intf:numpy.ndarray, chunks:tuple=None,
depths:tuple=(0, 0), model:str=None)
adi |
ndarray |
|
amplitude dispersion index, 2d np.float32 or cp.float32 |
intf |
ndarray |
|
interferogram, 2d np.complex64 or cp.complex64 |
chunks |
tuple |
None |
chunksize, intf.shape by default |
depths |
tuple |
(0, 0) |
width of the boundary |
model |
str |
None |
path to the model in onnx format, use the model comes with this package by default |
Usage:
import zarr
import numpy as np
import holoviews as hv
hv.extension('bokeh')
hv.output(widget_location='bottom')
from bokeh.models import WheelZoomTool
from holoviews import opts
rslc_zarr = zarr.open('../CLI/raw/rslc.zarr/',mode='r')
intf = rslc_zarr[:,:,7]*rslc_zarr[:,:,13].conj()
adi = zarr.open('../CLI/ps/adi.zarr/',mode='r')[:]
filtered_intf = n2fs3d(adi,intf,depths=(200,200))
CPU times: user 3min 52s, sys: 40 s, total: 4min 32s
Wall time: 4.11 s
if is_cuda_available():
intf_cp = cp.asarray(intf)
adi_cp = cp.asarray(adi)
filtered_intf_cp = n2fs3d(adi_cp,intf_cp)
CPU times: user 3.35 s, sys: 222 ms, total: 3.57 s
Wall time: 474 ms
source
n2ft
n2ft (x:numpy.ndarray, y:numpy.ndarray, intf:numpy.ndarray,
chunks:int=None, k:int=128, model:str=None, cuda:bool=False)
x |
ndarray |
|
x coordinate, e.g., longitude, shape (n,) np.floating |
y |
ndarray |
|
y coordinate, e.g., latitude, shape (n,) np.floating |
intf |
ndarray |
|
interferogram, shape(n,) np.complex64 |
chunks |
int |
None |
chunksize, intf.shape[0] by default |
k |
int |
128 |
halo size for chunkwise processing |
model |
str |
None |
path to the model in onnx format, use the model comes with this package by default |
cuda |
bool |
False |
use gpu for inference |
Usage:
base = '../Tutorials/CLI/ps_processing/'
ps_can_rslc_zarr = zarr.open(base+'hix/ps_can_rslc.zarr/',mode='r')
ps_can_y = zarr.open(base+'hix/ps_can_n.zarr',mode='r')[:]
ps_can_x = zarr.open(base+'hix/ps_can_e.zarr',mode='r')[:]
ps_can_lon = zarr.open(base+'hix/ps_can_lon.zarr',mode='r')[:]
ps_can_lat = zarr.open(base+'hix/ps_can_lat.zarr',mode='r')[:]
ps_can_intf = ps_can_rslc_zarr[:,10]*ps_can_rslc_zarr[:,13].conj()
out = n2ft(ps_can_lon, ps_can_lat, ps_can_intf,)
CPU times: user 1min 31s, sys: 9.88 s, total: 1min 41s
Wall time: 3.51 s
out = n2ft(ps_can_lon, ps_can_lat, ps_can_intf,cuda=True)
CPU times: user 15.5 s, sys: 272 ms, total: 15.7 s
Wall time: 575 ms
out = n2ft(ps_can_lon, ps_can_lat, ps_can_intf, chunks=2000)
CPU times: user 10min 29s, sys: 6.21 s, total: 10min 35s
Wall time: 13.4 s
import moraine as mr
import holoviews as hv
import numpy as np
import zarr
from holoviews import opts
from bokeh.models import WheelZoomTool
hv.extension('bokeh')
intf_plot = mr.pc_plot(np.angle(ps_can_intf),ps_can_y,ps_can_x)
intf_filt_plot = mr.pc_plot(np.angle(out),ps_can_y,ps_can_x)
intf_plot = intf_plot.redim(
x=hv.Dimension('lon', label='Longitude'), y=hv.Dimension('lat',label='Latitude'),
z=hv.Dimension('intf',label='Phase',range=(-np.pi,np.pi)),
)
intf_filt_plot = intf_filt_plot.redim(
x=hv.Dimension('lon', label='Longitude'), y=hv.Dimension('lat',label='Latitude'),
z=hv.Dimension('intf',label='Phase',range=(-np.pi,np.pi)),
)
(intf_plot+intf_filt_plot).opts(
opts.Image(
cmap='colorwheel',width=600, height=400, colorbar=True,
default_tools=['pan',WheelZoomTool(zoom_on_axis=False),'save','reset','hover'],
active_tools=['wheel_zoom']
),
opts.Points(
color='intf', cmap='colorwheel',width=600, height=400, colorbar=True,
default_tools=['pan',WheelZoomTool(zoom_on_axis=False),'save','reset','hover'],
active_tools=['wheel_zoom']
)
)