climate_summaries: Summarize Climate Data

Description Usage Arguments Value Author(s) Examples

Description

Summarizes climate data over desired date ranges, across monthly, annual, or full time intervals, and (optionally) across periods defined by other climate variables.

Usage

1
2
3
  climate_summaries(climate_data, date_range, summary_type,
    summary_interval = "all", apply_maxmin,
    verbose = FALSE, probs, tie_value = "random")

Arguments

climate_data

A climate data raster to which summary_type is applied; summaries of these values are returned except when the summary method is which.min.simple or which.max.simple.

date_range

The date range over which climate_data should be summarized.

summary_type

The type of summary applied to climate_data (options are "which.min.simple", "which.max.simple", "min","max","sum","mean","sd","cv","spi","quantile").

summary_interval

The interval over which values are returned (options are "all", "monthly",
"yearly")

apply_maxmin

A climate data raster containing values to be summarized and returned if
which.min.simple or which.max.simple is summary method.

verbose

verbose=TRUE will print process information.

probs

Numeric vector of probabilities with values in [0,1] used by
summary_type=quantile.

tie_value

Controls how non-unique extreme values are accommodated by the summary method when summary_type is which.min.simple or which.max.simple.

Value

Returns a raster layer.

Author(s)

Jonathan A. Greenberg

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
## Not run: 

# Use example file for Tahoe, California, USA
require(R.utils)
require(climstats)

load(system.file("extdata/pptTahoe.RData",package="climstats"))
# View dates of precipitation file
getZ(pptTahoe)

# View summary
#	(this layer was standardized; units are average mm H2O per day)
pptTahoe

##Summarize precipitation

# Total precipitation for 1992
date_range_92=c("1992-01-01","1992-12-31")
ppt_92_perday=climate_summaries(climate_data=pptTahoe,
	date_range=date_range_92,summary_type="mean",
	summary_interval="yearly")
# Convert from average mm H2O/day to total mm H2O/day
ppt_92=ppt_92_perday*365

# View both 1992 and 1993 precipitation
date_range_9293=c("1992-01-01","1993-12-31")
ppt_9293_perday=climate_summaries(climate_data=pptTahoe,
	date_range=date_range_9293,summary_type="mean",
	summary_interval="yearly")
ppt_9293=ppt_9293_perday*365
ppt_9293
# Total precipitation was lower in 1992 than in 1993

#Now get average annual precipitation for the period 1992-1993
ppt_mean_perday=climate_summaries(climate_data=pptTahoe,
	date_range=date_range_9293,summary_type="mean",summary_interval="all")
ppt_mean_all=ppt_mean_perday*365

# Download and post-process PRISM monthly precipitation data
		ppt_perday = get_climate_data("PRISM-4km-ppt",
			date_range = c("1999/1/1","2000/12/31"),standardize = TRUE,
			overwrite = FALSE,enable_download = T, verbose = T)
		summary(ppt_perday)
		getZ(ppt_perday)
		#This file can be used for ETO or other calculations
		#	requiring daily averages

		ppt = get_climate_data("PRISM-4km-ppt", date_range = c("1999/1/1",
			"2000/12/31"),standardize = FALSE, overwrite = FALSE,
			enable_download = T, verbose = T)
		summary(ppt)
		#Convert PRISM data to total mm H2O/month
		ppt=apply_gains_offsets(pptTahoe,gains=(1/100),
			divide_by_days_in_month=FALSE)
		#This file can be used to calculate total precipitation

# Annual Precipitation
		date_range=c("1999-01-01","2000-12-31")
		ppt_month_mean=climate_summaries(climate_data=ppt,date_range=date_range,
			summary_type="mean",summary_interval="all")
		ppt_mean_all=12*ppt_month_mean
		#This is an alternative to using the "sum" function

# Monthly Precipitation
		ppt_mean_monthly=climate_summaries(ppt,date_range=date_range,
			summary_type="mean",summary_interval="monthly")

# Precipitation of Wettest Month
		monthly_date_range=c("9999-01-01","9999-12-31")
		ppt_of_max_ppt_mean_monthly=
			climate_summaries(climate_data=ppt_mean_monthly,
			date_range=monthly_date_range,summary_type="which.max.simple",
			summary_interval="all",apply_maxmin=ppt_mean_monthly)

# Precipitation of Driest Month
		ppt_of_min_ppt_mean_monthly=
			climate_summaries(climate_data=ppt_mean_monthly,
			date_range=monthly_date_range,summary_type="which.min.simple",
			summary_interval="all",apply_maxmin=ppt_mean_monthly)

# Precipitation Seasonality (Coefficient of Variation)
		ppt_mean_monthly_cv_all=
			climate_summaries(climate_data=ppt_mean_monthly,
			date_range=monthly_date_range,summary_type="cv",summary_interval="all")

# Min standard precipitation index (SPI)
		ppt_spi_all=climate_summaries(climate_data=ppt,date_range=date_range,
			summary_type="spi",summary_interval="all")
		setZ(ppt_spi_all,getZ(ref),name='time')
		ppt_spi_all_min=climate_summaries(climate_data=ppt_spi_all,
			date_range=date_range,summary_type="min",summary_interval="all")

# Max standard precipitation index (SPI)
		ppt_spi_all_max=climate_summaries(climate_data=ppt_spi_all,
			date_range=date_range,summary_type="max",summary_interval="all")

## End(Not run)

climstats documentation built on May 2, 2019, 6:15 p.m.