df_to_ncdf: Data frame to netCDF (.nc) file

View source: R/df_to_netcdf.R

df_to_ncdfR Documentation

Data frame to netCDF (.nc) file

Description

Write 2D and/or 3D data from a data frame to a netCDF version-4 file using the RNetCDF package.

Usage

df_to_ncdf(
  x,
  output_filename,
  dim_names_2d,
  dim_long_names_2d = NULL,
  dim_units_2d,
  var_names_2d,
  var_long_names_2d = NULL,
  var_units_2d,
  var_flag_values_2d = NULL,
  var_flag_meanings_2d = NULL,
  dim_names_3d = NULL,
  dim_long_names_3d = NULL,
  dim_positive_3d = NULL,
  dim_units_3d = NULL,
  dim_sort_3d = TRUE,
  var_names_3d = NULL,
  var_long_names_3d = NULL,
  var_units_3d = NULL,
  var_flag_values_3d = NULL,
  var_flag_meanings_3d = NULL,
  instrument_attributes = NULL,
  instrument_values = NULL,
  global_attributes
)

Arguments

x

A data frame containing data and metadata to add to write to a netCDF file.

output_filename

Name of the output file name as a character vector.

dim_names_2d

A vector of names of 2D spatial and time dimensions (e.g., LATITUDE, LONGITUDE, DATETIME).

dim_long_names_2d

A vector of long_names for spatial and time dimensions.

dim_units_2d

A vector of unit quantities for 2D dimensions.

var_names_2d

A vector of variable names that for 2D variables (e.g., VESSEL, CRUISE, HAUL, CAST, STATIONID).

var_long_names_2d

A vector of long_names for the 2D variable.

var_units_2d

A vector of unit quantities for the 2D variables.

var_flag_values_2d

Optional. A list of containing vectors of flag values for 2D flag variables where list item names correspond with variables in var_names_2d.

var_flag_meanings_2d

Optional. A list of containing vectors of flag_meaning definitions for 2D flag variables where list item names correspond with variables in var_names_2d.

dim_names_3d

A vector of names of 3D dimension (e.g., depth).

dim_long_names_3d

A Vector of long_names of 3D dimension (e.g., "Depth in meters (positive down)").

dim_positive_3d

A named list indicating which direction is down for 3D variable, i.e., list("depth" = "down")

dim_units_3d

A vector of unit quantities for 3D dimensions.

dim_sort_3d

Logical vector indicating whether 3D variable should be sorted prior to including in output.

var_names_3d

A vector of variable names for 3D variables (e.g., TEMPERATURE, SALINITY).

var_long_names_3d

A vector of long_names for the 3D variable.

var_units_3d

A vector of unit quantities for the 3D variables (e.g., 'degrees Celsius', 'Practical Salinity').

var_flag_values_3d

Optional. A list of containing vectors of flag values for 3D flag variables where list item names correspond with variables in var_names_3d.

var_flag_meanings_3d

Optional. A list of containing vectors of flag_meaning definitions for 3D flag variables where list item names correspond with variables in var_names_3d.

instrument_attributes

Optional. A vector of attribute names for the instrument variable.

instrument_values

Optional. A list of attribute values for the instrument variable.

global_attributes

A list of global attributes (i.e., non-dimensional) as 1L character, numeric, or date vectors, where names of list objects are the names of attributes.

Author(s)

Sean Rohan


afsc-gap-products/gapctd documentation built on March 5, 2025, 3:42 a.m.