我有一个数据框,其中包括动物在纬度/经度坐标中的移动路径。
由此我得出了地面上的速度和方位。数据帧还包含相对于动物位置的风矢量,即在时间 t 相对于动物的风速和方位。
我想使用矢量加法来计算动物在空中的运动(而不是相对于地面),以便计算动物必须遵循的运动矢量,以便在给定风的情况下产生它的地理参考轨迹条件。
以下是一些示例数据:
lat lon speed.geo dir.geo speed.flow dir.flow
1 58.65417 -3.179046 NaN 0.00000 0.4308415 151.865239
2 58.65483 -3.180403 0.44041631 313.16209 0.4308415 151.865239
3 58.66102 -3.187734 0.05788974 328.34835 0.1310305 95.664332
4 58.66409 -3.190197 0.15473413 337.35945 0.2018593 150.394597
5 58.67433 -3.182058 0.04170939 22.44943 0.1635966 21.383810
6 58.67475 -3.181318 0.24299875 42.15219 0.1635966 21.383810
7 58.67520 -3.181994 0.21488370 322.13387 0.1635966 21.383810
8 58.67472 -3.181549 0.20505462 154.49798 0.1635966 21.383810
9 58.67325 -3.178166 1.11257613 129.96324 0.1379763 4.478803
10 58.67234 -3.177124 0.45663637 149.03759 0.1357501 357.369873
它在一个输入中:
structure(list(lat = c(6501.55844075436, 6501.63236163928, 6502.32219361407,
6502.66453486307, 6503.80350448795, 6503.85070971918, 6503.90114368413,
6503.84707158286, 6503.68242346453, 6503.5817192008), lon = c(489.610443265389,
489.531898544151, 489.108436319722, 488.966512812528, 489.441757188732,
489.484800489562, 489.445733748482, 489.471394150017, 489.667148867539,
489.727314726641), speed.geo = c(NaN, 0.440416314391926, 0.0578897406018802,
0.154734132490158, 0.0417093915733849, 0.242998750785266, 0.214883703663591,
0.205054624380294, 1.11257613127184, 0.45663636779519), dir.geo = c(0,
313.1620935132, 328.348350423236, 337.359451215582, 22.4494313495932,
42.1521946548759, 322.133869730753, 154.497980751214, 129.963235575701,
149.037589410303), speed.flow = c(0.430841479520486, 0.430841479520486,
0.131030528451571, 0.201859265857843, 0.16359657788002, 0.16359657788002,
0.16359657788002, 0.16359657788002, 0.137976282783002, 0.135750095569998
), dir.flow = c(151.865238547752, 151.865238547752, 95.6643315716291,
150.394596637891, 21.3838095217828, 21.3838095217828, 21.3838095217828,
21.3838095217828, 4.47880272242145, 357.369872864835)), .Names = c("lat",
"lon", "speed.geo", "dir.geo", "speed.flow", "dir.flow"), row.names = c(NA,
-10L), class = "data.frame")
预期的输出应该是数据框中的另外 2 列,表示动物相对于气流的运动矢量(即其飞行速度和方向)。它实际上是基本的三角函数,但我无法在 R 中计算它......