NetCDF: Information about a NetCDF file, in convenient form.

Description Usage Arguments Details Value See Also Examples

View source: R/NetCDF.r

Description

NetCDF scans all the metadata provided by the ncdf4::nc_open function, and organizes it by the entities in the file.

Usage

1
NetCDF(x)

Arguments

x

path to NetCDF file

Details

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.

Value

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.

See Also

ncdf4::nc_open which is what this function uses to obtain the information

Examples

1
2
rnc <- NetCDF(system.file("extdata", "S2008001.L3m_DAY_CHL_chlor_a_9km.nc", package= "ncdump"))
rnc

Example output

$dimension
# A tibble: 4 x 7
  name            len unlim group_index group_id    id create_dimvar
  <chr>         <int> <lgl>       <int>    <int> <int> <lgl>        
1 lat            2160 FALSE           1    65536     0 TRUE         
2 lon            4320 FALSE           1    65536     1 TRUE         
3 rgb               3 FALSE           1    65536     2 FALSE        
4 eightbitcolor   256 FALSE           1    65536     3 FALSE        

$unlimdims
NULL

$dimvals
# A tibble: 6,739 x 2
      id  vals
   <int> <dbl>
 1     0  90.0
 2     0  89.9
 3     0  89.8
 4     0  89.7
 5     0  89.6
 6     0  89.5
 7     0  89.5
 8     0  89.4
 9     0  89.3
10     0  89.2
# ... with 6,729 more rows

$groups
# A tibble: 3 x 6
     id name               ndims nvars natts fqgn                               
  <int> <chr>              <int> <int> <int> <chr>                              
1 65536 ""                     4     4    65 ""                                 
2 65537 processing_control     0     0     4 processing_control                 
3 65538 input_parameters       0     0    21 processing_control/input_parameters

$file
# A tibble: 1 x 10
  filename    writable    id safemode format is_GMT ndims natts unlimdimid nvars
  <chr>       <lgl>    <int> <lgl>    <chr>  <lgl>  <dbl> <dbl>      <dbl> <dbl>
1 /usr/local~ FALSE    65536 FALSE    NC_FO~ FALSE      4    90         -1     2

$variable
# A tibble: 2 x 18
  name  ndims natts prec  units longname group_index storage shuffle compression
  <chr> <int> <int> <chr> <chr> <chr>          <int>   <int>   <int>       <int>
1 chlo~     2    12 float mg m~ Chlorop~           1       2       0           4
2 pale~     2     0 unsi~ ""    palette            1       1       0          NA
# ... with 8 more variables: unlim <lgl>, make_missing_value <lgl>,
#   missval <dbl>, hasAddOffset <lgl>, addOffset <dbl>, hasScaleFact <lgl>,
#   scaleFact <dbl>, id <dbl>

$vardim
# A tibble: 4 x 2
     id dimids
  <dbl>  <int>
1     0      1
2     0      0
3     3      3
4     3      2

$attribute
[1] "NetCDF attributes:"
[1] "Global"
[1] "\n"
# A tibble: 1 x 65
  product_name instrument title project platform temporal_range processing_vers~
  <chr>        <chr>      <chr> <chr>   <chr>    <chr>          <chr>           
1 S2008001.L3~ SeaWiFS    SeaW~ Ocean ~ Orbview~ day            2014.0          
# ... with 58 more variables: date_created <chr>, history <chr>,
#   l2_flag_names <chr>, time_coverage_start <chr>, time_coverage_end <chr>,
#   start_orbit_number <int>, end_orbit_number <int>, map_projection <chr>,
#   latitude_units <chr>, longitude_units <chr>, northernmost_latitude <dbl>,
#   southernmost_latitude <dbl>, westernmost_longitude <dbl>,
#   easternmost_longitude <dbl>, geospatial_lat_max <dbl>,
#   geospatial_lat_min <dbl>, geospatial_lon_max <dbl>,
#   geospatial_lon_min <dbl>, grid_mapping_name <chr>, latitude_step <dbl>,
#   longitude_step <dbl>, sw_point_latitude <dbl>, sw_point_longitude <dbl>,
#   geospatial_lon_resolution <dbl>, geospatial_lat_resolution <dbl>,
#   geospatial_lat_units <chr>, geospatial_lon_units <chr>,
#   spatialResolution <chr>, data_bins <int>, number_of_lines <int>,
#   number_of_columns <int>, measure <chr>, data_minimum <dbl>,
#   data_maximum <dbl>, suggested_image_scaling_minimum <dbl>,
#   suggested_image_scaling_maximum <dbl>, suggested_image_scaling_type <chr>,
#   suggested_image_scaling_applied <chr>, `_lastModified` <chr>,
#   Conventions <chr>, institution <chr>, standard_name_vocabulary <chr>,
#   Metadata_Conventions <chr>, naming_authority <chr>, id <chr>,
#   license <chr>, creator_name <chr>, publisher_name <chr>,
#   creator_email <chr>, publisher_email <chr>, creator_url <chr>,
#   publisher_url <chr>, processing_level <chr>, cdm_data_type <chr>,
#   identifier_product_doi_authority <chr>, identifier_product_doi <chr>,
#   keywords <chr>, keywords_vocabulary <chr>
[1] "\n"
[1] "Variable attributes:"
character(0)

attr(,"class")
[1] "NetCDF" "list"  

ncdump documentation built on May 2, 2019, 4:05 a.m.