跳转至

Pixel refinement

Notebook

Converted from nbs/Tutorials/CLI/CampiFlegrei/04_refine.ipynb (text and code cells; the outputs are not stored in the repository). Run it in Jupyter or VS Code for the interactive maps.

Data: Campi Flegrei. Sentinel-1A IW, descending track 22, VV, 92 dates from 2019-01-02 to 2021-12-29 (every 12 days, reference 2020-07-07), cropped to the caldera (Pozzuoli and the Gulf of Pozzuoli) at full resolution. A bell-shaped uplift of tens of centimetres in the centre; the town gives many PS. The data and how they were made are described in data/CampiFlegrei/README.md.

The thresholds below are starting values; look at the figures and adjust them to the data.

In this tutorial, we demostrate how to merge previous processed PS candidates in PS processing and DSs in DS processing together and refine these measurement points with Noise2Fringe Transformer.

import zarr
import numpy as np
from matplotlib import pyplot as plt
import colorcet
import moraine.cli as mc
import moraine as mr

Merge pixels

logger = mc.get_logger()
ds_ph = './ds_processing/hix/ds/ds_ph.zarr'
ds_e = './ds_processing/hix/ds/ds_e.zarr'
ds_n = './ds_processing/hix/ds/ds_n.zarr'
ds_hix = './ds_processing/hix/ds/ds_hix.zarr'

ps_can_rslc = './ps_processing/hix/ps_can_rslc.zarr'
ps_can_e = './ps_processing/hix/ps_can_e.zarr'
ps_can_n = './ps_processing/hix/ps_can_n.zarr'
ps_can_hix = './ps_processing/hix/ps_can_hix.zarr'

pc_can_hix = './pixel_refinement/hix/pc_can_hix.zarr'
pc_can_ph = './pixel_refinement/hix/pc_can_ph.zarr'
pc_can_e = './pixel_refinement/hix/pc_can_e.zarr'
pc_can_n = './pixel_refinement/hix/pc_can_n.zarr'
# the DS first: a point that is a DS and a PS candidate keeps its phase linked history
mc.pc_union(
    ds_hix, ps_can_hix, pc_can_hix,
    pc1 = [ds_ph, ds_e, ds_n],
    pc2 = [ps_can_rslc, ps_can_e, ps_can_n],
    pc = [pc_can_ph, pc_can_e, pc_can_n],
)
pc_can_lon = './pixel_refinement/hix/pc_can_lon.zarr'
pc_can_lat = './pixel_refinement/hix/pc_can_lat.zarr'
mc.ras2pc(
    pc_can_hix, 
    ras=['./load_data/lon.zarr/','./load_data/lat.zarr/'],
    pc =[pc_can_lon, pc_can_lat]
)

Refine pixels with Noise2fringe Transformer

n2ft_intf = './pixel_refinement/hix/pc_can_n2f_intf.zarr'
pc_can_ph_zarr = zarr.open(pc_can_ph,mode='r')
tnet = tnet = mr.TempNet.from_bandwidth(pc_can_ph_zarr.shape[-1],1)
mc.n2ft(pc_can_lon, pc_can_lat, pc_can_ph, n2ft_intf, tnet.image_pairs, chunks= 20000, cuda=True)
temp_coh = './pixel_refinement/hix/pc_can_temp_coh.zarr'
mc.temp_coh(n2ft_intf, pc_can_ph, temp_coh, tnet.image_pairs, cuda=True)
mc.view(temp_coh, x=pc_can_e, y=pc_can_n, resolution=20, label='temporal coherence',
        cmap=colorcet.fire, clim=(0, 1))
pc_hix = './pixel_refinement/hix/pc/pc_hix.zarr'
t_coh_min = 0.8   # keep the points whose temporal coherence is above this
mc.pc_logic_pc(pc_can_hix, temp_coh, pc_hix, f'pc_in>{t_coh_min}')
pc_ph = './pixel_refinement/hix/pc/pc_ph.zarr'
pc_e = './pixel_refinement/hix/pc/pc_e.zarr'
pc_n = './pixel_refinement/hix/pc/pc_n.zarr'
mc.pc_select_data(
    pc_can_hix, pc_hix, 
    pc_in = [pc_can_ph, pc_can_e, pc_can_n],
    pc = [pc_ph, pc_e, pc_n],
)

visualize the PS candidates

pc_ph_pyramid = './pixel_refinement/hix/pc/pc_ph_pyramid'
mc.pc_pyramid(
    pc_ph, pc_ph_pyramid,
    x = pc_e,
    y = pc_n,
    ras_resolution = 20,
)
mc.view(pc_ph_pyramid, show='intf_all', dates='./load_data/meta.toml')