Mercurial > dive4elements > river
changeset 6351:2c7a16d59f67
Use Double.NaN for missing values in middle bedheight calculation and write empty strings in csv export.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Mon, 17 Jun 2013 15:37:26 +0200 |
parents | 876c797c2805 |
children | f1a3ea7fb3b6 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/model/MiddleBedHeightCalculation.java artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.java |
diffstat | 2 files changed, 18 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MiddleBedHeightCalculation.java Mon Jun 17 14:30:00 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MiddleBedHeightCalculation.java Mon Jun 17 15:37:26 2013 +0200 @@ -157,11 +157,17 @@ for (BedHeightSingleValue value: values) { if (value.getHeight() != null) { + double uncert = value.getUncertainty() != null ? + value.getUncertainty().doubleValue() : Double.NaN; + double sounding = value.getSoundingWidth() != null ? + value.getSoundingWidth().doubleValue() : Double.NaN; + double gap = value.getDataGap() != null ? + value.getDataGap().doubleValue() : Double.NaN; data.addAll(value.getStation().doubleValue(), value.getHeight().doubleValue(), - value.getUncertainty().doubleValue(), - value.getSoundingWidth().doubleValue(), - value.getDataGap().doubleValue(), + uncert, + sounding, + gap, value.getWidth().doubleValue(), false); }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.java Mon Jun 17 14:30:00 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.java Mon Jun 17 15:37:26 2013 +0200 @@ -131,13 +131,19 @@ int end = data.getEndYear(); if (start == end) { + String uncert = !Double.isNaN(data.getUncertainty(i)) ? + uncertF.format(data.getUncertainty(i)) : ""; + String gap = !Double.isNaN(data.getDataGap(i)) ? + gapF.format(data.getDataGap(i)) + "%" : ""; + String sound = !Double.isNaN(data.getSoundingWidth(i)) ? + soundF.format(data.getSoundingWidth(i)) : ""; writer.writeNext(new String[] { kmF.format(data.getKM(i)), data.getDescription(), heightF.format(data.getMiddleHeight(i)), - uncertF.format(data.getUncertainty(i)), - gapF.format(data.getDataGap(i)) + "%", - soundF.format(data.getSoundingWidth(i)), + uncert, + gap, + sound, widthF.format(data.getWidth(i)), RiverUtils.getLocationDescription(flys, data.getKM(i)), });