跳转至

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

moraine.cli.plot 的命令(源码);同样的函数在 Python 里以 mc.<name>(...) 调用(import moraine.cli as mc)。下面的帮助由 docstring 生成,与 moraine COMMAND --help 相同(docstring 为英文)。

命令 摘要
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]
参数 类型 默认值 说明
--ras str 必需 input 2D raster (nlines, width) or raster stack (nlines, width, n)
--out_dir str 必需 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

全局选项:--json、--traceback、--log FILE、-q / --quiet(约定)。

在 pipeline 文件中(examples/01_load.toml,步骤 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"

也用于 examples/02_ps.toml(步骤 adi_pyramid), examples/02_ps.toml(步骤 n2f_intf_pyramid), examples/02_ps.toml(步骤 temp_coh_pyramid), examples/03_ds.toml(步骤 shp_num_pyramid)。

在 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]
参数 类型 默认值 说明
--pc str 必需 input point cloud data, shape (n_points,) or (n_points, n)
--out_dir str 必需 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')

全局选项:--json、--traceback、--log FILE、-q / --quiet(约定)。

在 pipeline 文件中(examples/02_ps.toml,步骤 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

也用于 examples/03_ds.toml(步骤 ds_can_t_coh_w_pyramid), examples/03_ds.toml(步骤 ds_can_n_components_pyramid), examples/03_ds.toml(步骤 ds_ph_pyramid), examples/04_refine.toml(步骤 temp_coh_pyramid), examples/04_refine.toml(步骤 pc_ph_pyramid), examples/05_unwrap.toml(步骤 unw_pyramid)。

在 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)