Skip to contents

This is a provisional function, written to handle a particular file created in Spring of 2023 by MUN researchers, as part of an OTN project. Please consult the “Slocum Gliders” vignette for more information about this file.

Usage

read.glider.slocum.netcdf(
  file,
  readAll = FALSE,
  nameMap = list(salinity = "glider_record/sci_rbrctd_salinity_00", SA =
    "absolute_salinity", temperature = "glider_record/sci_rbrctd_temperature_00", CT =
    "conservative_temperature", pressure = "glider_record/sci_rbrctd_seapressure_00",
    time = "glider_record/sci_rbrctd_timestamp", conductivity =
    "glider_record/sci_rbrctd_conductivity_00", latitude = "glider_record/m_gps_lat",
    longitude = "glider_record/m_gps_lon", profileLat = "profile_lat", profileLon =
    "profile_lon", density = "density", oxygen = "oxygen_concentration", 
     u = "u", v
    = "v", vxi = "glider_record/m_initial_water_vx", vyi =
    "glider_record/m_initial_water_vy", vy = "glider_record/m_water_vy", vx =
    "glider_record/m_water_vx", id = "profile_id"),
  debug = 0
)

Arguments

file

Name of a netcdf file.

readAll

logical value indicating whether to read all the data columns in the file. The default, FALSE, means to only read columns that appear in nameMap. Using FALSE can yield significant decreases in processing time and memory usage. For the 2 Gb test file used during the coding of this function (which, admittedly, seems to have a great deal of duplication or near-duplication of data), setting readAll to FALSE drops the reading time from 12 s to 1.5s, and the size of the resultant value from 2.0Gb to 0.28 Gb.

nameMap

either a character value or a list. In the first case, the only permitted possibility is nameMap="?", which instructs read.glider.slocum.netcdf() to return a vector of variable names as determined by scanning the file. Examining this list can be a useful first step in the exploration of data file. Once the variables are known, it makes sense to use the list form of nameMap, perhaps starting with the default value.

debug

an integer controlling how much information is printed during processing. If this is 0, then only errors and warnings will be printed. If it is 1, then the function entry and exit are signalled, and a line is printed for each variable read.

Value

A glider object, i.e. one inheriting from glider. (This class inherits from oce::oce in the oce package.)

Details

Since different files might use different naming conventions for data, it is helpful to establish a mapping between names in the file and the names that are to be stored in the return object. This is what the nameMap argument is for. The file may contain information that will guide the user as to which of various possibilities to use, although reference to other documents, on consultation with the data provider may be required. Again, see the “Slocum Gliders” vignette for more on this topic.

See also

Author

Dan Kelley, aided by Cameron Richardson on data names.