summarize_temperature: Temperature summary statistics

Description Usage Arguments Details Value See Also Examples

View source: R/summarize_temperature.R

Description

Uses daily site data to calculate summary temperature statistics for an annual season.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
summarize_temperature(
  temperature,
  start_month,
  end_month,
  start_day = 15,
  end_day = start_day,
  growbase_low = 10,
  growbase_high = 30,
  na.rm = TRUE,
  wide = TRUE,
  id_index = 1,
  date_sep = "_"
)

Arguments

temperature

data frame with daily temperature data for each site

start_month

numeric starting month defining season (inclusive)

end_month

numeric ending month defining season (inclusive)

start_day

numeric day of starting month defining season (inclusive)

end_day

numeric day of ending month defining season (inclusive); defaults to start_day

growbase_low

numeric lower bound for calculating growing degree days (inclusive)

growbase_high

numeric upper bound for calculating growing degree days (inclusive)

na.rm

logical passed to summary statistic functions indicating treatment of NA values

wide

logical indicating whether or not to output as wide- formatted data

id_index

integer column index of unique site id

date_sep

character used to delimit variable prefix from date in column names; defaults to underscore ("_")

Details

User-defined seasons will be, at most, one year long, defined by the start_* and end_* parameters. Seasons can span across the new year, e.g. a season can start in November and end in March. Seasons are enumerated by the year in which they start; i.e. if a season starts in November and ends in March, the output for year YYYY will be based on the data from November and December of YYYY and January, February, and March of YYYY + 1.

By default, will return data in "long" format, with a column indicating the year the data correspond to (but see discussion of season enumeration above). If wide = TRUE, output will include a separate column for each statistic for each year (see Value). For example, if wide = FALSE and the data include daily measurements from 1997 to 2002, the output will have a column year and a column mean_season. For these same data, if wide = TRUE, there will be no year column, but instead it will contain columns mean_season_1997, mean_season_1998...mean_season_2002.

Value

tibble with temperature summary statistics If wide = FALSE, returns values for each year for each site:

mean_season

Mean temperature for the season

median_season

Median temperature for the season

sd_season

Standard deviation of temperature for the season

skew_season

Skew of temperatures for the season, where skew is defined by (mean - median)/sd

max_season

Maximum temperature over the season

gdd

Number growing degree days, defined as days with recorded temperature between growbase_low and growbase_high, inclusive

tempbin20

Number of days with temperature in the first quintile (0-20th percentile)

tempbin40

Number of days with temperature in the second quintile (20-40th percentile)

tempbin60

Number of days with temperature in the third quintile (40-60th percentile)

tempbin80

Number of days with temperature in the fourth quintile (60-80th percentile)

tempbin100

Number of days with temperature in the fifth quintile (80-100th percentile)

mean_gdd

Mean growing degree days across all seasons

sd_gdd

Standard deviation of growing degree days across all seasons

dev_gdd

Seasonal deviation from the mean number of growing degree days across all seasons

z_gdd

Difference between the number of growing degree days in a season and the mean number of growing degree days across all seasons, divided by sd_gdd

If wide = TRUE, all columns except mean_gdd and sd_gdd are replaced with one column for each year. For example, if the data include daily measurements from 1997 to 2002, there will be no mean_season column in the output, but will instead have columns mean_season_1997, mean_season_1998...mean_season_2002.

See Also

summarize_rainfall, par_summarize_temperature

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
# Season defined by 15 March through 15 November
temperature_summary <- summarize_temperature(temperature = temperature_2yr,
                                             start_month = 3,
                                             end_month = 11)

# As example above, but output in "long" format
temperature_summary <- summarize_temperature(temperature = temperature_2yr,
                                             start_month = 3,
                                             end_month = 11,
                                             wide = FALSE)

# Season defined by 30 November through 15 March
temperature_summary <- summarize_temperature(temperature = temperature_2yr,
                                             start_month = 11,
                                             end_month = 3,
                                             start_day = 30,
                                             end_day = 15)

## End(Not run)

jcoliver/weathercommand documentation built on Sept. 12, 2021, 3:28 a.m.