Title: | Extract Metadata from 'NetCDF' Files as Data Frames |
---|---|
Description: | Tools for handling 'NetCDF' metadata in data frames. The metadata is provided as relations in tabular form, to avoid having to scan printed header output or to navigate nested lists of raw metadata. |
Authors: | Michael D. Sumner [aut, cre] |
Maintainer: | Michael D. Sumner <[email protected]> |
License: | GPL-3 |
Version: | 0.0.4 |
Built: | 2024-10-21 04:47:22 UTC |
Source: | https://github.com/hypertidy/ncdump |
Provides a useable data structure of NetCDF metadata NetCDF is Network Common Data Form https://www.unidata.ucar.edu/software/netcdf/.
There is one main function, returning an object of class "ncdump":
NetCDF |
produces a list of data frames containing metadata from a NetCDF file |
NetCDF scans all the metadata provided by the ncdf4::nc_open function, and organizes it by the entities in the file.
NetCDF(x)
NetCDF(x)
x |
path to NetCDF file |
Users of 'NetCDF' files might be familiar with the command line tool 'ncdump -h' noting that the "header" argument is crucial for giving a compact summary of the contents of a file. This package aims to provide that information as data, to be used for writing code to otherwise access and manipulate the contents of the files. This function doesn't do anything with the data, and it doesn't access any of the data.
A NetCDF file contains the following entities, and each gets a data frame in the resulting object:
attribute |
'attributes' are general metadata about the file and its variables and dimensions |
dimension |
'dimensions' are the axes defining the space of the data variables |
variable |
'variables' are the actual data, the arrays containing data values |
group |
'groups' are an internal abstraction to behave as a collection, analogous to a file. |
In addition to a data for each of the main entities above 'NetCDF' also creates:
unlimdims |
the unlimited dimensions identify those which are not a constant lenghth (i.e. spread over files) |
dimvals |
a link table between dimensions and its coordinates |
file |
information about the file itself |
vardim |
a link table between variables and their dimensions |
Currently 'file' is expected to and treated as having only one row, but future versions may treat a collection of files as a single entity.
The 'ncdump -h' print summary above is analogous to the print method ncdf4::print.ncdf4 of the output of ncdf4::nc_open. The approach here is under review, probably forever. https://github.com/hypertidy/ncdump/issues/8
A list of data frames with an unused S3 class 'NetCDF', see details for a description of the data frames. The 'attribute' data frame has class 'NetCDF_attributes', this is used with a custom print method to reduce the amount of output printed.
ncdf4::nc_open which is what this function uses to obtain the information
rnc <- NetCDF(system.file("extdata", "S2008001.L3m_DAY_CHL_chlor_a_9km.nc", package= "ncdump"))
rnc <- NetCDF(system.file("extdata", "S2008001.L3m_DAY_CHL_chlor_a_9km.nc", package= "ncdump"))