Search in sources :

Example 1 with ParameterOutput

use of org.n52.io.response.ParameterOutput in project series-rest-api by 52North.

the class QuantityCsvIoHandler method writeData.

private void writeData(DatasetOutput metadata, QuantityData series, OutputStream stream) throws IOException {
    String station = null;
    ParameterOutput platform = metadata.getSeriesParameters().getPlatform();
    if (platform == null) {
        TimeseriesMetadataOutput output = (TimeseriesMetadataOutput) metadata;
        station = output.getStation().getLabel();
    } else {
        station = platform.getLabel();
    }
    String phenomenon = metadata.getSeriesParameters().getPhenomenon().getLabel();
    String uom = metadata.getUom();
    for (QuantityValue timeseriesValue : series.getValues()) {
        String[] values = new String[getHeader().length];
        values[0] = station;
        values[1] = phenomenon;
        values[2] = uom;
        Long timestart = timeseriesValue.getTimestart();
        Long timeend = timeseriesValue.getTimestamp();
        values[3] = timestart != null ? new DateTime(timestart).toString() : null;
        values[4] = new DateTime(timeend).toString();
        values[5] = numberformat.format(timeseriesValue.getValue());
        writeCsvLine(csvEncode(values), stream);
    }
}
Also used : TimeseriesMetadataOutput(org.n52.io.response.dataset.TimeseriesMetadataOutput) QuantityValue(org.n52.io.response.dataset.quantity.QuantityValue) ParameterOutput(org.n52.io.response.ParameterOutput) DateTime(org.joda.time.DateTime)

Example 2 with ParameterOutput

use of org.n52.io.response.ParameterOutput in project series-rest-api by 52North.

the class ChartIoHandler method createRangeLabel.

protected String createRangeLabel(DatasetOutput timeseriesMetadata) {
    SeriesParameters parameters = timeseriesMetadata.getSeriesParameters();
    ParameterOutput phenomenon = parameters.getPhenomenon();
    StringBuilder uom = new StringBuilder();
    uom.append(phenomenon.getLabel());
    String uomLabel = timeseriesMetadata.getUom();
    if (uomLabel != null && !uomLabel.isEmpty()) {
        uom.append(" [").append(uomLabel).append("]");
    }
    return uom.toString();
}
Also used : SeriesParameters(org.n52.io.response.dataset.SeriesParameters) ParameterOutput(org.n52.io.response.ParameterOutput)

Example 3 with ParameterOutput

use of org.n52.io.response.ParameterOutput in project series-rest-api by 52North.

the class MultipleChartsRenderer method createChartId.

private String createChartId(DatasetOutput metadata, String referenceId) {
    ParameterOutput feature = metadata.getSeriesParameters().getFeature();
    StringBuilder timeseriesLabel = new StringBuilder();
    timeseriesLabel.append(feature.getLabel());
    if (referenceId != null) {
        timeseriesLabel.append(", ").append(referenceId);
    }
    timeseriesLabel.append(" (").append(createRangeLabel(metadata)).append(")");
    return timeseriesLabel.toString();
}
Also used : ParameterOutput(org.n52.io.response.ParameterOutput)

Aggregations

ParameterOutput (org.n52.io.response.ParameterOutput)3 DateTime (org.joda.time.DateTime)1 SeriesParameters (org.n52.io.response.dataset.SeriesParameters)1 TimeseriesMetadataOutput (org.n52.io.response.dataset.TimeseriesMetadataOutput)1 QuantityValue (org.n52.io.response.dataset.quantity.QuantityValue)1