Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GMT-like shaded relief illumination via
view.py --dem-blend
(#1089)
Rather than plotting DEM in the background and overlaying the data with transparency, I attempt to view data with color adjusted by the shaded relief DEM when provided. Just like `gmt grdimage -I` option. Hereafter, I call this DEM-blended data. This can be done via `matplotlib.colors.LightSource.shade_rgb()` module (as opposed to what has been used in MintPy, i.e., the `shade()` module, that only produces the shaded relief of the DEM itself). This PR adds this support for the single-subplot scenario via changes in `view.plot_slice()`, the multi-subplot scenarios are not supported. Detailed changes in MintPy code are as follows: + `utils.arg_utils.add_dem_argument()`: add the following new options to allow users to activate and tune the DEM-blended data plotting: `--dem-blend`, `--blend-mode`, `--shade-frac` and `--base-color` + `utils.plot.py`: - add `prep_blend_image()` to prepare the illuminated RGB array from a given data and DEM - add `plot_blend_image()` to call `prep_blend_image()` and `imshow` for plotting - add `blend_colorbar()` to create a DEM-blended colorbar, to be called within `plot_colorbar()` - `plot_colorbar()`: add generic customization support for the DEM-blended colorbar from `blend_colorbar()` - rename: `prepare_dem_background()` --> `prep_dem_background()` + `cli.view.cmd_line_parse()`: add checkings for `--dem-blend` option - turn off the disp_dem_shade option - check the existence of `--dem` option + `view.plot_slice()`: call `plot.plot_blend_image()` for the DEM-blended style. TODO: we could add the resampling capability in plot_blend_image(), to handle the different resolution between data and DEM. --------- Co-authored-by: Zhang Yunjun <[email protected]>
- Loading branch information