dl

Deep learning based operators
from matplotlib import pyplot as plt
import zarr
import colorcet
import moraine.cli as mc
from moraine.utils_ import is_cuda_available
import numpy as np
import holoviews as hv
from bokeh.models import WheelZoomTool
from holoviews import opts
hv.extension('bokeh')
hv.output(widget_location='bottom')
rslc_zarr = zarr.open('../CLI/raw/rslc.zarr/','r')
ref_ = rslc_zarr[:,:,7]
sec_ = rslc_zarr[:,:,13]
#filtered_intf = _cli_n2f_cpu(ref,sec,depths=(10,10))
filtered_intf = _cli_n2f_np_in_gpu(ref_,sec_,depths=(0,0))
#filtered_intf = _cli_n2f_np_in_gpu(ref,sec,chunks=(2000,2000),depths=(0,0))
CPU times: user 4.64 s, sys: 1.7 s, total: 6.34 s
Wall time: 6.05 s

source

n2f

 n2f (rslc:str, intf:str, tnet:str=None, chunks:tuple=None,
      out_chunks:tuple=None, depths:tuple=(0, 0), model:str=None,
      cuda:bool=False, processes=None, n_workers=None,
      threads_per_worker=None, rmm_pool_size=0.5, **dask_cluster_arg)

Noise2Fringe interferogram filtering.

Type Default Details
rslc str input: rslc stack, shape (nlines, width, nimages)
intf str output: filtered intfergrams stack, shape (nlines, width, )
tnet str None input: temporal network
chunks tuple None parallel processing azimuth/range chunk size, optional. Default: rslc.chunks[:2]
out_chunks tuple None output chunks
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
cuda bool False if use cuda for processing, false by default
processes NoneType None use process for dask worker over thread, the default is True for cpu, only applied if cuda==False
n_workers NoneType None number of dask worker, the default is 1 for cpu, number of GPUs for cuda
threads_per_worker NoneType None number of threads per dask worker, the default is 1 for cpu, only applied if cuda==False
rmm_pool_size float 0.5 set the rmm pool size, only applied when cuda==True
dask_cluster_arg VAR_KEYWORD
logger = mc.get_logger()
rslc = './raw/rslc.zarr/'
intf = './dl/n2f_intf.zarr'
tnet_path = './dl/tnet.zarr'
rslc_zarr = zarr.open(rslc,'r')
tnet = mr.TempNet.from_bandwidth(rslc_zarr.shape[-1], 1)
tnet.save(tnet_path)
n2f(rslc,intf,tnet=tnet_path,chunks=(2500,1834))
2025-06-24 21:54:33 - log_args - INFO - running function: n2f
2025-06-24 21:54:33 - log_args - INFO - fetching args:
2025-06-24 21:54:33 - log_args - INFO - rslc = './raw/rslc.zarr/'
2025-06-24 21:54:33 - log_args - INFO - intf = './dl/n2f_intf.zarr'
2025-06-24 21:54:33 - log_args - INFO - tnet = './dl/tnet.zarr'
2025-06-24 21:54:33 - log_args - INFO - chunks = (2500, 1834)
2025-06-24 21:54:33 - log_args - INFO - out_chunks = None
2025-06-24 21:54:33 - log_args - INFO - depths = (0, 0)
2025-06-24 21:54:33 - log_args - INFO - model = None
2025-06-24 21:54:33 - log_args - INFO - cuda = False
2025-06-24 21:54:33 - log_args - INFO - processes = None
2025-06-24 21:54:33 - log_args - INFO - n_workers = None
2025-06-24 21:54:33 - log_args - INFO - threads_per_worker = None
2025-06-24 21:54:33 - log_args - INFO - rmm_pool_size = 0.5
2025-06-24 21:54:33 - log_args - INFO - dask_cluster_arg = {}
2025-06-24 21:54:33 - log_args - INFO - fetching args done.
2025-06-24 21:54:33 - zarr_info - INFO - ./raw/rslc.zarr/ zarray shape, chunks, dtype: (2500, 1834, 17), (1000, 1000, 1), complex64
2025-06-24 21:54:33 - n2f - INFO - processing azimuth chunk size: 2500
2025-06-24 21:54:33 - n2f - INFO - processing range chunk size: 1834
2025-06-24 21:54:33 - n2f - INFO - starting dask cluster.
2025-06-24 21:54:34 - n2f - INFO - dask cluster started.
2025-06-24 21:54:34 - dask_cluster_info - INFO - dask cluster: LocalCluster(dashboard_link='http://127.0.0.1:8787/status', workers=1, threads=1, memory=1.46 TiB)
2025-06-24 21:54:34 - darr_info - INFO - rslc dask array shape, chunksize, dtype: (2500, 1834, 17), (2500, 1834, 1), complex64
2025-06-24 21:54:34 - n2f - INFO - got filtered interferograms.
2025-06-24 21:54:34 - darr_info - INFO - intf dask array shape, chunksize, dtype: (2500, 1834, 16), (2500, 1834, 1), complex64
2025-06-24 21:54:34 - n2f - INFO - saving filtered interferograms.
2025-06-24 21:54:35 - zarr_info - INFO - ./dl/n2f_intf.zarr zarray shape, chunks, dtype: (2500, 1834, 16), (1000, 1000, 1), complex64
2025-06-24 21:54:35 - n2f - INFO - computing graph setted. doing all the computing.
2025-06-24 21:55:59 - n2f - INFO - computing finished.leted |  1min 24.9s
2025-06-24 21:56:01 - n2f - INFO - dask cluster closed.
CPU times: user 3.81 s, sys: 2.86 s, total: 6.66 s
Wall time: 1min 28s