nc_vertsum: Calculate vertical sum from a netcdf file.

Description Usage Arguments Value Examples

View source: R/vertsum.R

Description

This function allows you to remap a netcdf horizontally and vertically to a specific latlon box. It outputs a data frame with the sum value and the maximum depth used for the calculation.

Usage

1
2
3
nc_vertsum(ff, vars = NULL, vert_scale = NULL, coords = NULL,
  expr = NULL, na_value = NULL, out_file = NULL, zip_file = FALSE,
  cdo_output = FALSE, overwrite = FALSE, ...)

Arguments

ff

This is the file to analyze.

vars

Select the variables you want to regrid. If this is not given, all variables will be regridded.

vert_scale

This is the vertical scale you want. c(min_depth, max_depth, vertical_resolution).

coords

A 2 column matrix or data frame of the form (longitude, latitude) with coordinates for regridding. This can be regular or irregular. The function will calculate which it is.

expr

This is a cdo expression to apply to the data before a vertical sum is calculated.

na_value

This is a value in the raw netcdf file that needs to be treated as an na.

out_file

The name of the file output. If this is not stated, a data frame will be the output.

zip_file

Do you want any output file to be zipped to save space. Default is FALSE.

cdo_output

set to TRUE if you want to see the cdo output

overwrite

Do you want to overwrite out_file if it exists? Defaults to FALSE

...

Additional terms to be sent to nc_remap2

Value

data frame or netcdf file.

Examples

1
2
3
4
# Calculating vertical mean NOAA world ocean atlas data to the region around the UK
ff <- system.file("extdata", "woa18_decav_t01_01.nc", package = "rcdo")
# calculate vertical mean of temperature between 5 and 30 m, using a resolution of 5 for vertical interpolation
nc_vertmean(ff, vars = "t_an", vert_scale = c(5, 30, 5))

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