【发布时间】:2019-06-06 15:16:12
【问题描述】:
我有这个 python 函数,它根据纬度和一年中的哪一天计算日长(来源:https://gist.github.com/anttilipp/ed3ab35258c7636d87de6499475301ce)。
def daylength(dayOfYear, lat):
latInRad = np.deg2rad(lat)
declinationOfEarth = 23.45*np.sin(np.deg2rad(360.0*(283.0+dayOfYear)/365.0))
if -np.tan(latInRad) * np.tan(np.deg2rad(declinationOfEarth)) <= -1.0:
return 24.0
elif -np.tan(latInRad) * np.tan(np.deg2rad(declinationOfEarth)) >= 1.0:
return 0.0
else:
hourAngle = np.rad2deg(np.arccos(-np.tan(latInRad) * np.tan(np.deg2rad(declinationOfEarth))))
return 2.0*hourAngle/15.0
dayOfYear : int 和 lat : float 的位置
我该如何调整,以便 lat 使用我的数组 latarray 中的值来创建相同 .shape(883,1368) 的新数组?
【问题讨论】: