<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>disease forecasting on Bhim Chaulagain</title><link>https://bhimchaulagain.netlify.app/tags/disease-forecasting/</link><description>Recent content in disease forecasting on Bhim Chaulagain</description><generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><copyright>B. Chaulagain {year}</copyright><lastBuildDate>Tue, 10 Mar 2020 21:13:14 -0500</lastBuildDate><atom:link href="https://bhimchaulagain.netlify.app/tags/disease-forecasting/index.xml" rel="self" type="application/rss+xml"/><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>