import numpy as np def dcum(a, b, t): """ 计算 PROSAIL 中使用的累积分布函数 dcum Parameters: - a: float - b: float - t: float, in degrees Returns: - f: float """ rd = np.pi / 180 # degree to radian if a >= 1: f = 1 - np.cos(rd * t) else: eps = 1e-8 x = 2 * rd * t p = x delx = 1.0 while delx >= eps: y = a * np.sin(x) + 0.5 * b * np.sin(2 * x) dx = 0.5 * (y - x + p) x += dx delx = abs(dx) f = (2 * y + p) / np.pi return f