
Enrich a get_weather() Output with Derived Parameters
Source:R/env_data_collection_src.R
processWTH.RdConvenience wrapper chaining param_radiation,
param_atmospheric and param_temperature.
Usage
processWTH(
env.data,
PREC = NULL,
Tdew = NULL,
Tmin = NULL,
Tmax = NULL,
RH = NULL,
Rad = NULL,
G = 0,
Alt = 600,
Tbase1 = 9,
Tbase2 = 45,
Topt1 = 26,
Topt2 = 32,
method = c("standard", "legacy"),
alpha = 1.26,
verbose = TRUE
)Arguments
- env.data
data.frame. A
get_weatheroutput.- PREC, Tdew, Tmin, Tmax, RH, Rad
character. Column names passed through to the underlying functions.
- G
numeric. Soil heat flux. Default 0.
- Alt
numeric or character. Elevation in metres, or the name of an elevation column.
- Tbase1, Tbase2, Topt1, Topt2
numeric. Cardinal temperatures.
- method
character. GDD method, see
param_temperature.- alpha
numeric. Priestley-Taylor coefficient.
- verbose
boolean. Print progress messages.
Details
If env.data already carries n, N or RTA from
get_weather, those columns are dropped before recomputation to avoid
duplicated names. Note that get_weather() derives n from
ALLSKY_SFC_SW_DNI whereas param_radiation() uses
ALLSKY_SFC_SW_DWN, so the recomputed values may differ.
Examples
# \donttest{
env.data <- get_weather(lat = -13.05, lon = -56.05)
#> ---------------------------------------------------------------
#> get_weather -- downloads daily weather from NASA POWER
#> Last updated at 09/27/2026
#> ---------------------------------------------------------------
#> start.day is NULL; matched as 2024-01-26
#> end.day is NULL; matched as 2024-02-25
#> ---------------------------------------------------------------
#> get_weather() - daily weather from NASA POWER
#> https://docs.ropensci.org/nasapower
#> ---------------------------------------------------------------
#> Start .............................. Thu Oct 22 18:34:55 2026
#> Environmental units ................ 1
#> Parallel ........................... [ ]
#> [1/1] env1 downloaded
#> Computing VPD ...................... [ x ]
#> Computing N, RTA ................... [ x ]
#> Computing n ........................ [ x ]
#> Computing TH1 ...................... [ x ]
#> Computing TH2 ...................... [ x ]
#> Computing PAR_TEMP ................. [ x ]
#> Environmental units downloaded ..... 1/1
#> Daily weather features ............. 25
#> Done ............................... Thu Oct 22 18:34:55 2026
#> Total time ......................... 0.79s
processWTH(env.data)
#> ---------------------------------------------------------------
#> processWTH -- derives all agro-meteorological parameters
#> Last updated at 09/27/2026
#> ---------------------------------------------------------------
#> Dropping existing column(s) before recomputation: n, N, RTA, VPD
#> - radiation parameters computed
#> - atmospheric-demand parameters computed
#> - temperature-response parameters computed
#> env LON LAT YEAR MM DD DOY YYYYMMDD daysFromStart T2M T2M_MAX
#> 1 env1 -56.05 -13.05 2024 1 26 26 2024-01-26 1 27.02 32.35
#> 2 env1 -56.05 -13.05 2024 1 27 27 2024-01-27 2 26.85 32.83
#> 3 env1 -56.05 -13.05 2024 1 28 28 2024-01-28 3 26.85 32.99
#> 4 env1 -56.05 -13.05 2024 1 29 29 2024-01-29 4 26.38 31.29
#> 5 env1 -56.05 -13.05 2024 1 30 30 2024-01-30 5 27.15 33.14
#> 6 env1 -56.05 -13.05 2024 1 31 31 2024-01-31 6 26.98 31.98
#> 7 env1 -56.05 -13.05 2024 2 1 32 2024-02-01 7 27.68 35.01
#> 8 env1 -56.05 -13.05 2024 2 2 33 2024-02-02 8 25.82 29.41
#> 9 env1 -56.05 -13.05 2024 2 3 34 2024-02-03 9 24.92 29.08
#> 10 env1 -56.05 -13.05 2024 2 4 35 2024-02-04 10 23.90 27.20
#> 11 env1 -56.05 -13.05 2024 2 5 36 2024-02-05 11 23.85 26.68
#> 12 env1 -56.05 -13.05 2024 2 6 37 2024-02-06 12 24.70 29.19
#> 13 env1 -56.05 -13.05 2024 2 7 38 2024-02-07 13 26.19 31.14
#> 14 env1 -56.05 -13.05 2024 2 8 39 2024-02-08 14 26.32 31.06
#> 15 env1 -56.05 -13.05 2024 2 9 40 2024-02-09 15 26.46 30.88
#> 16 env1 -56.05 -13.05 2024 2 10 41 2024-02-10 16 26.55 30.83
#> 17 env1 -56.05 -13.05 2024 2 11 42 2024-02-11 17 25.10 27.73
#> 18 env1 -56.05 -13.05 2024 2 12 43 2024-02-12 18 24.88 28.62
#> 19 env1 -56.05 -13.05 2024 2 13 44 2024-02-13 19 25.75 30.60
#> 20 env1 -56.05 -13.05 2024 2 14 45 2024-02-14 20 26.60 31.55
#> 21 env1 -56.05 -13.05 2024 2 15 46 2024-02-15 21 26.90 32.02
#> 22 env1 -56.05 -13.05 2024 2 16 47 2024-02-16 22 26.97 32.18
#> 23 env1 -56.05 -13.05 2024 2 17 48 2024-02-17 23 26.72 32.45
#> 24 env1 -56.05 -13.05 2024 2 18 49 2024-02-18 24 25.11 29.68
#> 25 env1 -56.05 -13.05 2024 2 19 50 2024-02-19 25 25.12 28.54
#> 26 env1 -56.05 -13.05 2024 2 20 51 2024-02-20 26 24.95 29.32
#> 27 env1 -56.05 -13.05 2024 2 21 52 2024-02-21 27 25.66 29.68
#> 28 env1 -56.05 -13.05 2024 2 22 53 2024-02-22 28 25.83 29.85
#> 29 env1 -56.05 -13.05 2024 2 23 54 2024-02-23 29 25.60 29.36
#> 30 env1 -56.05 -13.05 2024 2 24 55 2024-02-24 30 24.89 28.83
#> 31 env1 -56.05 -13.05 2024 2 25 56 2024-02-25 31 26.04 30.94
#> T2M_MIN T2MDEW ALLSKY_SFC_LW_DWN ALLSKY_SFC_SW_DWN ALLSKY_SFC_SW_DNI
#> 1 22.32 22.44 35.30 26.78 25.35
#> 2 21.62 21.64 34.43 28.22 26.59
#> 3 21.87 21.63 35.53 25.32 21.41
#> 4 22.29 22.23 36.41 21.83 13.90
#> 5 22.20 22.26 36.32 23.93 16.35
#> 6 22.93 22.83 36.66 22.36 15.35
#> 7 22.18 23.07 36.21 23.51 16.23
#> 8 23.30 23.31 36.22 17.62 5.43
#> 9 22.35 21.99 35.69 10.93 1.17
#> 10 21.99 22.63 35.98 15.04 2.12
#> 11 21.27 22.35 35.33 19.96 6.61
#> 12 21.02 21.95 35.24 24.17 17.73
#> 13 21.69 22.82 36.01 20.44 11.75
#> 14 21.68 22.32 36.00 21.35 14.15
#> 15 22.39 23.55 36.15 24.04 18.63
#> 16 22.78 23.69 36.90 14.18 4.39
#> 17 23.28 23.71 36.27 16.46 3.98
#> 18 22.39 22.66 35.98 13.06 0.42
#> 19 21.16 22.71 36.25 23.18 15.54
#> 20 21.86 23.19 35.96 24.90 24.11
#> 21 22.10 23.31 36.05 25.94 24.93
#> 22 22.01 23.44 35.96 24.54 18.15
#> 23 22.57 23.20 36.73 15.83 5.74
#> 24 20.63 22.99 36.31 20.02 7.81
#> 25 22.74 23.89 36.44 14.02 1.07
#> 26 21.72 23.16 36.24 16.11 5.01
#> 27 22.44 23.47 36.69 17.04 8.82
#> 28 23.22 23.62 36.82 15.06 5.11
#> 29 22.81 23.48 36.75 12.66 1.80
#> 30 22.58 23.14 36.22 19.14 8.83
#> 31 21.73 23.06 35.68 24.17 20.23
#> ALLSKY_SFC_PAR_TOT ALLSKY_SFC_UVA ALLSKY_SFC_UVB PRECTOT EVPTRNS QV2M RH2M
#> 1 12.65 1.73 0.05 0.98 10.53 17.69 78.25
#> 2 13.09 1.77 0.05 0.04 12.96 16.82 76.13
#> 3 11.90 1.62 0.05 0.02 10.89 16.78 76.02
#> 4 10.52 1.46 0.05 3.89 5.53 17.37 79.65
#> 5 11.43 1.56 0.05 11.19 6.96 17.46 77.67
#> 6 10.80 1.51 0.05 7.07 10.02 18.05 80.10
#> 7 11.21 1.54 0.05 20.72 8.53 18.35 78.88
#> 8 8.67 1.21 0.04 8.17 5.96 18.56 86.85
#> 9 5.53 0.80 0.03 10.30 8.06 17.13 85.02
#> 10 7.65 1.13 0.04 30.84 2.82 17.81 92.81
#> 11 9.76 1.36 0.04 12.36 3.74 17.51 91.65
#> 12 11.59 1.61 0.05 12.10 7.53 17.07 85.54
#> 13 9.97 1.42 0.05 4.50 11.10 18.04 83.04
#> 14 10.35 1.45 0.05 14.02 11.88 17.55 79.76
#> 15 11.55 1.55 0.05 10.55 10.42 18.88 85.29
#> 16 7.05 0.98 0.03 18.91 12.13 19.04 85.42
#> 17 8.17 1.13 0.04 22.32 4.33 19.03 92.31
#> 18 6.52 0.88 0.03 0.93 8.37 17.82 88.18
#> 19 11.21 1.54 0.05 1.49 12.34 17.88 84.44
#> 20 11.90 1.63 0.05 0.76 14.01 18.41 82.96
#> 21 12.34 1.68 0.05 4.73 12.68 18.57 82.17
#> 22 11.68 1.59 0.05 5.48 13.25 18.73 82.63
#> 23 7.84 1.10 0.03 2.97 12.40 18.48 82.71
#> 24 9.74 1.35 0.04 30.18 7.17 18.28 88.88
#> 25 7.00 0.98 0.03 20.53 3.72 19.29 93.09
#> 26 8.02 1.15 0.04 16.51 7.66 18.47 90.46
#> 27 8.46 1.22 0.04 3.54 9.43 18.83 88.61
#> 28 7.53 1.07 0.03 1.73 8.07 18.98 88.46
#> 29 6.43 0.92 0.03 1.51 9.25 18.79 88.82
#> 30 9.42 1.31 0.04 6.72 6.09 18.36 90.64
#> 31 11.56 1.59 0.05 2.25 12.62 18.28 84.88
#> GWETROOT GWETTOP FROST_DAYS WS2M TH1 TH2 PAR_TEMP n
#> 1 0.71 0.73 0 0.38 77.92817 76.2984 0.4681717 8.472473
#> 2 0.69 0.70 0 0.35 77.39841 75.8404 0.4875233 8.925401
#> 3 0.68 0.68 0 0.43 77.38490 75.8368 0.4432030 8.005939
#> 4 0.68 0.68 0 0.34 77.07940 75.5828 0.3987870 6.900611
#> 5 0.68 0.72 0 0.42 78.06122 76.3636 0.4209945 7.562575
#> 6 0.69 0.75 0 0.46 78.09437 76.3988 0.4002965 7.064811
#> 7 0.69 0.77 0 0.34 79.05660 77.1852 0.4049855 7.426641
#> 8 0.73 0.80 0 0.46 76.99507 75.4116 0.3357862 5.565018
#> 9 0.72 0.75 0 0.49 75.30245 74.0364 0.2219101 3.451534
#> 10 0.75 0.89 0 0.50 74.34694 73.2468 0.3200837 4.748782
#> 11 0.78 0.85 0 0.49 74.15249 73.0960 0.4092243 6.301574
#> 12 0.77 0.83 0 0.40 74.99188 73.8020 0.4692308 7.630124
#> 13 0.77 0.80 0 0.46 77.16987 75.6052 0.3806796 6.452309
#> 14 0.76 0.82 0 0.39 76.99642 75.5552 0.3932371 6.739458
#> 15 0.77 0.82 0 0.41 77.87819 76.1380 0.4365079 7.588719
#> 16 0.76 0.84 0 0.45 78.04266 76.2784 0.2655367 4.476430
#> 17 0.79 0.89 0 0.53 76.36878 74.8356 0.3254980 5.196635
#> 18 0.79 0.80 0 0.69 75.56285 74.2376 0.2620579 4.123710
#> 19 0.77 0.78 0 0.57 76.60845 75.1256 0.4353398 7.320274
#> 20 0.75 0.76 0 0.56 77.82941 76.1484 0.4473684 7.865006
#> 21 0.74 0.77 0 0.48 78.22138 76.4916 0.4587361 8.195451
#> 22 0.73 0.76 0 0.54 78.39207 76.6084 0.4330738 7.755299
#> 23 0.73 0.75 0 0.46 77.99478 76.2720 0.2934132 5.004312
#> 24 0.75 0.86 0 0.55 76.02385 74.5864 0.3878933 6.331199
#> 25 0.77 0.85 0 0.58 76.48570 74.9204 0.2786624 4.435552
#> 26 0.80 0.88 0 0.66 75.91779 74.4876 0.3214429 5.099091
#> 27 0.79 0.81 0 0.64 76.92332 75.3092 0.3296960 5.396158
#> 28 0.78 0.80 0 0.43 77.19325 75.5332 0.2915215 4.771760
#> 29 0.77 0.78 0 0.51 76.84528 75.2528 0.2511719 4.013718
#> 30 0.76 0.80 0 0.46 75.83407 74.4204 0.3784652 6.072062
#> 31 0.76 0.78 0 0.58 77.13628 75.5416 0.4439324 7.673153
#> N RTA VPD SPV ETP PETP GDD FRUE
#> 1 12.72843 40.23233 1.0570758 0.2127664 10.630404 -9.6504043 18.335 1.0000000
#> 2 12.71956 40.21623 1.1963363 0.2115765 11.187681 -11.1476814 18.225 1.0000000
#> 3 12.71052 40.19895 1.2402607 0.2137985 10.061920 -10.0419204 18.430 1.0000000
#> 4 12.70132 40.18047 0.9479085 0.2069256 8.610114 -4.7201143 17.790 1.0000000
#> 5 12.69196 40.16073 1.1868980 0.2164249 9.535815 1.6541854 18.670 1.0000000
#> 6 12.68244 40.13970 0.9927726 0.2140709 8.888212 -1.8182118 18.455 1.0000000
#> 7 12.67278 40.11734 1.3280358 0.2268024 9.465837 11.2541632 19.595 1.0000000
#> 8 12.66297 40.09360 0.6186276 0.2023610 6.913322 1.2566783 17.355 1.0000000
#> 9 12.65303 40.06845 0.7202045 0.1957995 4.254697 6.0453035 16.715 0.9832353
#> 10 12.64295 40.04184 0.3776662 0.1847477 5.770774 25.0692263 15.595 0.9173529
#> 11 12.63274 40.01374 0.3128784 0.1788592 7.595133 4.7648669 14.975 0.8808824
#> 12 12.62242 39.98412 0.6340613 0.1897132 9.335884 2.7641156 16.105 0.9473529
#> 13 12.61197 39.95292 0.7824328 0.2029855 8.025614 -3.5256136 17.415 1.0000000
#> 14 12.60141 39.92012 0.8544113 0.2025170 8.378339 5.6416606 17.370 1.0000000
#> 15 12.59073 39.88568 0.6804262 0.2052893 9.464216 1.0857844 17.635 1.0000000
#> 16 12.57996 39.84956 0.6819151 0.2070845 5.593827 13.3161734 17.805 1.0000000
#> 17 12.56908 39.81174 0.3567582 0.1936859 6.390417 15.9295835 16.505 0.9708824
#> 18 12.55811 39.77216 0.5607959 0.1936859 5.070403 -4.1404034 16.505 0.9708824
#> 19 12.54704 39.73082 0.6908651 0.1974738 9.041839 -7.5518386 16.880 0.9929412
#> 20 12.53589 39.68766 0.7864117 0.2060269 9.811012 -9.0510118 17.705 1.0000000
#> 21 12.52466 39.64267 0.8475449 0.2098021 10.263923 -5.5339232 18.060 1.0000000
#> 22 12.51334 39.59582 0.8393412 0.2101774 9.713967 -4.2339673 18.095 1.0000000
#> 23 12.50195 39.54707 0.9634764 0.2146710 6.296496 -3.3264958 18.510 1.0000000
#> 24 12.49049 39.49640 0.4906680 0.1902060 7.737894 22.4421064 16.155 0.9502941
#> 25 12.47896 39.44379 0.3687032 0.1950424 5.452396 15.0776044 16.640 0.9788235
#> 26 12.46736 39.38922 0.5029901 0.1938363 6.255720 10.2542795 16.520 0.9717647
#> 27 12.45571 39.33266 0.5504202 0.1993139 6.661641 -3.1216409 17.060 1.0000000
#> 28 12.44400 39.27410 0.6103149 0.2042394 5.921785 -4.1917848 17.535 1.0000000
#> 29 12.43223 39.21352 0.5414807 0.1995707 4.950843 -3.4408432 17.085 1.0000000
#> 30 12.42041 39.15089 0.5193414 0.1956984 7.449651 -0.7296505 16.705 0.9826471
#> 31 12.40855 39.08622 0.7193274 0.2021532 9.480949 -7.2309491 17.335 1.0000000
#> T2M_RANGE
#> 1 10.03
#> 2 11.21
#> 3 11.12
#> 4 9.00
#> 5 10.94
#> 6 9.05
#> 7 12.83
#> 8 6.11
#> 9 6.73
#> 10 5.21
#> 11 5.41
#> 12 8.17
#> 13 9.45
#> 14 9.38
#> 15 8.49
#> 16 8.05
#> 17 4.45
#> 18 6.23
#> 19 9.44
#> 20 9.69
#> 21 9.92
#> 22 10.17
#> 23 9.88
#> 24 9.05
#> 25 5.80
#> 26 7.60
#> 27 7.24
#> 28 6.63
#> 29 6.55
#> 30 6.25
#> 31 9.21
# }