Wave:API: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{wave_nav}} The Wave API provides a few methods for reading time series from files, manipulating and displaying them. To access the API, include a reference to Wave.exe in...") |
mNo edit summary |
||
Line 3: | Line 3: | ||
The Wave API provides a few methods for reading time series from files, manipulating and displaying them. | The Wave API provides a few methods for reading time series from files, manipulating and displaying them. | ||
To access the API, include a reference to Wave.exe in your .NET project. | To access the API, include a reference to Wave.exe (or to the Wave project if you have the source code) in your .NET project. | ||
Below are some examples. | Below are some examples. |
Revision as of 06:50, 3 December 2017
Wave | Download | Development
The Wave API provides a few methods for reading time series from files, manipulating and displaying them.
To access the API, include a reference to Wave.exe (or to the Wave project if you have the source code) in your .NET project.
Below are some examples.
Example1
'Load a time series file and display it in Wave Dim Wave1 As New BlueM.Wave.Wave() Wave1.Import_File("path\to\file") 'depending on the file format, this may display an import dialog Wave1.Show()
Example2
'More complex example showcasing some more advanced techniques Dim Wave1 As New BlueM.Wave.Wave() Dim myFile As BlueM.Wave.FileFormatBase Dim ts as BlueM.Wave.TimeSeries 'read a file myFile = BlueM.Wave.FileFactory.getDateiInstanz("path\to\file") 'check the available time series For Each c As BlueM.Wave.FileFormatBase.ColumnInfo In myFile.Columns Console.WriteLine(c.Name) Next 'select all columns (series) for import myFile.selectAllColumns() 'read the selected time series from the file myFile.read_File() 'loop over all series and print some information about them For Each ts in myFile.TimeSeries Console.WriteLine("Series title: " & ts.Title) Console.WriteLine("Extent: " & ts.StartDate & " - " & ts.EndDate) Console.WriteLine("Max value: " & ts.Maximum) Console.WriteLine("Min value: " & ts.Minimum) Next 'get one particular time series ts = myFile.getTimeSeries("SeriesTitle") 'cut the time series ts.Cut(New DateTime(2000, 01, 01), New DateTime(2010, 1, 1)) 'loop over the nodes of the time series Dim d As DateTime Dim v As Double For Each node As KeyValuePair(Of DateTime, Double) In ts.Nodes d = node.Key v = node.Value Next 'Display the series in Wave Wave1.Import_Series(ts) Wave1.Show()
Example3
'Create your own time series and display it in Wave Dim Wave1 As New BlueM.Wave.Wave() 'create a new time series Dim ts As New BlueM.Wave.TimeSeries("my series") 'add some nodes to the time series ts.AddNode(New DateTime(2000, 1, 1), 10.) ts.AddNode(New DateTime(2000, 1, 2), 20.) ts.AddNode(New DateTime(2000, 1, 3), 30.) ts.AddNode(New DateTime(2000, 1, 4), 15.) 'display the series in Wave Wave1.Import_Series(ts) Wave1.Show()