This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Entering data | |
week <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) | |
YLI <- c(3, 4, 5, 2, 6, 5, 4, 3, 5, 6, 2, 4) | |
YLS <- c(10, 11, 11, 12, 10, 11, 11, 10, 12, 13, 10, 11) | |
rainfall <- c(1, 10, 8, 6, 65, 30, 2, 10, 8, 6, 65, 30) | |
# Creating Data Frame | |
perf <- data.frame(week, YLI, YLS, rainfall) | |
# Plotting Charts and adding a secondary axis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function audpc(evaluation, dates) | |
n = length(evaluation) - 1 | |
disvec = Base.zeros(n) | |
datevec = Base.zeros(n) | |
out = 0.0 | |
for i in 1:n | |
disvec[i] = (evaluation[i] + evaluation[i + 1]) / 2 | |
datevec[i] = dates[i + 1] - dates[i] | |
out = sum(disvec .* datevec) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dat <- | |
dat %>% | |
left_join(wind, by = c("field" = "FIELD")) %>% | |
mutate( | |
field = factor(field), | |
trap_coord_deg = case_when( | |
trap_coord == "N" ~ 0, | |
trap_coord == "NbE" ~ 11.25, | |
trap_coord == "NNE" ~ 22.5, | |
trap_coord == "NEbN" ~ 33.75, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################## | |
# title : EPIRICE-sim-bs-lb.R; | |
# purpose : Install the epicrop package and simulate rice brown spot and | |
# rice leaf blast epidemics; | |
# producer : prepared by A. Sparks; | |
# last update : in Perth, WA, Australia, Jun 2021; | |
# inputs : na; | |
# outputs : leaf blast and brown spot model outputs of unmanaged disase | |
# epidemics; | |
# remarks : Prepared for Jean Fabrice Adanve; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("GSODR") | |
library("tidyr") | |
library("dplyr") | |
library("countrycode") | |
w <- get_GSOD(years = 1929:1931) | |
w <- | |
w %>% | |
group_by(CTRY, YEAR) %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function leaf_wet(wth = wth, simple = TRUE) | |
rh = diurnal_rh( | |
doy = wth[, DOY], | |
rh = wth[, RHUM], | |
tmin = wth[, TMIN], | |
tmax = wth[, TMAX], | |
tmp = wth[, TEMP], | |
lat = wth[, LAT] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Get weather data from NASA POWER API | |
#' | |
#' @param lonlat A numeric vector of geographic coordinates for a cell or region | |
#' entered as x, y coordinates. | |
#' @param dates A character vector of start and end dates in that order. | |
#' | |
#' @return A \code{\link[data.table]{data.table}} of weather data, dates and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("ggplot2") | |
library("ggthemes") | |
theme_set(theme_map()) | |
library("sf") | |
library("rnaturalearth") | |
library("rnaturalearthdata") | |
world <- ne_countries(scale = "medium", returnclass = "sf") | |
ctry <- world[world$name == "Philippines", ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(ggplot2) | |
library(lubridate) | |
library(cranlogs) | |
library(janitor) | |
dl <- | |
cran_downloads( | |
package = c( | |
"bomrang", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(bomrang) | |
library(tidyverse) | |
library(theme.usq) | |
# Find stations ---------------------------------------------------------------- | |
# Find nearest stations for each area | |
# search https://www.latlong.net/ for the lat lon values of each location | |
# clermont |