load_nc_file: Load a single .nc file

Description Usage Arguments Value Examples

View source: R/loading-data-functions.R

Description

This function loads a single .nc files and returns a dplyr dataframe of the extracted variables.

Usage

1
2
3
load_nc_file(file_path, variables = c("CHL1_mean"), coordinates = c("lon",
  "lat"), spare_coordinates = c("longitude", "latitude"),
  date_format = "ymd", date_match_position = 1)

Arguments

file_path

the path of the file to load. Character.

variables

variables to be retrieved from the file. A character vector of length n.

coordinates

longitude and latitude

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.

date_format

the format of the dates for each file.

date_match_position

An integer. If the name of each file contains one or more dates, chose which one will be used as the current date for the file. Example: if a file is named "20150202file2_20150706.nc", if date_match_position is set to 1 (default), the first date, 20150202 will be used. If you'd like to use the second one, set the parameter to 2.

Value

A dplyr dataframe

Examples

1
2
# Load "data02022015.nc"
# data_02022015 <- load_nc_file("~path/data02022015.nc", date_format = "dmy")

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