跳转至

transform: transform coordinate between projection

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

命令 摘要
transform Coordinate transformation

transform

Coordinate transformation. By default, the input should be longitude (xx_in) and latitude (yy_in) (in degree) and outputs are x (east) and y (south) coordinate in web mercator projection (for plot with google earth map). The chunks, shape and dtype of output are same as xx_in.

moraine transform --xx_in VALUE --yy_in VALUE --xx_out VALUE --yy_out VALUE [--epsg_in VALUE] [--epsg_out VALUE]
参数 类型 默认值 说明
--xx_in 必需 input x coordinate (longitude in degree for the default epsg_in)
--yy_in 必需 input y coordinate (latitude in degree for the default epsg_in)
--xx_out 必需 output x coordinate in epsg_out, same shape and chunks as xx_in
--yy_out 必需 output y coordinate in epsg_out, same shape and chunks as xx_in
--epsg_in int 4326 EPSG code of the input coordinates (4326: WGS84 longitude/latitude)
--epsg_out int 3857 EPSG code of the output coordinates (3857: web mercator)

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

在 pipeline 文件中(examples/01_load.toml,步骤 web_mercator):

[[step]]
name = "web_mercator"             # e/n coordinates, used to plot point clouds on a map
run = "transform"
xx_in = "raw/lon.zarr"
yy_in = "raw/lat.zarr"
xx_out = "raw/e.zarr"
yy_out = "raw/n.zarr"

在 Python 中:

import moraine.cli as mc
mc.transform(xx_in, yy_in, xx_out, yy_out, epsg_in=4326, epsg_out=3857)