sidfex.fcst.search.createIndex: Create or update SIDFEx forecast index

View source: R/sidfex.fcst.search.createIndex.R

sidfex.fcst.search.createIndexR Documentation

Create or update SIDFEx forecast index

Description

Loop through the downloaded SIDFEx forecasts and add some predefined key quantities and information to the (previously existing or not) index file "indexTable.rda". If the specified index file does not exist, a new one is created. The data will be stored in .rda-format.

Usage

  sidfex.fcst.search.createIndex(indexTable.path = NULL, data.path = NULL, do.fromScratch = FALSE, do.checktime = TRUE, do.saveAddCSV = TRUE, do.print.less = TRUE, checkfileformat = TRUE, do.manipulate = TRUE, add.LatLon=TRUE, not.save.but.return.index=FALSE)

Arguments

indexTable.path

NULL or a character specifying the directory where to find or create the index file. If NULL, it is attempted to source a file named .SIDFEx in the home directory where a character variable data.path.indexTable.in needs to be defined.

data.path

NULL or a character specifying the directory where to find the forecast data locally. If NULL, it is attempted to source a file named .SIDFEx in the home directory where a character variable data.path.fcst needs to be defined.

do.fromScratch

a boolen value, default FALSE. If set to FALSE, an existing index file will be extended by all files that have not been added before (and, optionally, by all files with changed submission time). If set to TRUE, the existing index file will be removed and a new one is created from scratch.

do.checktime

a boolen value, default TRUE. Used only if do.fromScratch is FALSE. If do.checktime is TRUE, the first lines of the forecast file headers are read to check whether the submission time has changed; only if that's the case the corresponding row in the index table is updated. If do.checktime (and do.fromScratch is FALSE), previously existing entries will NOT be updated, which saves some time.

do.saveAddCSV

a boolean value, default TRUE. If so, a CSV version of the data frame will be stored in addition to the .rda-file in the same directory.

do.print.less

a logical value specifying whether or not to print a statement for every dataset while adding it to the index file (to keep console output down). Will be also passed on to sidfex.fcst.search.addTableItem.

checkfileformat

a logical value specifying whether or not to check if the file format complies with the SIDFEx conventions, using sidfex.checkfileformat.

do.manipulate

a logical value specifying whether or not to manipulate the automatically derived ensemble information, using sidfex.fcst.search.manipulateIndex (an undocumented function); required for lagged-initial-time ensembles.

add.LatLon

a logical value specifying whether or not to add latitude and longitude information (initial, first and last timesteps) to the index. Default is TRUE.

not.save.but.return.index

a logical value specifying whether to return the index instead of saving as an R data file (and possibly also as CSV). Default is FALSE.

Value

This function returns 1 if it ran successfully, except if not.save.but.return.index=FALSE in which case the new index is returned.

Note

The optionally produced CSV file is mainly generated for users not familiar with R. As it is only a copy of the .rda file and won't be altered or affected by changes in the .rda file in general, it is recommended to work with the .rda file whenever possible.

Author(s)

Simon Reifenberg, update by Helge Goessling

See Also

sidfex.fcst.search.extractFromTable, sidfex.fcst.search.rda2csv


helgegoessling/SIDFEx documentation built on March 15, 2024, 2:26 p.m.