daymet_grid_agg: Aggregate daily Daymet data

Description Usage Arguments Details Examples

View source: R/daymet_grid_agg_deprecated.r View source: R/daymet_grid_agg.r

Description

Aggregates daily Daymet data by time to create convenient datasets for data exploration or modelling.

Aggregates daily 'Daymet' gridded products to monthly or annual time scales and creates a gridded (geotiff) output or raster object for easy post processing and modelling.

Usage

1
2
3
4
5
daymet_grid_agg(file = NULL, year = NULL, int = NULL, FUN = NULL,
  internal = FALSE)

daymet_grid_agg(file = NULL, year = NULL, int = NULL, FUN = NULL,
  internal = FALSE)

Arguments

file

character The name of the file to be processed. Use daily Daymet data.

year

Necessary if working with file in tif format. Provide the year that the data in file represents

int

Interval to aggregate by. Options are "monthly", "seasonal" or "annual".

FUN

Function to be used to aggregate data. Genertic R functions can be used. "mean" and "sum" are suggested. na.rm = TRUE by default.

internal

logical If FALSE, write the output to a tif file using the Daymet file format protocol.

output_directory

vector (optional) A path to a directory where output files should be written. Used only if internal = FALSE.

file

character string of name of file to be aggregated

int

interval to aggregate by. Options are "monthly" or "annual"

FUN

function to be used to aggregate data. Genertic R functions. "mean" and "sum" are suggested.

internal

TRUE / FALSE (if FALSE, write the output to file) using the Daymet file format protocol.

Details

This is intended to work for swe, dayl and srad data, for which ORNL-DAAC does not provide aggregated data.

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
 ## Not run: 
 # This code calculates the average minimum temperature by 
 # season for a subset region. In this example the data has 
 # already been downloaded using the download_daymet_ncss
 # function.
 
 # First, set the working directory as the directory 
 # containing the file to be aggregated.
 setwd(tempdir())
 
 # Next, specify the name of the file.
 data_file <- "tmin_daily_1980_ncss.nc"
 
 # Finally, run the function
 daymet_grid_agg(file = data_file,
                 int = "annual",
                 fun = "mean")
 
 # If you wish to write the aggregated result into a separate 
 # directory then specify the path to that directory, then pass 
 # that directory to the function.
 out_dir <- "c:/.../results/"

 daymet_grid_agg(file = data_file,
                 int = "annual",
                 fun = "mean", 
                 output_directory = out_dir)

 
## End(Not run)

mastefan/messy documentation built on April 19, 2018, 12:22 a.m.