Skip to contents

This prints an overview of the variables in a NetCDF file, along with time, longitude and latitude, if the last three are stored as dimensions.

Usage

netcdfTOC(file, level = 1L, debug = getOption("oceDebug"))

Arguments

file

character value naming a NetCDF file.

level

integer indicating the level of the overview. If level is 1, which is the default, then a list holding the names of variables and dimensions is printed (and returned, silently). If level is 2, then more information is printed.

debug

an integer specifying whether debugging information is to be printed during the processing. This is a general parameter that is used by many oce functions. Generally, setting debug=0 turns off the printing, while higher values suggest that more information be printed. If one function calls another, it usually reduces the value of debug first, so that a user can often obtain deeper debugging by specifying higher debug values.

Value

If level is 1, then the printed list of variables and dimensions is returned (silently). Otherwise, much more is printed, but the return value is as for the first case.

Details

An alternative to this is to examine what is printed by running ncdf4::nc_open() with the given filename, but this output can be a bit confusing to read, especially for files that have voluminous global attributes.

Author

Dan Kelley

Examples

library(oce)
# Saving to a temporary file for CRAN testing; in practice,
# it's more likely that the user will retain this file, or already
# have a target file on the local system.
if (requireNamespace("ncdf4") &&
    requireNamespace("jsonlite") &&
    requireNamespace("curl")) {
    urlroot <- "ftp://ftp.ifremer.fr/ifremer/argo/dac/bodc/6900388/profiles/"
    remotefile <- "D6900388_001.nc"
    localfile <- tempfile(fileext = ".nc")
    curl::curl_download(paste0(urlroot, remotefile), localfile)
    netcdfTOC(localfile)
    unlink(localfile)
}
#> Loading required namespace: ncdf4
#> $variables
#>  [1] "DATA_TYPE"                    "FORMAT_VERSION"              
#>  [3] "HANDBOOK_VERSION"             "REFERENCE_DATE_TIME"         
#>  [5] "DATE_CREATION"                "DATE_UPDATE"                 
#>  [7] "PLATFORM_NUMBER"              "PROJECT_NAME"                
#>  [9] "PI_NAME"                      "STATION_PARAMETERS"          
#> [11] "CYCLE_NUMBER"                 "DIRECTION"                   
#> [13] "DATA_CENTRE"                  "DC_REFERENCE"                
#> [15] "DATA_STATE_INDICATOR"         "DATA_MODE"                   
#> [17] "INST_REFERENCE"               "WMO_INST_TYPE"               
#> [19] "JULD"                         "JULD_QC"                     
#> [21] "JULD_LOCATION"                "LATITUDE"                    
#> [23] "LONGITUDE"                    "POSITION_QC"                 
#> [25] "POSITIONING_SYSTEM"           "PROFILE_PRES_QC"             
#> [27] "PRES"                         "PRES_QC"                     
#> [29] "PRES_ADJUSTED"                "PRES_ADJUSTED_QC"            
#> [31] "PRES_ADJUSTED_ERROR"          "PROFILE_PSAL_QC"             
#> [33] "PSAL"                         "PSAL_QC"                     
#> [35] "PSAL_ADJUSTED"                "PSAL_ADJUSTED_QC"            
#> [37] "PSAL_ADJUSTED_ERROR"          "PROFILE_TEMP_QC"             
#> [39] "TEMP"                         "TEMP_QC"                     
#> [41] "TEMP_ADJUSTED"                "TEMP_ADJUSTED_QC"            
#> [43] "TEMP_ADJUSTED_ERROR"          "PARAMETER"                   
#> [45] "SCIENTIFIC_CALIB_EQUATION"    "SCIENTIFIC_CALIB_COEFFICIENT"
#> [47] "SCIENTIFIC_CALIB_COMMENT"     "CALIBRATION_DATE"            
#> [49] "HISTORY_INSTITUTION"          "HISTORY_STEP"                
#> [51] "HISTORY_SOFTWARE"             "HISTORY_SOFTWARE_RELEASE"    
#> [53] "HISTORY_REFERENCE"            "HISTORY_DATE"                
#> [55] "HISTORY_ACTION"               "HISTORY_PARAMETER"           
#> [57] "HISTORY_START_PRES"           "HISTORY_STOP_PRES"           
#> [59] "HISTORY_PREVIOUS_VALUE"       "HISTORY_QCTEST"              
#> 
#> $dimensions
#>  [1] "DATE_TIME" "STRING256" "STRING64"  "STRING32"  "STRING16"  "STRING8"  
#>  [7] "STRING4"   "STRING2"   "N_PROF"    "N_PARAM"   "N_LEVELS"  "N_CALIB"  
#> [13] "N_HISTORY"
#>