polygon: Masks from polygons drawn on results (CLI)¶
moraine.cli.polygon 的命令(源码);同样的函数在 Python 里以 mc.<name>(...) 调用(import moraine.cli as mc)。下面的帮助由 docstring 生成,与 moraine COMMAND --help 相同(docstring 为英文)。
| 命令 | 摘要 |
|---|---|
polygon-mask |
Mask of the pixels or points inside (or outside) the polygons of a GeoJSON file |
polygon-mask¶
Mask of the pixels or points inside (or outside) the polygons of a GeoJSON file. The polygons come from the tile viewer (TileView.save_polygons) or any GeoJSON file. Give the positions of the data in the coordinates of the file in one of three ways: x and y (longitude / latitude for 'lonlat' files, range / azimuth for 'radar_grid' files), gix (point clouds on the radar grid) or shape (a whole raster on the radar grid, pixel (i, j) at range j, azimuth i). Apply the mask with e.g. math (where(mask, a, nan)) or pc-logic-pc.
moraine polygon-mask --polygons STR --mask STR [--x STR] [--y STR] [--gix STR] [--shape INT INT] [--keep STR] [--chunks INT INT]
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
--polygons |
str | 必需 | input GeoJSON file with the polygons |
--mask |
str | 必需 | output bool mask, True for the data to keep; same shape as x / y, (n_points,) for gix, (nlines, width) for shape |
--x |
str | None |
input x coordinate of the data (longitude or range), any shape; with y |
--y |
str | None |
input y coordinate of the data (latitude or azimuth), same shape as x |
--gix |
str | None |
input grid index (azimuth, range) of a point cloud, shape (n_points, 2); 'radar_grid' polygons only |
--shape |
tuple[int, int] | None |
raster shape (nlines, width); 'radar_grid' polygons only |
--keep |
str | 'inside' |
'inside' keeps the data inside any polygon (True there), 'outside' keeps the data outside all polygons |
--chunks |
tuple[int, int], 1000) | (1000, 1000) |
output chunk size for shape; the other outputs are chunked like their input |
全局选项:--json、--traceback、--log FILE、-q / --quiet(约定)。
在 pipeline 文件中(示例 pipeline 未使用此命令;只列必需参数):
在 Python 中: