nc_read: Read a netcdf file to a data frame

Description Usage Arguments Examples

View source: R/read.R

Description

This is a quick and easy way to read a netcdf file to a data frame. It will read all or a specified list of variables into a data frame. This requires that grid details are clear in the netcdf file, so in some rare cases there will be an error message.

Usage

1
2
nc_read(ff, vars = NULL, na_rm = FALSE, cdo_output = FALSE,
  dim_check = 1.5e+08)

Arguments

ff

This is the file to read.

vars

A list of variables you want to read in. Character vector. Everything is read in if this is empty.

na_rm

Do you want rows with nas to be removed from output? Default is FALSE

cdo_output

Do you want to show the cdo output? Set to TRUE in case you want to troubleshoot errors.

dim_check

The number of data points in the final data frame that will ask to continue. Set to NULL if you don't want to check.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Reading in data from the NOAA World Ocean Atlas sample file.
ff <- system.file("extdata", "woa18_decav_t01_01.nc", package = "rcdo")
# if we simply want to read the data into a tibble, we just need to use nc_read

nc_read(ff)

# By default nc_read reads in all data fields. But we probably just want to subset it
# If we only want to read in specific fields, we can use vars

nc_read(ff, vars = "t_an")

r4ecology/rcdo documentation built on July 21, 2019, 9 p.m.