load: Module for loading result from other software¶
moraine.cli.load 的命令(源码);同样的函数在 Python 里以 mc.<name>(...) 调用(import moraine.cli as mc)。下面的帮助由 docstring 生成,与 moraine COMMAND --help 相同(docstring 为英文)。
| 命令 | 摘要 |
|---|---|
load-gamma-flatten-rslc |
Generate flatten rslc data from gamma command and convert them into zarr format |
load-gamma-lat-lon-hgt |
Function to load longitude and latitude from gamma binary format to zarr |
load-gamma-look-vector |
Load look vector (elevation angle and orientation angle) in map geometry from gamma binary format to look vector in radar geometry zarr file |
load-gamma-range |
Generate slant range distance and save to zarr. |
load-gamma-metadata |
Load necessary metadata into a toml file. |
load-gamma-flatten-rslc¶
Generate flatten rslc data from gamma command and convert them into zarr format. The shape of hgt should be same as one rslc image, i.e. the hgt file is generated with 1 by 1 look geocoding. All data equal to 0 are replaced with nan.
moraine load-gamma-flatten-rslc --rslc_dir STR --reference STR --hgt STR --scratch_dir STR --rslc STR [--chunks INT INT] [--gamma_threads VALUE] [--processes | --no-processes] [--n_workers VALUE] [--threads_per_worker VALUE]
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
--rslc_dir |
str | 必需 | input GAMMA rslc directory with '????????.rslc' and '????????.rslc.par' files |
--reference |
str | 必需 | reference date, eg: '20200202' |
--hgt |
str | 必需 | input DEM height in radar coordinates (GAMMA float), same size as one rslc |
--scratch_dir |
str | 必需 | directory for preserve gamma intermediate files |
--rslc |
str | 必需 | output flattened rslc stack, shape (nlines, width, nimages), complex64 |
--chunks |
tuple[int, int], 1000) | (1000, 1000) |
rslc chunk size |
--gamma_threads |
int, number of CPU cores) | 4 |
number of threads of each GAMMA program run for an image (phase_sim_orb, set with OMP_NUM_THREADS) |
--processes |
False |
use processes for the workers instead of threads | |
--n_workers |
1 |
number of workers | |
--threads_per_worker |
1 |
tasks a worker runs at the same time |
全局选项:--json、--traceback、--log FILE、-q / --quiet(约定)。
在 pipeline 文件中(examples/01_load.toml,步骤 rslc):
[[step]]
name = "rslc"
run = "load-gamma-flatten-rslc"
rslc_dir = "${gamma}/rslc"
reference = "${reference}"
hgt = "${gamma}/geocoding/${geo}.hgt"
scratch_dir = "raw/scratch"
rslc = "raw/rslc.zarr"
在 Python 中:
import moraine.cli as mc
mc.load_gamma_flatten_rslc(rslc_dir, reference, hgt, scratch_dir, rslc, chunks=(1000, 1000), gamma_threads=4, processes=False, n_workers=1, threads_per_worker=1)
load-gamma-lat-lon-hgt¶
Function to load longitude and latitude from gamma binary format to zarr. All data equal to 0 are replaced with nan.
moraine load-gamma-lat-lon-hgt --diff_par STR --rslc_par STR --dem_par STR --hgt STR --scratch_dir STR --lat_zarr STR --lon_zarr STR --hgt_zarr STR [--chunks INT INT]
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
--diff_par |
str | 必需 | input geocoding diff_par, using the simulated image as reference |
--rslc_par |
str | 必需 | input par file of the reference rslc |
--dem_par |
str | 必需 | input DEM par file |
--hgt |
str | 必需 | input DEM height in radar coordinates (GAMMA float) |
--scratch_dir |
str | 必需 | directory for preserve gamma intermediate files |
--lat_zarr |
str | 必需 | output, latitude zarr |
--lon_zarr |
str | 必需 | output, longitude zarr |
--hgt_zarr |
str | 必需 | output, height zarr |
--chunks |
tuple[int, int], 1000) | (1000, 1000) |
rslc chunk size |
全局选项:--json、--traceback、--log FILE、-q / --quiet(约定)。
在 pipeline 文件中(examples/01_load.toml,步骤 lat_lon_hgt):
[[step]]
name = "lat_lon_hgt"
run = "load-gamma-lat-lon-hgt"
diff_par = "${gamma}/geocoding/${geo}.diff_par"
rslc_par = "${gamma}/rslc/${reference}.rslc.par"
dem_par = "${gamma}/DEM/dem_seg_par"
hgt = "${gamma}/geocoding/${geo}.hgt"
scratch_dir = "raw/scratch"
lat_zarr = "raw/lat.zarr"
lon_zarr = "raw/lon.zarr"
hgt_zarr = "raw/hgt.zarr"
在 Python 中:
import moraine.cli as mc
mc.load_gamma_lat_lon_hgt(diff_par, rslc_par, dem_par, hgt, scratch_dir, lat_zarr, lon_zarr, hgt_zarr, chunks=(1000, 1000))
load-gamma-look-vector¶
Load look vector (elevation angle and orientation angle) in map geometry from gamma binary format to look vector in radar geometry zarr file. The two input data should be generated with the look_vector gamma command. All data equal to 0 are replaced with nan.
moraine load-gamma-look-vector --theta STR --phi STR --lt STR --rslc_par STR --dem_par STR --scratch_dir STR --theta_zarr STR --phi_zarr STR [--chunks INT INT]
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
--theta |
str | 必需 | input elevation angle in map geometry (GAMMA lv_theta) |
--phi |
str | 必需 | input orientation angle in map geometry (GAMMA lv_phi) |
--lt |
str | 必需 | input lookup table (GAMMA lt_fine) |
--rslc_par |
str | 必需 | input par file of the reference rslc |
--dem_par |
str | 必需 | input DEM par file |
--scratch_dir |
str | 必需 | directory for preserve gamma intermediate files |
--theta_zarr |
str | 必需 | output, elevation angle zarr |
--phi_zarr |
str | 必需 | output, orientation angle zarr |
--chunks |
tuple[int, int], 1000) | (1000, 1000) |
rslc chunk size |
全局选项:--json、--traceback、--log FILE、-q / --quiet(约定)。
在 pipeline 文件中(examples/01_load.toml,步骤 look_vector):
[[step]]
name = "look_vector"
run = "load-gamma-look-vector"
theta = "${gamma}/geocoding/${geo}.lv_theta"
phi = "${gamma}/geocoding/${geo}.lv_phi"
lt = "${gamma}/geocoding/${geo}.lt_fine"
rslc_par = "${gamma}/rslc/${reference}.rslc.par"
dem_par = "${gamma}/DEM/dem_seg_par"
scratch_dir = "raw/scratch"
theta_zarr = "raw/theta.zarr"
phi_zarr = "raw/phi.zarr"
在 Python 中:
import moraine.cli as mc
mc.load_gamma_look_vector(theta, phi, lt, rslc_par, dem_par, scratch_dir, theta_zarr, phi_zarr, chunks=(1000, 1000))
load-gamma-range¶
Generate slant range distance and save to zarr.
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
--rslc_par |
str | 必需 | input par file of one rslc |
--range_zarr |
str | 必需 | output, range distance zarr |
--chunks |
tuple[int, int], 1000) | (1000, 1000) |
rslc chunk size |
全局选项:--json、--traceback、--log FILE、-q / --quiet(约定)。
在 pipeline 文件中(examples/01_load.toml,步骤 range):
[[step]]
name = "range"
run = "load-gamma-range"
rslc_par = "${gamma}/rslc/${reference}.rslc.par"
range_zarr = "raw/range.zarr"
在 Python 中:
load-gamma-metadata¶
Load necessary metadata into a toml file.
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
--rslc_dir |
str | 必需 | input GAMMA rslc directory with '????????.rslc' and '????????.rslc.par' files |
--dem_par |
str | 必需 | input DEM par file |
--reference |
str | 必需 | reference date, eg: '20200202' |
--meta_file |
str | 必需 | output, text toml file for meta data |
全局选项:--json、--traceback、--log FILE、-q / --quiet(约定)。
在 pipeline 文件中(examples/01_load.toml,步骤 metadata):
[[step]]
name = "metadata"
run = "load-gamma-metadata"
rslc_dir = "${gamma}/rslc"
dem_par = "${gamma}/DEM/dem_seg_par"
reference = "${reference}"
meta_file = "raw/meta.toml"
在 Python 中: