load_nc_with_time: Load .nc files that contain a time variable.

Description Usage Arguments Details Value

View source: R/load-data-with-time-variable.R

Description

Load all .nc files as a list in a given local path and resize them while loading.

Usage

1
2
3
4
load_nc_with_time(path, from = NULL, to = NULL, variables = c("qnet"),
  coordinates = c("lon", "lat"), spare_coordinates = c("longitude",
  "latitude"), time_variable = "time", lower_left_lat_lon = c(52, -65),
  upper_right_lat_lon = c(67, -42), monthly = FALSE, date_origin = NULL)

Arguments

path

Path where to .nc files are located. Example: /home/data. Character.

from

starting year (included). Either a numeric or a character. Example: 2009.

to

ending year(included). Either a numeric or a character. Example: 2010.

variables

variables to be extracted from .nc file. A character vector. Defaults to c("qnet")

coordinates

longitude and latitude names. Defaults to c("lon", "lat")

spare_coordinates

Spare names for coordinates. Variables such as longitude and latitude may be named differently in every .nc file. In order to account this possibility, you can provide a set of spare names for both coordinates. Set by default to be: c("longitude","latitude").

time_variable

variable representing the frequency of the observations. Character. Defaults to "time".

lower_left_lat_lon

lower left corner latitude and longitude of the selected area. Set by default.

upper_right_lat_lon

upper right corner latitude and longitude of the selected area. Set by default.

monthly

whether data has a monthly or an annual frequency. Boolean. Set equal to TRUE if data has a monthly frequency. Set to FALSE if frequency is annual. FALSE by default.

date_origin

If the dates in the .nc files are the number of hours from a fixed origin, please specify origin date as "yyyy-mm-dd". By default origin date is assumed to be 1st January of each year (the year is read from the file name).

Details

Note: these function is used to load .nc files containing a time variable. They represent observations of a certain variable with a given frequency. The variable "time" defines the name of the sampling frequency variable. The function assumes that the data has a daily frequency. If the frequency is monthly, please set the monthy variable to TRUE.

Due to the size of such files, immediate cropping of the selected geographical area is performed at load time. Note that the size of the area should be specified in the arguments lower_left_lon_lat and upper_right_lon_lat. If these arguments are not specified, defaults will be used.

Dates are assumed to begin from the 1st of January. If the dates are in the format "hours" from a given date", please specify the starting date in the format "yyyy-mm-dd". Please note that no other formats are accepted. See the parameter date_origin below.

Value

a list of dplyr dataframes


pegoraro/qchlorophyll documentation built on May 24, 2019, 11:46 p.m.