Temperatures data compatibility

As you can see in Phenological models for each species, each function that predicts phenological dates from temperatures have methods which take in arguments data temperatures either as vector (for exemple TG_vec), dataframe or .txt file. In this page we will explain which temperatures data file this package can handle and how the data is extracted to be used.

Below we present the two types of file in format .txt tolerated by this package :

Some data file exemples are available in the station folder on the github repository of the package. This package has functions which can read and clean the data temperatures and their dates and return them in a dataframe object :

Phenology.extract_seriesFunction
extract_series(file::String; year=nothing)

Extracts the temperatures time series from file and return a dataframe. You can precise the year with the argument year. If truncate_results = true, truncates the series with the function truncate_MV. If the file name starts with "TN", "TG" or "TX", the function considers that it is an ECA&D file and returns a dataframe with a date column and one temperature column of the type precised in the name of the file. Otherwise it considers that it is a file from the DRIAS database so it returns a dataframe with one column for the date and three columns for the three types of daily temperatures.

source
Phenology.truncate_MVFunction
truncate_MV(df)

Truncates the dataframe of temperatures series df to remove missing values. If there is a missing value in the last 1000 values, it removes all the values after. If there is a missing value before, the function removes all the values before.

source

Some functions (like Phenology.Apple_Phenology_Pred) can take as arguments directly the name of the file to return phenology predictions by calling a method which itself calls extract_series. They can also take dataframes which have a DATE and TN, TG or TX columns. Because some phenological models need daily temperatures of multiple type, if they are extracted from different files with different timelines, we need to truncate this data to have a common timeline. This is the role of Common_indexes :

Phenology.Common_indexesFunction
Common_indexes(series_vec::AbstractVector{DataFrame})
Common_indexes(files...)

From different ECA&D-type dataframes (with 2 colums) in series_vec or extracted in files return a tuple with the series of their mutual date and their associated temperatures in a matrix. For exemple if we consider a dataframe df_TN of daily minimal temperatures from 1985 to 2010 and another one df_TX of daily maximal temperatures from 1970 to 2005, Common_indexes(df_TN,df_TX) will return a tuple (date_vec, x) where :

  • date_vec is the dates vector (each day as Date object) for the period 1985-2005.
  • x is a matrix where the first column is the series of daily minimal temperatures and the second the series of daily maximal temperatures, both corresponding to the dates in date_vec.
source