read.TSD: Reads a file using the Time Step Data format and outputs as...

View source: R/read.TSD.R

read.TSDR Documentation

Reads a file using the Time Step Data format and outputs as an R-list object where the elements are named according to the four character names provided in the file 'con'. See the documentation on echoIBM for specification of the Time Step Data format (TSD). If reading large files, it can sometimes be faster to read all variables as opposed to some of the variables. Reading all time steps of a certain segmentation file over 21601 time steps dropped from 26.958 sec to 6.864 sec (system.time(aa_new<-read.TSD("~/Data/echoIBM/SX90_biomassEstimation/Events/SX90_biomassEstimation_E0006_one_school_at_the_time_directional_fish_20logR/SX90/tsd/SX90_biomassEstimation_E0006_T00001_sfnr_0001.seg",t="all", header=FALSE, info=FALSE))).

Description

Reads a file using the Time Step Data format and outputs as an R-list object where the elements are named according to the four character names provided in the file 'con'. See the documentation on echoIBM for specification of the Time Step Data format (TSD). If reading large files, it can sometimes be faster to read all variables as opposed to some of the variables. Reading all time steps of a certain segmentation file over 21601 time steps dropped from 26.958 sec to 6.864 sec (system.time(aa_new<-read.TSD("~/Data/echoIBM/SX90_biomassEstimation/Events/SX90_biomassEstimation_E0006_one_school_at_the_time_directional_fish_20logR/SX90/tsd/SX90_biomassEstimation_E0006_T00001_sfnr_0001.seg",t="all", header=FALSE, info=FALSE))).

Usage

read.TSD(
  con,
  t = 1,
  var = "all",
  dimension = TRUE,
  header = FALSE,
  max_var = 1e+10,
  indt = FALSE,
  d000.out = FALSE,
  keep.all = FALSE,
  drop.out = TRUE,
  info = FALSE,
  silent = !getOption("verbose"),
  use.raw = 1000
)

Arguments

con

is the file object or the name of the TSD-file to be read.

t

is a vector of the time steps to read (in the range [1, numt]). If t=="all", all time steps are read, and if t=="none" only the header is returned, (or if header==FALSE list() is returned).

var

is a vector of the variables to read, either given as a character vector holding the names of the variables to read, as specified in the TSD-format, or as the number of the variable in 'labl', if 'labl' is known. If var="all", all variables are read. If none of the elements of 'var' are in [1, nvar], or if var=="none", (or if header==FALSE list() is returned). See below for legal variable names:

dimension

is TRUE to return data with dimension.

header

is TRUE if the number 'nvar', the lengths 'lvar', the labels 'labl', the types 'dtyp' of the variables, and the number 'numt' of time steps are to be returned (at the end of the output list). If the header (list of variables nvar, labl, lvar, dtyp, numt, endian) of the file is known or has already been read, time can be saved by setting header equal to the existing header, in which case the header will not be read.

max_var

is the realistic maximum number of variables, used when separating character strings and floats by the internal function read.TSD_isnvar().

indt

is TRUE if the time points specified in 't' are to be cross referenced to time indexes 'indt' in the data, if present.

d000.out

is TRUE if the dimension data variable 'd000' should be printed (not returned).

keep.all

is TRUE if time steps requested through 't' should be returned as empty list elements in the output. This could prevent collapsing variables with equal dimensions for all valid time steps to be collapsed into arrays, as obtained using dimension=TRUE.

drop.out

is TRUE to drop empty dimensions of arrays and unlist lists of length 1.

info

is TRUE if the variable 'info' returned from info.TSD() should be added to the output (applied in read.TSD()).

silent

is FALSE to print progress bar. If the 'silent' should be set to FALSE in general, use options(verbose=TRUE).

use.raw

is TRUE to read files quicker by reading the information as raw, and converting to the appropriate data types aferwards, which olny applies if the number of time steps exceed 20 and the number of values of the file does not exceed 'use.raw'.


arnejohannesholmin/TSD documentation built on April 14, 2024, 5:29 a.m.