nrelCsvExt icon

nrelCsvExt

Import and export functions for CSV data
nrelCsvExtAxon funcs

Registered StackHub users may elect to receive email notifications whenever a new package version is released.

There are 0 watchers.

v1.0.1

csvExportHistory
csvExportHistory(points, span, handle, opts: {})

For the specified points and time span, read and export a history grid a CSV files at handle, optionally with some convenience processing. See the CSV extension docs for implementation details, a list of options passed via opts and their effects.

csvImportEquips
csvImportEquips(handle, spec: null, opts: {})

Imports equip records from CSV data provided by handle, parsing them according to the provided column spec (specification) and options opts. The user-provided spec, if any, is merged with a default column specification for importing equips. Returns a grid of dicts ready to commit as Folio records. If option commit is enabled, also commits the records to the Folio.

csvImportHistory
csvImportHistory(points, handle, opts: {})

Imports point history for specified points from CSV data provided by handle and writes imported data to the database. See the CSV extension docs for implementation details, including required tags and a list of options passed via opts.

csvImportPoints
csvImportPoints(handle, spec: null, opts: {})

Imports point records from CSV data provided by handle, parsing them according to the provided column spec (specification) and options opts. The user-provided spec, if any, is merged with a default column specification for importing points. Returns a grid of dicts ready to commit as Folio records. If option commit is enabled, also commits the records to the Folio.

csvImportRecs
csvImportRecs(handle, spec, opts: {})

Imports records from CSV data at handle, parsing them according to the provided column spec (specification) and options opts. Returns a grid of dicts ready to commit as Folio records. If option commit is enabled, also commits the records to the Folio.

See the extension docs for a full description of spec and opts and their effects.

csvImportSites
csvImportSites(handle, spec: null, opts: {})

Imports site records from CSV data provided by handle, parsing them according to the provided column spec (specification) and options opts. The user-provided spec, if any, is merged with a default column specification for importing sites. Returns a grid of dicts ready to commit as Folio records. If option commit is enabled, also commits the records to the Folio.

csvImportSpaces
csvImportSpaces(handle, spec: null, opts: {})

Imports space records from CSV data provided by handle, parsing them according to the provided column spec (specification) and options opts. The user-provided spec, if any, is merged with a default column specification for importing spaces. Returns a grid of dicts ready to commit as Folio records. If option commit is enabled, also commits the records to the Folio.

csvImportWeatherStations
csvImportWeatherStations(handle, spec: null, opts: {})

Imports weather station records from CSV data provided by handle, parsing them according to the provided column spec (specification) and options opts. The user-provided spec, if any, is merged with a default column specification for importing weather stations. Returns a grid of dicts ready to commit as Folio records. If option commit is enabled, also commits the records to the Folio.

delimConvert
delimConvert(s, old, new: ",")

In a string, convert instances of one delimiter to another. Converts instances of delimiter character old in string s to new (default ","), under the following rules:

  • If old equals new, s is returned unmodified
  • Delimiters inside quoted strings are ignored
  • Escaped delimiters (instances of old prefixed by \) are not converted, but the escape character \ is stripped from the output
  • All other instances of old are changed to new
  • All other escaped characters are passed through as-is
  • Consecutive whitespace delimiters are combined

If old is whitespace, then any whitespace character matches: space, \t, \n, \r, \f.

Examples

"a b   c\td".delimConvert(" ")                  >> a,b,c,d
"name:\"First Last\" age:34".delimConvert(" ")  >> name:"First Last",age:34
"a;\"b;c\";c".delimConvert(";")                 >> a,"b;c",c
r",\,,\".delimConvert(",","|")                  >> |,|\

Enclosing quotes are omitted from example outputs.

Published by NREL

Packages by NREL

Free packages