Skip navigation links
TubeDB

TubeDB

TubeDB is an on-demand processing database system for climate station data.

See: Description

Packages 
Package Description
tsdb
Root package of TubeDB with central class TsDB.
tsdb.component
Contains components that are independent of TsDB class.
tsdb.component.iterator
Iterators that depend on component.
tsdb.component.labeledproperty  
tsdb.dsl  
tsdb.dsl.computation  
tsdb.dsl.formula  
tsdb.explorer
Contains Explorer as JavaFX desktop application.
tsdb.explorer.metadata
Provides GUI meta data views.
tsdb.graph
Contains functionality to build and process graphs that consisting of nodes.
tsdb.graph.node
Provides interfaces for processing graph nodes.
tsdb.graph.processing
Provides node implementations to build processing graphs.
tsdb.graph.source
Provides time series data source nodes to build processing graphs.
tsdb.iterator
Provides iterators for time series data processing.
tsdb.loader.bale  
tsdb.loader.be
Project specific timeseries data file import.
tsdb.loader.burgwald  
tsdb.loader.ki
Project specific timeseries data file import.
tsdb.loader.ki.type
Project specific timeseries data file import for specific logger types.
tsdb.loader.mm
Generic timeseries data ASC-file import.
tsdb.loader.sa
Project specific timeseries data file import.
tsdb.loader.sa_own
Project specific timeseries data file import.
tsdb.remote
Provides functionality to access TubeDB from remote.
tsdb.run
Provides entry points to start TubeDB.
tsdb.run.command  
tsdb.streamdb
Provides with StreamDB storage for time series.
tsdb.testing
Internal testing.
tsdb.usecase
internal use cases of TubeDB.
tsdb.util
Provides base functionality that is independent of TubeDB.
tsdb.util.gui
Provides image creation functionality for TubeDB GUI.
tsdb.util.iterator
Provides Iterator specializations for time series data.
tsdb.util.processingchain
Provides meta data for time series iterators to visualize the chain of connected iterators that a processing graph produces.
tsdb.util.yaml
Provides functionality for YAML-files.
tsdb.web
Provides HTTP web functions for TubeDB.
tsdb.web.api
Provides HTTP handlers of web API methods.
tsdb.web.generator
Simple generator of HTML pages.
tsdb.web.util
Provides web specific utilities.
TubeDB is an on-demand processing database system for climate station data.

TubeDB consist of several components:

Users of TubeDB typically access TubeDB by web user interface or by web HTTP API.

From within Java TubeDB can be accessed programmatically by the high level interface RemoteTsDB or directly by TsDB instance.

In the following example one time series is processed with RemoteTsDB.
RemoteTsDB connects to an remote instance of TsDB by Java RMI. In the example a direct connection is used.

try(TsDB tsdbInternal = TsDBFactory.createDefault()) { // AutoCloseable instance created by TsDBFactory with default configuration file location
        RemoteTsDB tsdb = new ServerTsDB(tsdbInternal); // create RemoteTsDB interface instance to local TsDB
        String queryType = null;
        String plotID = "HEG01";
        String[] sensorNames = new String[]{"Ta_200", "rH_200"};
        AggregationInterval aggregationInterval = AggregationInterval.MONTH;
        DataQuality dataQuality = DataQuality.EMPIRICAL;
        boolean interpolated = true;
        Long start = TimeUtil.ofDateStartHour(2010);
        Long end = TimeUtil.ofDateEndHour(2015);
        TimestampSeries ts = tsdb.plot(queryType, plotID, sensorNames, aggregationInterval, dataQuality, interpolated, start, end); // query time series
        System.out.println(ts);
        for(GeneralStationInfo info:tsdb.getGeneralStations()) { // query meta data
                System.out.println(info.longName);
        }
}


In the following example one time series is processed (no quality check and no interpolation) with low level methods of TsDB and manual processing graph creation.
More complex processing graphs can be created by nodes in subpackages of tsdb.graph and with helper methods in QueryPlanGenerators and QueryPlan.

try(TsDB tsdb = TsDBFactory.createDefault()) {
        String stationName = "HEG01";
        String[] sensorNames = new String[]{"Ta_200", "rH_200"};
        AggregationInterval aggregationInterval = AggregationInterval.MONTH;
        Long start = TimeUtil.ofDateStartHour(2010);
        Long end = TimeUtil.ofDateEndHour(2015);
        Station station = tsdb.getStation(stationName); // get station
        Node rawNode = StationRawSource.of(tsdb, station, sensorNames); // create raw source node
        StationBase baseNode = StationBase.of(tsdb, rawNode); // create base aggregated (hourly value) node 
        Continuous continuousNode = Continuous.of(baseNode); // fill gaps in time with NA entries
        Aggregated aggregatedNode = Aggregated.of(tsdb, continuousNode, aggregationInterval); // aggregate data to months
        TsIterator it = aggregatedNode.get(start, end); // create iterator of processing graph
        System.out.println(it.getProcessingChain().getText()); // print processing graph
        while(it.hasNext()) { // on demand process and print time series
                System.out.println(it.next());
        }
        aggregatedNode.get(start, end).writeCSV(TsDBFactory.get_CSV_output_directory()+"data_month.csv"); // reuse processing graph and write time series directly to CSV-file
        rawNode.get(start, end).writeCSV(TsDBFactory.get_CSV_output_directory()+"data_raw.csv"); // reuse processing graph and write raw time series directly to CSV-file
}
Skip navigation links
TubeDB