cpcReadNCDF: Read in CPC Data from File

Description Usage Arguments Value

View source: R/cpcReadNCDF.R

Description

This function allows you to query your customized NCDF files generated by cpcYearToNCDF in an efficient manner with minimal worrying about syntax. In order for these queries to work, you need to first download the relevant data using the cpcYearToNCDF function for the years you wish to download. This function allows you to read those files, using the same download_folder parameter. It can return either tidy data or a 3D array.

Usage

1
2
cpcReadNCDF(start_date, end_date, lat_lims, lon_lims,
  download_folder = getwd(), tidy = T, round_lonlat = TRUE)

Arguments

start_date

the first date of data to extract. Must be a date class object: see lubridate::ymd for easy generation.

end_date

the last date of data to extract.

lat_lims

a vector of length 2 specifying the minimum and maximum latitudes to query

lon_lims

a vector of length 2 specifying the minimum and maximum longitudes to query

download_folder

the folder containing the .nc files you wish to read. Should be the same as the download_folder argument you passed to cpcYearToNCDF unless you have moved the files.

tidy

if TRUE, returns the data as a tidy data.table. If FALSE, returns a 3D array indexed by [lon, lat, time].

round_lonlat

if TRUE, the longitude and latitude limits you enter will be rounded to the nearest valid values. If FALSE, if the values you enter are not in the data set, this function will throw an error.

Value

returns either a data.table with columns date, lon, lat, and prcp_mm or a three-dimensional array indexed [lon, lat, time]. This choice is controlled by the tidy argument.


jdossgollin/cpcRain documentation built on May 18, 2019, 11:33 p.m.