Search in sources :

Example 1 with TimeSeries

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);
    }
}
Also used : TimeSeries(org.n52.oxf.DocumentStructureType.TimeSeries) DatasetOutput(org.n52.io.response.dataset.DatasetOutput)

Example 2 with TimeSeries

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;
}
Also used : TimeSeries(org.n52.oxf.DocumentStructureType.TimeSeries) SeriesParameters(org.n52.io.response.dataset.SeriesParameters) DocumentStructureType(org.n52.oxf.DocumentStructureType)

Example 3 with 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()));
    }
}
Also used : Entry(org.n52.oxf.TableType.Entry) TableType(org.n52.oxf.TableType) QuantityValue(org.n52.io.response.dataset.quantity.QuantityValue) QuantityData(org.n52.io.response.dataset.quantity.QuantityData) DateTime(org.joda.time.DateTime)

Example 4 with TimeSeries

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;
}
Also used : Coordinate(com.vividsolutions.jts.geom.Coordinate) QuantityValue(org.n52.io.response.dataset.quantity.QuantityValue) ArrayList(java.util.ArrayList)

Example 5 with TimeSeries

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;
}
Also used : TvpDataCollection(org.n52.io.series.TvpDataCollection) QuantityData(org.n52.io.response.dataset.quantity.QuantityData)

Aggregations

QuantityData (org.n52.io.response.dataset.quantity.QuantityData)7 QuantityValue (org.n52.io.response.dataset.quantity.QuantityValue)5 ArrayList (java.util.ArrayList)3 DatasetOutput (org.n52.io.response.dataset.DatasetOutput)3 Coordinate (com.vividsolutions.jts.geom.Coordinate)2 IoParameters (org.n52.io.request.IoParameters)2 SeriesParameters (org.n52.io.response.dataset.SeriesParameters)2 TvpDataCollection (org.n52.io.series.TvpDataCollection)2 TimeSeries (org.n52.oxf.DocumentStructureType.TimeSeries)2 Line2D (java.awt.geom.Line2D)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 DateTime (org.joda.time.DateTime)1 Test (org.junit.Test)1 I18N (org.n52.io.I18N)1 IoStyleContext (org.n52.io.IoStyleContext)1 FilterResolver (org.n52.io.request.FilterResolver)1 StyleProperties (org.n52.io.request.StyleProperties)1 CategoryOutput (org.n52.io.response.CategoryOutput)1 FeatureOutput (org.n52.io.response.FeatureOutput)1