load: Module for loading result from other software¶
Commands of moraine.cli.load (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 |
|---|---|
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]
| argument | type | default | description |
|---|---|---|---|
--rslc_dir |
str | required | input GAMMA rslc directory with '????????.rslc' and '????????.rslc.par' files |
--reference |
str | required | reference date, eg: '20200202' |
--hgt |
str | required | input DEM height in radar coordinates (GAMMA float), same size as one rslc |
--scratch_dir |
str | required | directory for preserve gamma intermediate files |
--rslc |
str | required | 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 |
Global options: --json, --traceback, --log FILE, -q / --quiet (conventions).
In a pipeline (examples/01_load.toml, step 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"
In 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]
| argument | type | default | description |
|---|---|---|---|
--diff_par |
str | required | input geocoding diff_par, using the simulated image as reference |
--rslc_par |
str | required | input par file of the reference rslc |
--dem_par |
str | required | input DEM par file |
--hgt |
str | required | input DEM height in radar coordinates (GAMMA float) |
--scratch_dir |
str | required | directory for preserve gamma intermediate files |
--lat_zarr |
str | required | output, latitude zarr |
--lon_zarr |
str | required | output, longitude zarr |
--hgt_zarr |
str | required | output, height zarr |
--chunks |
tuple[int, int], 1000) | (1000, 1000) |
rslc chunk size |
Global options: --json, --traceback, --log FILE, -q / --quiet (conventions).
In a pipeline (examples/01_load.toml, step 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"
In 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]
| argument | type | default | description |
|---|---|---|---|
--theta |
str | required | input elevation angle in map geometry (GAMMA lv_theta) |
--phi |
str | required | input orientation angle in map geometry (GAMMA lv_phi) |
--lt |
str | required | input lookup table (GAMMA lt_fine) |
--rslc_par |
str | required | input par file of the reference rslc |
--dem_par |
str | required | input DEM par file |
--scratch_dir |
str | required | directory for preserve gamma intermediate files |
--theta_zarr |
str | required | output, elevation angle zarr |
--phi_zarr |
str | required | output, orientation angle zarr |
--chunks |
tuple[int, int], 1000) | (1000, 1000) |
rslc chunk size |
Global options: --json, --traceback, --log FILE, -q / --quiet (conventions).
In a pipeline (examples/01_load.toml, step 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"
In 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.
| argument | type | default | description |
|---|---|---|---|
--rslc_par |
str | required | input par file of one rslc |
--range_zarr |
str | required | output, range distance zarr |
--chunks |
tuple[int, int], 1000) | (1000, 1000) |
rslc chunk size |
Global options: --json, --traceback, --log FILE, -q / --quiet (conventions).
In a pipeline (examples/01_load.toml, step range):
[[step]]
name = "range"
run = "load-gamma-range"
rslc_par = "${gamma}/rslc/${reference}.rslc.par"
range_zarr = "raw/range.zarr"
In Python:
load-gamma-metadata¶
Load necessary metadata into a toml file.
| argument | type | default | description |
|---|---|---|---|
--rslc_dir |
str | required | input GAMMA rslc directory with '????????.rslc' and '????????.rslc.par' files |
--dem_par |
str | required | input DEM par file |
--reference |
str | required | reference date, eg: '20200202' |
--meta_file |
str | required | output, text toml file for meta data |
Global options: --json, --traceback, --log FILE, -q / --quiet (conventions).
In a pipeline (examples/01_load.toml, step 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"
In Python: