use of org.n52.io.series.TvpDataCollection in project series-rest-api by 52North.
the class PDFReportGenerator method addDataTable.
private void addDataTable(TimeSeries timeseries, TimeseriesMetadataOutput metadata, TvpDataCollection<QuantityData> dataCollection) {
TableType dataTable = timeseries.addNewTable();
// TODO add language context
dataTable.setLeftColHeader("Date");
dataTable.setRightColHeader(createValueTableHeader(metadata));
QuantityData data = dataCollection.getSeries(metadata.getId());
for (QuantityValue valueEntry : data.getValues()) {
Entry entry = dataTable.addNewEntry();
// TODO update TableType schema to allow start/end time
entry.setTime(new DateTime(valueEntry.getTimestamp()).toString());
entry.setValue(Double.toString(valueEntry.getValue()));
}
}
use of org.n52.io.series.TvpDataCollection in project series-rest-api by 52North.
the class DouglasPeuckerGeneralizer method generalize.
@Override
public DataCollection<QuantityData> generalize(DataCollection<QuantityData> data) throws GeneralizerException {
TvpDataCollection<QuantityData> generalizedDataCollection = new TvpDataCollection<>();
for (String timeseriesId : data.getAllSeries().keySet()) {
QuantityData timeseries = data.getSeries(timeseriesId);
generalizedDataCollection.addNewSeries(timeseriesId, generalize(timeseries));
}
return generalizedDataCollection;
}
use of org.n52.io.series.TvpDataCollection in project series-rest-api by 52North.
the class LargestTriangleThreeBucketsGeneralizer method generalize.
@Override
public DataCollection<QuantityData> generalize(DataCollection<QuantityData> data) throws GeneralizerException {
TvpDataCollection<QuantityData> generalizedDataCollection = new TvpDataCollection<>();
for (String timeseriesId : data.getAllSeries().keySet()) {
QuantityData timeseries = data.getSeries(timeseriesId);
QuantityData generalizedTimeseries = generalize(timeseries);
generalizedTimeseries.setMetadata(timeseries.getMetadata());
generalizedDataCollection.addNewSeries(timeseriesId, generalizedTimeseries);
}
return generalizedDataCollection;
}
Aggregations