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);
}
}
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();
}
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();
}
Aggregations