Mercurial > dive4elements > river
changeset 8215:204905c16ade
Fetch missing values from database and show them in diagrams.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 08 Sep 2014 12:21:32 +0200 |
parents | ceeeaf228fe4 |
children | cb25ea4d4551 a12e0245643b |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java artifacts/src/main/java/org/dive4elements/river/exports/process/SedimentLoadProcessor.java |
diffstat | 3 files changed, 34 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java Mon Sep 08 10:03:00 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java Mon Sep 08 12:21:32 2014 +0200 @@ -31,6 +31,18 @@ public static final String SUSPENDED_STRING = "Schwebstoff"; public static final String SQL_LOAD_RIVER_SEDIMENT_LOADS = + "WITH load_at_river AS (" + + "SELECT DISTINCT sl.id, " + + "sl.kind, " + + "sl.description, " + + "sl.time_interval_id, " + + "sl.grain_fraction_id, " + + "sl.sq_time_interval_id " + + "FROM sediment_load sl " + + "JOIN sediment_load_values slv ON sl.id = slv.sediment_load_id " + + "JOIN measurement_station ms ON ms.id = slv.measurement_station_id " + + "JOIN rivers r ON r.id = ms.river_id " + + "WHERE r.name = :river) " + "SELECT " + "sl.id AS sl_id, " + "sl.kind AS sl_kind, " + @@ -45,14 +57,23 @@ "ms.id AS ms_id, " + "ms.station AS ms_station, " + "ms.measurement_type AS ms_type " + - "FROM sediment_load_values slv " + - "JOIN sediment_load sl ON slv.sediment_load_id = sl.id " + + "FROM load_at_river sl " + + "CROSS JOIN measurement_station ms " + "JOIN time_intervals ti ON sl.time_interval_id = ti.id " + "LEFT JOIN time_intervals sqti ON sl.sq_time_interval_id = sqti.id " + "JOIN grain_fraction gf ON sl.grain_fraction_id = gf.id " + - "JOIN measurement_station ms ON slv.measurement_station_id = ms.id " + "JOIN rivers r ON ms.river_id = r.id " + - "WHERE r.name = :river " + + "LEFT JOIN sediment_load_values slv " + + "ON ms.id=slv.measurement_station_id AND sl.id=slv.sediment_load_id " + + "WHERE (" + + "(ms.measurement_type='Geschiebe' AND gf.name IN " + + "('coarse', 'fine_middle', 'sand', 'susp_sand', " + + "'susp_sand_bed', 'bed_load', 'bed_load_susp_sand', " + + "'suspended_load', 'total')) " + + "OR " + + "(ms.measurement_type='Schwebstoff' AND gf.name IN " + + "('suspended_sediment', 'suspended_load', 'total'))) " + + "AND r.name = :river " + "ORDER BY sl.id"; public static final SedimentLoadDataFactory INSTANCE = @@ -132,6 +153,7 @@ for (Object [] row: list) { + // Load Integer sl_id = (Integer)row[0]; Integer sl_kind = (Integer)row[1]; String sl_description = (String)row[2]; @@ -140,8 +162,12 @@ Timestamp sq_start_time = (Timestamp)row[5]; Timestamp sq_stop_time = (Timestamp)row[6]; Integer sq_id = (Integer)row[7]; + + // Value Double slv_value = (Double)row[8]; String gf_name = (String)row[9]; + + // Station Integer ms_id = (Integer)row[10]; Double ms_station = (Double)row[11]; String ms_type = (String)row[12]; @@ -181,7 +207,9 @@ station.addValue( grainFractionIndex, - new SedimentLoadData.Value(load, slv_value)); + new SedimentLoadData.Value(load, slv_value == null + ? Double.NaN + : slv_value)); } SedimentLoadData sld = new SedimentLoadData(id2station.values(),
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java Mon Sep 08 10:03:00 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java Mon Sep 08 12:21:32 2014 +0200 @@ -68,9 +68,6 @@ for (SedimentLoadData.Station sta: allLoadData.getStations()) { double value = sta.findValueByLoadId(id); - if (Double.isNaN(value)) { - continue; - } xPos.add(sta.getStation()); yPos.add(value); }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/SedimentLoadProcessor.java Mon Sep 08 10:03:00 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/SedimentLoadProcessor.java Mon Sep 08 12:21:32 2014 +0200 @@ -40,7 +40,7 @@ ArtifactAndFacet bundle, ThemeDocument theme, boolean visible) { - log.debug("doOut " + bundle.getFacetName()); + CallContext context = generator.getCallContext(); XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), false, // Handle NaN