Table of Contents

Class TimeSeriesFile

Namespace
BlueM.Wave
Assembly
Wave.dll

Abstract base class for all file formats

public abstract class TimeSeriesFile
Inheritance
TimeSeriesFile
Derived
Inherited Members

Constructors

TimeSeriesFile(string, bool)

Constructor

public TimeSeriesFile(string FileName, bool ReadAllNow = false)

Parameters

FileName string

Path to the file to be imported

ReadAllNow bool

If True, select all series and read the file immediately

Fields

TimeSeries

Stores the TimeSeries read from the file. The key corresponds to the column index stored as Index in TimeSeriesInfos.

public Dictionary<int, TimeSeries> TimeSeries

Field Value

Dictionary<int, TimeSeries>

Properties

ColumnOffset

Number of characters before the first column (only relevant for fixed width columns)

public int ColumnOffset { get; set; }

Property Value

int

ColumnWidth

Column width (default is 16)

public int ColumnWidth { get; set; }

Property Value

int

Remarks

only relevant for fixed width files

DateTimeColumnIndex

Index of the column containing the datetime values

public int DateTimeColumnIndex { get; set; }

Property Value

int

Dateformat

Date format (default is Helpers.CurrentDateFormat)

public string Dateformat { get; set; }

Property Value

string

DecimalSeparator

Decimal separator (default is period)

public Character DecimalSeparator { get; set; }

Property Value

Character

Encoding

Encoding to use for reading the file

public Encoding Encoding { get; set; }

Property Value

Encoding

Remarks

Defaults to the system default (usually ISO-8859-1)

File

Path to file

public string File { get; set; }

Property Value

string

FileMetadata

File metadata

public Metadata FileMetadata { get; }

Property Value

Metadata

IsColumnSeparated

Indicates whether the file contains columns separated by a character (True, default) or is fixed width (False)

public bool IsColumnSeparated { get; set; }

Property Value

bool

MetadataKeys

Returns a list of format-specific metadata keys

public static List<string> MetadataKeys { get; }

Property Value

List<string>

Remarks

Is an empty list by default, should be overridden by inheriting classes

SelectedSeries

List of TimeSeriesInfo of series currently selected for import

public List<TimeSeriesInfo> SelectedSeries { get; }

Property Value

List<TimeSeriesInfo>

Separator

Separator (default is semicolon)

public Character Separator { get; set; }

Property Value

Character

TimeSeriesInfos

List of TimeSeriesInfo of all series contained in a file

public List<TimeSeriesInfo> TimeSeriesInfos { get; set; }

Property Value

List<TimeSeriesInfo>

UseImportDialog

Indicates whether the ImportDialog should be shown when importing this file format

public abstract bool UseImportDialog { get; }

Property Value

bool

True if the ImportDialog should be shown when importing this file format

UseUnits

Read units from the file? (default is True)

public bool UseUnits { get; set; }

Property Value

bool

getTimeSeries[int]

Get a timeseries from the file using its index

public TimeSeries getTimeSeries[int index = 0] { get; }

Parameters

index int

Index of the desired timeseries within the file

Property Value

TimeSeries

The timeseries

Remarks

If the timeseries has not been imported yet, an import is initiated. Throws an exception if the timeseries cannot be found in the file.

getTimeSeries[string]

Get a timeseries from the file using its title

public TimeSeries getTimeSeries[string title] { get; }

Parameters

title string

Title of the desired timeseries.

Property Value

TimeSeries

The timeseries

Remarks

If the timeseries has not been imported yet, an import is initiated. Throws an exception if the timeseries cannot be found in the file.

iLineData

Number of the first line containing data

public int iLineData { get; set; }

Property Value

int

iLineHeadings

Number of the line containing column headings

public int iLineHeadings { get; set; }

Property Value

int

iLineUnits

Number of the line containing units

public int iLineUnits { get; set; }

Property Value

int

nLinesHeader

Number of header lines

public int nLinesHeader { get; }

Property Value

int

iLineData - 1

Methods

SupportsMultipleSeries(FileTypes)

Returns whether a file type supports multiple series in one file

public static bool SupportsMultipleSeries(TimeSeriesFile.FileTypes type)

Parameters

type TimeSeriesFile.FileTypes

The file type

Returns

bool

True if the file type supports multiple series

getFileExtension(FileTypes)

Returns the default file extension for a file type

public static string getFileExtension(TimeSeriesFile.FileTypes type)

Parameters

type TimeSeriesFile.FileTypes

The file type

Returns

string

The file extension as a string (including the leading ".")

getFileType(string)

Determines the file type of a file based on the file's extension and contents

public static TimeSeriesFile.FileTypes getFileType(string file)

Parameters

file string

Path to the file

Returns

TimeSeriesFile.FileTypes

the determined file type

Remarks

Also checks whether the file exists and if the file format is as expected. If the file is a WEL file, this function also checks whether the file is contained within a WLZIP of the same name and if it is, extracts it.

getInstance(string, FileTypes)

Factory method for creating a TimeSeriesFile instance based on the file type

public static TimeSeriesFile getInstance(string file, TimeSeriesFile.FileTypes fileType = FileTypes.UNDETERMINED)

Parameters

file string

Path to the file

fileType TimeSeriesFile.FileTypes

Optional file type. If not provided, the type is determined using getFileType()

Returns

TimeSeriesFile

A TimeSeriesFile instance representing the file

get_getTimeSeries(int)

public TimeSeries get_getTimeSeries(int index = 0)

Parameters

index int

Returns

TimeSeries

get_getTimeSeries(string)

public TimeSeries get_getTimeSeries(string title)

Parameters

title string

Returns

TimeSeries

readFile()

Reads the selected series (see SelectedSeries) from the file and stores them as timeseries in TimeSeries

public abstract void readFile()

readSeriesInfo()

Reads information about the series contained in the file and stores it in TimeSeriesInfos

public abstract void readSeriesInfo()

selectAllSeries()

Select all available series for import

public void selectAllSeries()

selectSeries(int)

Select a series for import by index

public bool selectSeries(int index)

Parameters

index int

index

Returns

bool

True if successful, False if index was not found

selectSeries(string)

Select a series for import by name

public bool selectSeries(string seriesName)

Parameters

seriesName string

name of the series

Returns

bool

True if successful, False if series name was not found

setDefaultMetadata(TimeSeries)

Sets default metadata keys and values for a time series corresponding to the file format

public static void setDefaultMetadata(TimeSeries ts)

Parameters

ts TimeSeries

Remarks

Should be overloaded by inheriting classes that deal with metadata