Function to calculate model wind speed
Examples
times <- seq(as.POSIXct('2024-01-01',tz = 'UTC'),
as.POSIXct('2024-01-02',tz = 'UTC'),
by = 'hour')
U10 = data.frame(times = times,
test1 = c(3.29,2.07,1.96,2.82,3.73,
4.11,4.96,6.33,7.39,7.59,
7.51,7.22,6.81,6.43,5.81,
4.02,3.03,2.68,2.40,2.20,
2.09,1.95,1.66,1.39,1.4),
test2 = c(6.29,4.87,6.16,7.12,8.77,
10.16,10.85,11.45,11.21,11.04,
11.09,10.67,10.48,10.00,8.96,
6.36,5.62,5.83,5.83,5.25,
4.11,3.08,2.26,1.14,-0.10))
V10 = data.frame(times = times,
test1 = c(-8.87,-4.23,-2.81,-2.59,-4.58,
-4.80,-5.33,-5.86,-6.12,-6.13,
-6.11,-5.76,-5.91,-5.60,-5.09,
-3.33,-2.50,-2.29,-2.14,-2.07,
-1.95,-1.97,-2.04,-2.03,-1.9),
test2 = c(11.80,5.88,5.74,5.56,6.87,
8.39,8.68,8.33,7.90,7.42,
6.96,6.87,6.36,5.61,5.16,
4.16,4.25,4.59,4.51,3.90,
2.97,1.98,1.04,-0.08,-0.44))
uv2ws(u = U10, v = V10)
#> calculating wind speed ...
#> times test1 test2
#> 1 2024-01-01 00:00:00 9.460497 13.3717650
#> 2 2024-01-01 01:00:00 4.709331 7.6348739
#> 3 2024-01-01 02:00:00 3.426033 8.4198100
#> 4 2024-01-01 03:00:00 3.828903 9.0337146
#> 5 2024-01-01 04:00:00 5.906717 11.1404578
#> 6 2024-01-01 05:00:00 6.319185 13.1764069
#> 7 2024-01-01 06:00:00 7.280831 13.8947796
#> 8 2024-01-01 07:00:00 8.626036 14.1594986
#> 9 2024-01-01 08:00:00 9.595129 13.7140111
#> 10 2024-01-01 09:00:00 9.756280 13.3018044
#> 11 2024-01-01 10:00:00 9.681539 13.0931165
#> 12 2024-01-01 11:00:00 9.236125 12.6903822
#> 13 2024-01-01 12:00:00 9.016884 12.2588743
#> 14 2024-01-01 13:00:00 8.526717 11.4661284
#> 15 2024-01-01 14:00:00 7.724260 10.3395938
#> 16 2024-01-01 15:00:00 5.220086 7.5996842
#> 17 2024-01-01 16:00:00 3.928218 7.0460556
#> 18 2024-01-01 17:00:00 3.525124 7.4200404
#> 19 2024-01-01 18:00:00 3.215525 7.3708208
#> 20 2024-01-01 19:00:00 3.020745 6.5400688
#> 21 2024-01-01 20:00:00 2.858426 5.0707988
#> 22 2024-01-01 21:00:00 2.771895 3.6615297
#> 23 2024-01-01 22:00:00 2.630057 2.4878103
#> 24 2024-01-01 23:00:00 2.460285 1.1428036
#> 25 2024-01-02 00:00:00 2.360085 0.4512206