nc_coord_var: Get Coordinate Variables for Given Variable

View source: R/nc_coord.R

nc_coord_varR Documentation

Get Coordinate Variables for Given Variable

Description

In NetCDF, variables are defined along dimensions and are said to have "coordinate variables" that define the (typically spatio-temporal) positions of the data's cells.

Usage

nc_coord_var(x, variable = NULL, ...)

## S3 method for class 'character'
nc_coord_var(x, variable = NULL, ...)

## S3 method for class 'NetCDF'
nc_coord_var(x, variable = NULL, ...)

Arguments

x

NetCDF source

variable

variable name of interest. If not included, all variables will be returned.

...

ignored

Details

This function attempts to identify the X, Y, Z, and T coordinate variables for each data variable in the provided NetCDF source. The NetCDF-CF attribute conventions are used to make this determination.

All variables that can be related to a spatio-temporal axis, including coordinate variables are returned. For coordinate variables, a "bounds" column is included in the response indicating which variable contains bounds information.

See http://cfconventions.org/cf-conventions/v1.6.0/cf-conventions.html#coordinate-system for more.

Value

tibble with "variable", "X", "Y", "Z", "T", and "bounds" columns that reference variables by name.

Examples

f <- system.file("extdata", "S2008001.L3m_DAY_CHL_chlor_a_9km.nc", package = "ncmeta")
nc_coord_var(f, "chlor_a")

f <- system.file("extdata", "guam.nc", package = "ncmeta")
nc_coord_var(f)

ncmeta documentation built on June 22, 2024, 7:36 p.m.