Giter VIP home page Giter VIP logo

fruclimadapt's Introduction

fruclimadapt: Evaluation tools for assessing climate adaptation of fruit tree species in R.

License: GPL v3 Travis (.com) branch CRAN/METACRAN

This package is a compilation of functions for the assessment of climate adaptation and the identification of potential risks for grapevines and fruit trees. Procedures in the package allow to:

  • Downscale daily meteorological variables to hourly values
  • Estimate chilling and forcing heat accumulation
  • Estimate plant phenology
  • Calculate bioclimatic indices to evaluate fruit tree and grapevine adaptation
  • Estimate the indicence of weather-related disorders in fruits
  • Estimate plant water requirements.

Resources


Installation

You can install the released version of fruclimadapt from CRAN with:

install.packages("fruclimadapt")

And the development version from GitHub with:

install.packages("devtools")
library(devtools)
devtools::install_github("Carm1r/fruclimadapt")

Menu


Using fruclimadapt

1. Required packages

install.packages("data.table")
install.packages("lubridate")
install.packages("tidyverse")
install.packages("zoo")

library(fruclimadapt)
library(data.table)
library(tidyverse)
library(zoo)

Menu


2. Example. Estimate the phenology of a peach cultivar

This example shows how to use the functions hourly_temps, chill_portions, GDH_linear and phenology_sequential to estimate the date of occurrence of the phenological stages for a nectarine cultivar, using daily weather data.

library(fruclimadapt)
# Generate a dataset with hourly temperatures from the dataset with daily values (Tudela_DW, included in the package)
data(Tudela_DW)
Tudela_HT <- hourly_temps(Tudela_DW,42.13132)
# Use the hourly dataset to calculate chill as chill portions and growing degree hours
# Calculate chill as chill portions, starting on DOY 305
Chill <- chill_portions(Tudela_HT,305)
# Calculate forcing heat as growing degree hours (GDH) with the linear model using base temperature 4.7 C and no upper thresholds
GDH <- GDH_linear(Tudela_HT,4.7,999,999)
# Combine the datasets Chill and GDH in a dataframe with a format compatible with the function phenology_sequential
Tudela_CH <- merge(Chill,GDH) %>%
   select(Date, Year, Month, Day, DOY, Chill,GDH) %>%
   arrange(Date) %>%
   rename(GD=GDH)
# Obtain the predicted dates for the cultivar "Big Top" using the requirement dataset included in the package (Bigtop_reqs)
data(Bigtop_reqs)
Phenology_BT <- phenology_sequential(Tudela_CH, Bigtop_reqs, 305)

Menu


3. Estimate the number and damage caused by spring frosts

This example shows how to use the function spring_frost to estimate the number and accumulated damage caused by spring frosts from budbreaking for the same nectarine cultivar used to estimate the phenology in the previous example.

library(fruclimadapt)

# Use the dataframe with the phenological dates obtained with phenology_sequential to generate a new one with the format required by the function spring_frost
Phenology_frost <- Phenology_BT %>% 
    select(Freq_Year,Freq_DOY) %>%
    rename(Year=Freq_Year,Pheno_date=Freq_DOY)
# Extract a dataframe with daily minimum temperatures from the daily climate example dataset with the  format required by spring_frost
 Tmin_Tudela <- Tudela_DW %>% 
   mutate(Date=make_date(Year,Month,Day), DOY=yday(Date)) %>%
   select(Year, DOY, Tmin) 
# Predict the number and accumulated damage of the spring frosts using the critical values contained in the example dataset Tcrits_peach and extract the dataframe with the total results for each year
 data(Tcrits_peach)
 Frost_BT <- spring_frost(Tmin_Tudela, Phenology_frost, Tcrits_peach, 181)
 Frost_results <- as.data.frame(Frost_BT[['Damage_frosts']])

Menu

Licenses

The R/fruclimadapt package as a whole is distributed under GPL-3 (GNU General Public License version 3).

Author

Carlos Miranda

fruclimadapt's People

Contributors

carm1r avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

fruclimadapt's Issues

Please import only the functions you use from data.table

hi @Carm1r
There are several instances of @import data.table in your roxygen comments, which get converted to import(data.table) in your NAMESPACE, which has the effect of importing everything that data.table exports.
In the new version of data.table on github master, remotes::install_github("Rdatatable/data.table") there are new exported objects yearmon and yearqtr.
There are also exported objects with these same two names in package zoo which you also import.
This has the effect of generating the following new warning when I run R CMD check fruclimadapt with data.table github master installed:

* checking whether package 'fruclimadapt' can be installed ... WARNING
Found the following significant warnings:
  Warning: replacing previous import 'data.table::yearmon' by 'zoo::yearmon' when loading 'fruclimadapt'
  Warning: replacing previous import 'data.table::yearqtr' by 'zoo::yearqtr' when loading 'fruclimadapt'

The fix would be to use @importFrom data.table setDT etc (for only the objects you use), instead of @import data.table.
Please update your code, then run R CMD check fruclimadapt_vers.tar.gz with data.table master installed.
After you update your code and R CMD check has no more errors, please submit a new version of fruclimadapt to CRAN.
This will help facilitate releasing a new version of data.table to CRAN.
(data.table devs must make sure all reverse dependencies do not break, before submitting a new version to CRAN)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.