<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>weather data on Bhim Chaulagain</title><link>https://bhimchaulagain.netlify.app/tags/weather-data/</link><description>Recent content in weather data on Bhim Chaulagain</description><generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><copyright>B. Chaulagain {year}</copyright><lastBuildDate>Mon, 08 Jun 2020 21:13:14 -0500</lastBuildDate><atom:link href="https://bhimchaulagain.netlify.app/tags/weather-data/index.xml" rel="self" type="application/rss+xml"/><item><title>How to Estimate Leaf Wetness Duration (LWD) Using the CART Method in R</title><link>https://bhimchaulagain.netlify.app/post/2019-01-23-lwd-caclculation/</link><pubDate>Mon, 08 Jun 2020 21:13:14 -0500</pubDate><guid>https://bhimchaulagain.netlify.app/post/2019-01-23-lwd-caclculation/</guid><description>&lt;p>Leaf wetness duration (LWD) is a critical environmental variable in plant disease epidemiology and is widely used in disease forecasting and risk assessment models. Among the available empirical approaches, the Classification and Regression Tree (CART) method provides a practical framework for estimating LWD from standard weather observations.&lt;/p>
&lt;p>In this post, I demonstrate how to estimate leaf wetness duration in R using the CART approach, including data preparation, implementation steps, and interpretation of outputs for plant disease applications.&lt;/p>
&lt;p>If you want to connect leaf wetness duration to a full infection-risk workflow, see &lt;a href="https://bhimchaulagain.netlify.app/post/2023-02-01-generic_infection_risks/">How to Code the Magarey Generic Infection Model for Foliar Fungal Plant Pathogens in Python&lt;/a>.&lt;/p>
&lt;p>Let&amp;rsquo;s generate the dummy weather data and work through it. You can find the equation and procedure of CART method of leaf wetness estimation in this link: &lt;a href="https://doi.org/10.1094/PDIS.2002.86.2.179">https://doi.org/10.1094/PDIS.2002.86.2.179&lt;/a>&lt;/p>
&lt;pre>&lt;code class="language-r">Average_temperature &amp;lt;- sample(2:25, 20, replace=TRUE)
Dew_Point_Depression &amp;lt;- sample(0.5:5, 20, replace=TRUE)
Relative_Humidity &amp;lt;- sample(55:99, 20, replace=TRUE)
Windspeed &amp;lt;- sample(1.5:6, 20, replace=TRUE)
data &amp;lt;- data.frame(Average_temperature, Dew_Point_Depression, Relative_Humidity, Windspeed)
names(data)[1:4] &amp;lt;- c('tair', 'dpd', 'rh', 'wspeed')
head(data, 10)
#Use equations for CART method of leaf wetness estimation
wetdry &amp;lt;- numeric(dim(data)[1])
for (i in 1:length(wetdry)) {
c1 &amp;lt;- 1.6064 * sqrt(data$tair[i]) + 0.0036 * data$tair[i]^2 +
0.1531 * data$rh[i] - 0.4599 * data$wspeed[i] * data$dpd[i] - 0.0035 * data$tair[i] * data$rh[i]
c2 &amp;lt;- 0.7921 * sqrt(data$tair[i]) + 0.0046 * data$rh[i] - 2.3889 * data$wspeed[i] -
0.0390 * data$tair[i] * data$wspeed[i] + 1.0613 * data$wspeed[i] * data$dpd[i]
if (data$dpd[i] &amp;gt;= 3.7) {
wetdry[i] &amp;lt;- 'D'
} else if (data$wspeed[i] &amp;lt; 2.5 &amp;amp; c1 &amp;gt; 14.4674) {
wetdry[i] &amp;lt;- 'W'
} else if (data$wspeed[i] &amp;lt; 2.5 &amp;amp; c1 &amp;lt;= 14.4674) {
wetdry[i] &amp;lt;- 'D'
} else if (data$rh[i] &amp;gt;= 87.8 &amp;amp; c2 &amp;gt; 37.0) {
wetdry[i] &amp;lt;- 'W'
} else {
wetdry[i] &amp;lt;- 'D'
}
}
wetdry
&lt;/code>&lt;/pre></description></item><item><title>How to Create Weather-Based Predictors for Plant Disease Modeling in R</title><link>https://bhimchaulagain.netlify.app/post/2020-08-23-weather_predictors/</link><pubDate>Tue, 10 Mar 2020 21:13:14 -0500</pubDate><guid>https://bhimchaulagain.netlify.app/post/2020-08-23-weather_predictors/</guid><description>&lt;p>Weather-derived predictors play a fundamental role in plant disease predictive modeling and epidemiological analyses. During my research on sugarcane rust diseases, I developed multiple weather-based variables from high-frequency meteorological data to support disease forecasting and model development.&lt;/p>
&lt;p>In this post, I share several R scripts for generating commonly used weather predictors, including hourly, daily, weekly, and monthly summaries, as well as variables derived from specific periods within the day. Future posts will cover more advanced and biologically relevant weather variables used in disease epidemiology and predictive modeling workflows.&lt;/p>
&lt;p>For a full example of how weather inputs feed into a practical infection-risk engine, see &lt;a href="https://bhimchaulagain.netlify.app/post/2023-02-01-generic_infection_risks/">How to Code the Magarey Generic Infection Model for Foliar Fungal Plant Pathogens in Python&lt;/a>.&lt;/p>
&lt;pre>&lt;code class="language-r">library(readxl)
library(lubridate)
library(plyr)
Wdata &amp;lt;- read_excel(&amp;quot;weatherdata.xlsx&amp;quot;)
head (Wdata, 10)
str(Wdata)
Wdata$Period &amp;lt;- as.POSIXct(Wdata$Period, format = &amp;quot;%m/%d/%Y %H: %M: %S&amp;quot;)
str(Wdata)
#Create Multiple groups to split the data into Days, Weeks and Month
Wdata$days &amp;lt;- floor_date(Wdata$Period, &amp;quot;day&amp;quot;)
Wdata$weeks &amp;lt;- floor_date(Wdata$Period, 'week')
Wdata$month &amp;lt;- floor_date(Wdata$Period, 'month')
Wdata$hours &amp;lt;- floor_date(Wdata$Period, 'hours')
&lt;/code>&lt;/pre>
&lt;p>Lets calculate the weekly average of the temperature. You can use same process for other weather variables just by changing the column name and sums by changing the function name.&lt;/p>
&lt;p>Weekly average of temperature!&lt;/p>
&lt;pre>&lt;code class="language-r">WeeklyAvg_temp &amp;lt;- aggregate(Wdata$`2m T avg (F)`, by = list(Wdata$weeks), FUN = mean)
WeeklyAvg_temp
&lt;/code>&lt;/pre>
&lt;p>Lets calculate the weekly average of the temperature from(6 AM-9 PM) of each day.&lt;/p>
&lt;p>Use lubridate package for subsetting the data which contains the values from 6 AM to 9 PM.&lt;/p>
&lt;pre>&lt;code class="language-r">T6AMTo9PM &amp;lt;- subset(Wdata, hour(hours) &amp;gt;= 6 &amp;amp; hour(hours) &amp;lt;= 21 &amp;amp; days &amp;gt;= '2014-01-01' &amp;amp; days &amp;lt;= '2014-12-31')
&lt;/code>&lt;/pre>
&lt;p>After subsetting, lets calculate for temperature variable!&lt;/p>
&lt;pre>&lt;code class="language-r">T6AMTo9PM_WeeklyAvg_temp &amp;lt;- aggregate(T6AMTo9PM$`2m T avg (F)`, by = list(T6AMTo9PM$weeks), FUN = mean)
T6AMTo9PM_WeeklyAvg_temp
&lt;/code>&lt;/pre></description></item></channel></rss>