use of org.n52.oxf.DocumentStructureType.TimeSeries in project series-rest-api by 52North.
the class PDFReportGenerator method generateTimeseriesMetadata.
private void generateTimeseriesMetadata() {
for (DatasetOutput metadata : getSeriesMetadatas()) {
TimeSeries timeseries = addTimeseries(metadata);
// addDataTable(timeseries, metadata, data);
addMetadata(timeseries, metadata);
}
}
use of org.n52.oxf.DocumentStructureType.TimeSeries in project series-rest-api by 52North.
the class PDFReportGenerator method addTimeseries.
private TimeSeries addTimeseries(DatasetOutput metadata) {
DocumentStructureType report = document.getDocumentStructure();
TimeSeries timeseries = report.addNewTimeSeries();
SeriesParameters parameters = metadata.getSeriesParameters();
timeseries.setFeatureOfInterestID(parameters.getFeature().getLabel());
timeseries.setPhenomenID(parameters.getPhenomenon().getLabel());
timeseries.setProcedureID(parameters.getProcedure().getLabel());
return timeseries;
}
use of org.n52.oxf.DocumentStructureType.TimeSeries 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.oxf.DocumentStructureType.TimeSeries in project series-rest-api by 52North.
the class HighchartFormatter method formatSeries.
private List<Number[]> formatSeries(QuantityData timeseries) {
List<Number[]> series = new ArrayList<>();
for (QuantityValue currentValue : timeseries.getValues()) {
List<Number> list = new ArrayList<>();
list.add(currentValue.getTimestamp());
list.add(currentValue.getValue());
if (currentValue.isSetGeometry()) {
Coordinate coordinate = currentValue.getGeometry().getCoordinate();
list.add(coordinate.x);
list.add(coordinate.y);
if (!Double.isNaN(coordinate.z)) {
list.add(coordinate.z);
}
}
series.add(list.toArray(new Number[0]));
}
return series;
}
use of org.n52.oxf.DocumentStructureType.TimeSeries 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;
}
Aggregations