read_attributes_from_netCDF: Read all attributes of a group from a netCDF

View source: R/functions_netCDF.R

read_attributes_from_netCDFR Documentation

Read all attributes of a group from a netCDF

Description

Read all attributes of a group from a netCDF

Usage

read_attributes_from_netCDF(
  x,
  group = c("var", "xy", "crs", time_name, vertical_name, "global", "all"),
  var = NULL,
  xy_names = c("lon", "lat"),
  time_name = "time",
  vertical_name = "vertical",
  nc_name_crs = "crs"
)

Arguments

x

An object identifying a netCDF file, i.e., a character string as file name or an object of class ncdf4 derived from ncdf4::nc_open.

group

A character string. Specifies which attributes to extract.

var

A character string. The name or names of the variables from which to extract attributes, used if the "var" group is requested.

xy_names

A vector with two character strings. The names of the x and y spatial dimensions of a netCDF file.

time_name

A character string. The dimension name corresponding to the time axis.

vertical_name

A character string. The dimension name corresponding to the vertical axis.

nc_name_crs

A character string. The name of the crs variable in the netCDF. Function create_netCDF hard codes "crs".

Value

A named list

Details

Example code is available in the documentation of read_netCDF.

  • If attributes of a variable are requested (group is "var"), then the variable name must be passed to var.

  • If xy-space attributes are requested (group is "xy"), then the names of the x and y dimension must be passed to xy_names.

  • If crs attributes are requested (group is "crs"), then the name must be passed to nc_name_crs.

  • To obtain all attributes from each group, pass "all" to group; var, xy_names, nc_name_crs must be correctly specified.


DrylandEcology/rSW2st documentation built on Jan. 10, 2024, 6:22 p.m.