跳转至

12 - 统计植被

当一棵树有几十万片叶子,或者研究的是大面积冠层时,逐片建模既不现实,也不必要。统计植被只描述冠层占据的空间,空间内部的叶片用叶面积密度、叶倾角分布和叶片光学属性统计地描述。光线在冠层内按这些统计参数发生遮挡、散射和吸收。

表示方式 适用
三角网格 需要叶片形状、叶簇聚集等几何细节
统计植被 叶片数量很多,关注冠层尺度的辐射和生理量
两者结合 树干、枝条用三角网格,叶簇用统计植被

冠层边界

统计植被的范围由一个封闭的三角网格给出,通常就是树冠的外形:

import less

crown = less.TurbidBoundary(less.asset_path("tutorial_tree.obj"), group="crown")

边界网格需要满足:

  • 三角形围成封闭、不自相交的体积;
  • 各面朝向一致,没有开口、重复面或面积为零的三角形。

边界本身不反射也不吸收光,它只界定统计叶片所在的空间。

冠层内的叶片

OpticalVegetation 描述边界内的叶片:

vegetation = less.OpticalVegetation(
    leaf=less.Prospect(cab=40, car=10),
    leaf_area_density=1.5,               # m² 叶 / m³ 冠层
    leaf_angle_distribution="spherical",
    leaf_size=(0.08, 0.04),              # 叶片长、宽(m)
    leaf_shape="ellipse",
)
参数 含义
leaf 代表叶片的光学属性,可以是 Prospect、Fluspect、MeasuredSpectrum 等
leaf_area_density 单位体积冠层内的单面叶面积(m² m⁻³)
leaf_angle_distribution 叶倾角分布
leaf_size、leaf_shape 叶片实际大小和形状("ellipse" 或 "rectangle"),决定热点效应的宽度

叶倾角分布:

名称 特征
spherical 叶片法向在各方向均匀分布,缺少实测信息时常用
uniform 倾角在 0–90° 之间均匀分布
planophile 以水平叶为主
erectophile 以直立叶为主
plagiophile 以中等倾角为主
extremophile 水平叶和直立叶都较多

不给出 leaf_size 时,叶片被视为无穷小,没有热点效应。

统计树冠配三角网格树干

tutorial_tree.obj 包含一个封闭树冠 crown 和一个树干 trunk。树冠用统计植被,树干用三角网格:

tree = less.Object("tree")
tree.add_component("crown", crown)
tree.add_component("trunk", less.Mesh(less.asset_path("tutorial_tree.obj"), group="trunk"))
tree.set_property("crown", vegetation)
tree.set_property("trunk", less.Lambertian(reflectance=0.12))

scene = less.Scene()
scene.size = (20.0, 20.0)
scene.terrain = less.Terrain(property=less.Lambertian(reflectance=0.15))
scene.illumination = less.Illumination(
    source=less.Sun(zenith=30, azimuth=150),
    atmosphere=less.SimpleSpectralAtmosphere(turbidity=2.5))
scene.add(tree, positions=[(5, 5, 0), (10, 12, 0), (15, 6, 0)])

image = scene.simulate(less.OpticalImager(
    less.Orthographic(image_size=128), bands=[550, 680, 850], quality=64))
brf = image.to_brf()
brf.save("turbid_brf.tif")

同一条光线依次与树干表面、统计叶片和地面发生作用,多次散射在一次模拟中完成。统计植被可以用于本书介绍的所有传感器和过程,用法与三角网格完全相同。

叶面积

统计植被的叶面积等于边界内的体积乘以叶面积密度:

print(scene.measure(less.LAIMeasurement(group_by="component")))
print(scene.measure(less.LAIMeasurement(property_filter=less.Prospect)))

property_filter=less.Prospect 同时匹配 Prospect 三角网格叶片和代表叶片为 Prospect 的统计植被。放大边界会增加体积,从而增加叶面积。边界超出场景的部分不计入;周期场景中,跨越边界的部分折回场景内计算。

整片冠层

把边界做成覆盖整个场景的长方体,并开启周期边界,就得到水平均匀、无限延伸的冠层,与一维冠层模型的假设相同:

from pathlib import Path

def write_box(path, width, height):
    """以 OBJ 坐标写一个 width × width × height 的长方体(Y 轴向上)。"""
    v = [(0, 0, 0), (-width, 0, 0), (-width, height, 0), (0, height, 0),
         (0, 0, -width), (-width, 0, -width), (-width, height, -width), (0, height, -width)]
    faces = [(1, 4, 3), (1, 3, 2), (5, 6, 7), (5, 7, 8), (1, 5, 8), (1, 8, 4),
             (2, 3, 7), (2, 7, 6), (1, 2, 6), (1, 6, 5), (4, 8, 7), (4, 7, 3)]
    Path(path).write_text("g canopy\n" + "".join(f"v {x} {y} {z}\n" for x, y, z in v)
                          + "".join("f %d %d %d\n" % f for f in faces))

write_box("canopy_box.obj", 1.0, 2.0)

canopy = less.Object("canopy")
canopy.add_component("leaves", less.TurbidBoundary("canopy_box.obj", group="canopy"))
canopy.set_property("leaves", less.OpticalVegetation(
    leaf=less.Prospect(cab=40), leaf_area_density=1.5, leaf_angle_distribution="spherical"))

field = less.Scene()
field.size = (1.0, 1.0)
field.repetitive = True
field.terrain = less.Terrain(property=less.Lambertian(reflectance=0.15))
field.illumination = less.Illumination(
    source=less.Sun(zenith=30, azimuth=180), atmosphere=less.NoAtmosphere())
field.add(canopy, positions=[(0.0, 0.0, 0.0)])

print("LAI:", field.measure(less.LAIMeasurement()))      # 1.5 × 2 = 3
field_brf = field.simulate(less.BRFSensor(
    bands=[650, 850], directions=[(0, 0), (30, 180), (30, 0)], num_photons=500_000))
print(field_brf.brf)

这里冠层高 2 m,叶面积密度 1.5 m² m⁻³,LAI 为 3。

采样设置

光学成像只需要通过 quality、num_photons 等参数控制光线数量。辐射场、能量平衡、光合作用和荧光等过程还需要在冠层内部布置统计叶片样本,用来记录叶片的吸收、温度和生理状态。样本的数量和分布由 TurbidSampling 控制:

crown = less.TurbidBoundary(
    less.asset_path("tutorial_tree.obj"),
    group="crown",
    sampling=less.TurbidSampling(quality="standard", seed=7),
)
参数 作用
quality "preview"、"standard" 或 "high"
sample_budget 每个实例的目标样本数,不给出时由 quality 决定
seed 随机种子,相同的种子和设置得到相同的样本
orientation_theta_bins、orientation_phi_bins 叶片方向的离散数
max_samples_per_leaf_cell 每个空间单元的样本上限

可以先用 "preview" 检查场景,再用 "standard" 或 "high" 计算正式结果,并比较两者确认结果已经稳定。这些过程的用法见第 31–33 章。

下一步