get_vari: Extract variables from NetCDF file

View source: R/get_vari.R

get_variR Documentation

Extract variables from NetCDF file

Description

Extracts a selected parameter from the netCDF file and formats it into a dataframe.

Usage

get_vari(ncdf, var, incl_time = TRUE, print = TRUE)

Arguments

ncdf

filepath; Name of the netCDF file to extract variable

var

character; Name of the variable to be extracted. Must match short name in netCDF file

incl_time

boolean; Add time to the first column in the dataframe. Defaults to TRUE

print

logical; Print the name and units of the variable extracted, defaults to TRUE If coordinates are not in ncdf use print = FALSE

Value

dataframe in the same format as the observation file with the surface in the top column and the bottom in the last column.

Examples

sim_folder <- system.file('extdata', package = 'GOTMr')
run_gotm(sim_folder)
out <- file.path(sim_folder, 'output', 'output.nc')
wtemp <- get_vari(ncdf = out, var = 'temp')
z <- get_vari(ncdf = out, var = 'z')

aemon-j/gotmtools documentation built on April 12, 2024, 4:35 p.m.