Skip to content

plot: Pyramids of rasters and point clouds (multi resolution copies for views and statistics) and the rules to

Commands of moraine.cli.plot (source); the same functions are called in Python as mc.<name>(...) with import moraine.cli as mc. The help below is generated from the docstrings, like moraine COMMAND --help.

command summary
ras-pyramid render raster data to pyramid of difference zoom levels.
pc-pyramid render point cloud data to pyramid of difference zoom levels.

ras-pyramid

render raster data to pyramid of difference zoom levels.

moraine ras-pyramid --ras STR --out_dir STR [--chunks INT INT] [--rows VALUE] [--method STR] [--n_workers VALUE]
argument type default description
--ras str required input 2D raster (nlines, width) or raster stack (nlines, width, n)
--out_dir str required output directory to store rendered data
--chunks tuple[int, int], 256) (256, 256) output raster tile size
--rows int 1024 lines of the raster a process reads at a time, a power of 2; a process needs about 1 GB plus 3 x rows x width x itemsize bytes
--method str 'decimate' how each level is made from the finer one: 'decimate' keeps every 2nd pixel, 'mean' averages the 2 x 2 blocks (nan pixels left out, complex data as complex numbers; integer and boolean data give float32 levels). The mean is a multilook of the data: right for real values and for phases relative to a reference image (phase histories of phase linking, filtered interferograms), wrong for the SLC pixels of an rslc stack, whose scatterer phases differ from pixel to pixel
--n_workers int None processes rendering the channels at the same time, default: 8 or the number of cores if fewer; a process renders one channel of the raster

Global options: --json, --traceback, --log FILE, -q / --quiet (conventions).

In a pipeline (examples/01_load.toml, step rslc_pyramid):

[[step]]
name = "rslc_pyramid"             # to check the interferograms: moraine quicklook raw/rslc_pyramid --show intf_seq
                                  # decimated (SLC pixels cannot be averaged): zoom in, the whole scene is speckle
run = "ras-pyramid"
ras = "raw/rslc.zarr"
out_dir = "raw/rslc_pyramid"

Also in examples/02_ps.toml (step adi_pyramid), examples/02_ps.toml (step n2f_intf_pyramid), examples/02_ps.toml (step temp_coh_pyramid), examples/03_ds.toml (step shp_num_pyramid).

In Python:

import moraine.cli as mc
mc.ras_pyramid(ras, out_dir, chunks=(256, 256), rows=1024, method='decimate', n_workers=None)

pc-pyramid

render point cloud data to pyramid of difference zoom levels.

moraine pc-pyramid --pc STR --out_dir STR [--x STR] [--y STR] [--yx STR] [--ras_resolution VALUE] [--ras_chunks INT INT] [--pc_chunks VALUE] [--method STR] [--n_workers VALUE]
argument type default description
--pc str required input point cloud data, shape (n_points,) or (n_points, n)
--out_dir str required output directory to store rendered data
--x str None input x coordinate of the points, e.g. longitude or web mercator x
--y str None input y coordinate of the points, e.g. latitude or web mercator y
--yx str None input (y, x) coordinates of the points, shape (n_points, 2), e.g. gix; alternative to x and y
--ras_resolution float 20 minimum resolution of rendered raster data,
--ras_chunks tuple[int, int], 256) (256, 256) output raster tile size
--pc_chunks int 65536 output pc tile size
--method str 'first' how each level is made from the finer one: 'first' keeps the first cell with a point of each 2 x 2 block, 'mean' averages the cells with points (complex data as complex numbers). The mean is a multilook of the data: right for real values and for phase histories relative to a reference image (phase linking, filtered points)
--n_workers int None processes rendering the channels at the same time, default: 8 or the number of cores if fewer; a process holds one channel: the data of the points and the finest raster of the channel (3 rasters with 'mean')

Global options: --json, --traceback, --log FILE, -q / --quiet (conventions).

In a pipeline (examples/02_ps.toml, step ps_can_pyramid):

[[step]]
name = "ps_can_pyramid"           # ADI of the candidates on the map
run = "pc-pyramid"
pc = "ps/ps_can_adi.zarr"
out_dir = "ps/ps_can_adi_pyramid"
method = "mean"
x = "ps/ps_can_e.zarr"
y = "ps/ps_can_n.zarr"
ras_resolution = 20

Also in examples/03_ds.toml (step ds_can_t_coh_w_pyramid), examples/03_ds.toml (step ds_can_n_components_pyramid), examples/03_ds.toml (step ds_ph_pyramid), examples/04_refine.toml (step temp_coh_pyramid), examples/04_refine.toml (step pc_ph_pyramid), examples/05_unwrap.toml (step unw_pyramid).

In Python:

import moraine.cli as mc
mc.pc_pyramid(pc, out_dir, x=None, y=None, yx=None, ras_resolution=20, ras_chunks=(256, 256), pc_chunks=65536, method='first', n_workers=None)