Extract metadata from 'NetCDF' data sources, these can be files, file handles or servers. This package leverages and extends the lower level functions of the 'RNetCDF' package providing a consistent set of functions that all return data frames. We introduce named concepts of 'grid', 'axis' and 'source' which are all meaningful entities without formal definition in the 'NetCDF' library < https://www.unidata.ucar.edu/software/netcdf/>. 'RNetCDF' matches the library itself with only the named concepts of 'variables', 'dimensions' and 'attributes'.
ncmeta package provides straightforward NetCDF metadata, with a
set of consistent entity-based functions for extracting metadata from a
file or online source. We aim to fill a gap in between the generality
and power of the NetCDF framework and the availability of easy to use
modern software tools.
There are two main packages for using NetCDF in R,
and ncmeta use both of them, for subtle situations. Both packages are
very close the native API of NetCDF itself, and ncmeta simply provides
an easier high-level interpretation.
NetCDF is both a data model and an API, and provides a very general
framework for expressing data formats. The explicit entities in NetCDF
are variables, dimensions and attributes and ncmeta provides
nc_atts to extract their names,
order and other metadata. There are matching functions
nc_att with an extra identifier argument that extract
specific information about individual an variable, dimension, or
Ncmeta includes functions for implicit entities, these are grids and axes. These don’t exist in the NetCDF specification explicitly, but are meaningful and we think worth making explicit.
A grid is an ordered set of dimensions, and the Unidata site refers informally to this concept as shape. Many NetCDF tools don’t explicitly present these shapes, or grids so we are a little tentative in our definitions.
An axis is an instance of a dimension, the use of that dimension within a particular variable.
Together these entities provide a more developer-friendly scheme for working with the range of formats provided by the NetCDF ecosystem.
Install ncmeta from CRAN with:
You can install the development version of ncmeta from github with:
This example shows some of the functions for extracting information from a NetCDF source.
library(ncmeta)filename <- system.file("extdata", "S2008001.L3m_DAY_CHL_chlor_a_9km.nc", package = "ncmeta")nc_inq(filename) # one-row summary of filenc_dim(filename, 0) ## first dimensionnc_dims(filename) ## all dimensions
Please let us know if you have any feedback, see the Issues tab if you found a bug or have a question. Feel free to email the maintainer directly for other questions.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
nc_grids() now normal form, with nested variables so we can easily link grids to variables.
nc_coord_var to find coordinate variables (if any),
gm_to_prj to determine PROJ string in use, and
determine grid mapping parameters; #19, #14, #12, #9.
Fix for grid organization providing variables out of native order.
Added 'variable' argument to 'nc_atts', per #8.
system.file()where the file does not exist)
*updates from CRAN feedback
ncmeta now provides support for dimensions that do not have explicit coordinates: dimension and variable tables now have information about "dimvals", in the form of "dim_coord" and "coord_dim" i.e. if a variable is 1D and its name corresponds to a dimension name, then it is a rectlinear coordinate vector of that dimension. (The coordinates can be of type "char", and that must be dealt with down stream as it now is in tidync).
new function nc_grids, the spaces available to variables
new function nc_axes, nc_axis for the instances of dimensions
nc_vars now returns only variables
First working version.