# HG changeset patch # User Raimund Renkert # Date 1365599096 -7200 # Node ID ca4b6263996c42893a503ef9c1a06ce8d30bf6f0 # Parent 619da3fa7a8b2d2fb00ce3e9161c37ae4759b4c4 Added old calculations to datacage 'M-INFO Sedimentfracht'. * Added facets to artifact config. * Added macros to datacage config. * Create subfolders for old calculations in datacage. * New outputs in sediment load generator. diff -r 619da3fa7a8b -r ca4b6263996c flys-artifacts/doc/conf/artifacts/minfo.xml --- a/flys-artifacts/doc/conf/artifacts/minfo.xml Wed Apr 10 14:51:57 2013 +0200 +++ b/flys-artifacts/doc/conf/artifacts/minfo.xml Wed Apr 10 15:04:56 2013 +0200 @@ -466,6 +466,17 @@ + + + + + + + + + + + diff -r 619da3fa7a8b -r ca4b6263996c flys-artifacts/doc/conf/meta-data.xml --- a/flys-artifacts/doc/conf/meta-data.xml Wed Apr 10 14:51:57 2013 +0200 +++ b/flys-artifacts/doc/conf/meta-data.xml Wed Apr 10 15:04:56 2013 +0200 @@ -611,6 +611,33 @@ + + + + + SELECT id AS width_id + FROM morphologic_width + WHERE river_id = ${river_id} + + + + + SELECT min(station) AS from, + max(station) AS to + FROM morphologic_width_values + WHERE morphologic_width_id = ${width_id} + + + + + + + + + + @@ -732,6 +759,10 @@ + + + + MINFO bedheight middle @@ -2512,27 +2543,40 @@ - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM outs AS o, facets AS f, artifacts AS a + SELECT id AS oid + FROM outs AS o WHERE - (f.name = 'bed_longitudinal_section.bed_diameter_toplayer' - OR f.name = 'bed_longitudinal_section.bed_diameter_sublayer') AND - f.out_id = o.id AND - o.artifact_id = ${a_id} AND - a.id = ${a_id} + o.artifact_id = ${a_id} AND + o.name='bed_longitudinal_section' - - - - - - - + + + + SELECT a.gid AS aid, + f.id AS fid, + f.name AS facet_name, + f.num AS facet_num, + f.description AS facet_description + FROM outs AS o, facets AS f, artifacts AS a + WHERE + (f.name = 'bed_longitudinal_section.bed_diameter_toplayer' + OR f.name = 'bed_longitudinal_section.bed_diameter_sublayer') AND + f.out_id = o.id AND + o.artifact_id = ${a_id} AND + a.id = ${a_id} + + + + + + + + + + + + @@ -2548,26 +2592,39 @@ - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM outs AS o, facets AS f, artifacts AS a + SELECT id AS oid + FROM outs AS o WHERE - f.name = 'bed_longitudinal_section.bedload_diameter' AND - f.out_id = o.id AND - o.artifact_id = ${a_id} AND - a.id = ${a_id} + o.artifact_id = ${a_id} AND + o.name='bed_longitudinal_section' - - - - - - - + + + + SELECT a.gid AS aid, + f.id AS fid, + f.name AS facet_name, + f.num AS facet_num, + f.description AS facet_description + FROM outs AS o, facets AS f, artifacts AS a + WHERE + f.name = 'bed_longitudinal_section.bedload_diameter' AND + f.out_id = o.id AND + o.artifact_id = ${a_id} AND + a.id = ${a_id} + + + + + + + + + + + + @@ -2581,29 +2638,42 @@ - - - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM outs AS o, facets AS f, artifacts AS a - WHERE - (f.name = 'bed_longitudinal_section.sediment_density_toplayer' OR - f.name = 'bed_longitudinal_section.sediment_density_sublayer') AND - f.out_id = o.id AND - o.artifact_id = ${a_id} AND - a.id = ${a_id} - - - - - - - - - + + + SELECT id AS oid + FROM outs AS o + WHERE + o.artifact_id = ${a_id} AND + o.name='bed_longitudinal_section' + + + + + + SELECT a.gid AS aid, + f.id AS fid, + f.name AS facet_name, + f.num AS facet_num, + f.description AS facet_description + FROM outs AS o, facets AS f, artifacts AS a + WHERE + (f.name = 'bed_longitudinal_section.sediment_density_toplayer' OR + f.name = 'bed_longitudinal_section.sediment_density_sublayer') AND + f.out_id = o.id AND + o.artifact_id = ${a_id} AND + a.id = ${a_id} + + + + + + + + + + + + @@ -2619,27 +2689,40 @@ - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM outs AS o, facets AS f, artifacts AS a + SELECT id AS oid + FROM outs AS o WHERE - (f.name = 'bed_longitudinal_section.porosity_toplayer' OR - f.name = 'bed_longitudinal_section.porosity_sublayer') AND - f.out_id = o.id AND - o.artifact_id = ${a_id} AND - a.id = ${a_id} + o.artifact_id = ${a_id} AND + o.name='bed_longitudinal_section' - - - - - - - + + + + SELECT a.gid AS aid, + f.id AS fid, + f.name AS facet_name, + f.num AS facet_num, + f.description AS facet_description + FROM outs AS o, facets AS f, artifacts AS a + WHERE + (f.name = 'bed_longitudinal_section.porosity_toplayer' OR + f.name = 'bed_longitudinal_section.porosity_sublayer') AND + f.out_id = o.id AND + o.artifact_id = ${a_id} AND + a.id = ${a_id} + + + + + + + + + + + + @@ -2655,29 +2738,41 @@ - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM outs AS o, facets AS f, artifacts AS a + SELECT id AS oid + FROM outs AS o WHERE - (f.name = 'flow_velocity.totalchannel' OR - f.name = 'flow_velocity.mainchannel' OR - f.name = 'flow_velocity.totalchannel.filtered' OR - f.name = 'flow_velocity.mainchannel.filtered') AND - f.out_id = o.id AND - o.artifact_id = ${a_id} AND - a.id = ${a_id} + o.artifact_id = ${a_id} and o.name='flow_velocity' - - - - - - - + + + + SELECT a.gid AS aid, + f.id AS fid, + f.name AS facet_name, + f.num AS facet_num, + f.description AS facet_description + FROM outs AS o, facets AS f, artifacts AS a + WHERE + (f.name = 'flow_velocity.totalchannel' OR + f.name = 'flow_velocity.mainchannel' OR + f.name = 'flow_velocity.totalchannel.filtered' OR + f.name = 'flow_velocity.mainchannel.filtered') AND + f.out_id = o.id AND + o.artifact_id = ${a_id} AND + a.id = ${a_id} + + + + + + + + + + + + @@ -2686,6 +2781,109 @@ + + + + + + + + SELECT id AS oid + FROM outs AS o + WHERE + o.artifact_id = ${a_id} and o.name='sedimentload_ls' + + + + + + SELECT a.gid AS aid, + f.id AS fid, + f.name AS facet_name, + f.num AS facet_num, + f.description AS facet_description + FROM outs AS o, facets AS f, artifacts AS a + WHERE f.name LIKE 'sedimentload%' AND + f.out_id = o.id AND + o.artifact_id = ${a_id} AND + a.id = ${a_id} + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT id AS oid, + name AS o_name + FROM outs AS o + WHERE + o.artifact_id = ${a_id} AND + (o.name = 'bed_difference_year' OR + o.name = 'bed_differnece_epoch') + + + + + + SELECT a.gid AS aid, + f.id AS fid, + f.name AS facet_name, + f.num AS facet_num, + f.description AS facet_description + FROM outs AS o, facets AS f, artifacts AS a + WHERE (f.name LIKE 'bedheight_difference.year%' OR + f.name LIKE 'bedheight_difference.epoch%') AND + f.out_id = o.id AND + o.artifact_id = ${a_id} AND + a.id = ${a_id} + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2742,6 +2940,12 @@ + + + + + + diff -r 619da3fa7a8b -r ca4b6263996c flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java Wed Apr 10 14:51:57 2013 +0200 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java Wed Apr 10 15:04:56 2013 +0200 @@ -1,5 +1,7 @@ package de.intevation.flys.exports.minfo; +import java.util.Arrays; + import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeries; import org.w3c.dom.Document; @@ -7,13 +9,22 @@ import de.intevation.artifactdatabase.state.ArtifactAndFacet; import de.intevation.artifactdatabase.state.Facet; import de.intevation.flys.artifacts.FLYSArtifact; +import de.intevation.flys.artifacts.access.RangeAccess; +import de.intevation.flys.artifacts.access.RiverAccess; import de.intevation.flys.artifacts.access.SedimentLoadAccess; import de.intevation.flys.artifacts.model.FacetTypes; +import de.intevation.flys.artifacts.model.FlowVelocityData; +import de.intevation.flys.artifacts.model.WKms; +import de.intevation.flys.artifacts.model.minfo.BedDiffEpochResult; +import de.intevation.flys.artifacts.model.minfo.BedDiffYearResult; import de.intevation.flys.artifacts.model.minfo.SedimentLoadResult; import de.intevation.flys.exports.StyledSeriesBuilder; import de.intevation.flys.exports.XYChartGenerator; +import de.intevation.flys.jfree.Bounds; +import de.intevation.flys.jfree.DoubleBounds; import de.intevation.flys.jfree.FLYSAnnotation; import de.intevation.flys.jfree.StyledXYSeries; +import de.intevation.flys.utils.DataUtil; public class SedimentLoadLSGenerator @@ -21,7 +32,10 @@ implements FacetTypes { public enum YAXIS { - L(0); + L(0), + D(1), + DW(2), + V(3); protected int idx; @@ -30,17 +44,25 @@ } } /** The logger that is used in this generator. */ - private static Logger logger = Logger.getLogger(BedQualityGenerator.class); + private static Logger logger = Logger.getLogger(SedimentLoadLSGenerator.class); public static final String I18N_CHART_TITLE = "chart.sedimentload.ls.title"; public static final String I18N_XAXIS_LABEL = "chart.sedimentload.ls.xaxis.label"; public static final String I18N_YAXIS_LABEL_1 = "chart.sedimentload.ls.yaxis.label.tpera"; public static final String I18N_YAXIS_LABEL_2 = "chart.sedimentload.ls.yaxis.label.m3pera"; + public static final String I18N_YAXIS_D_LABEL = "chart.beddifference.yaxis.label.diff"; + public static final String I18N_YAXIS_V_LABEL = + "chart.flow_velocity.section.yaxis.label"; + public final static String I18N_WDIFF_YAXIS_LABEL = + "chart.w_differences.yaxis.label"; + public final static String I18N_WDIFF_YAXIS_LABEL_DEFAULT = "m"; public static final String I18N_CHART_TITLE_DEFAULT = "Sedimentfracht"; public static final String I18N_XAXIS_LABEL_DEFAULT = "Fluss-Km"; public static final String I18N_YAXIS_LABEL_DEFAULT_1 = "[t/a]"; public static final String I18N_YAXIS_LABEL_DEFAULT_2 = "[m\u00b3/a]"; + public static final String I18N_YAXIS_D_LABEL_DEFAULT = "delta S [m]"; + public static final String I18N_YAXIS_V_LABEL_DEFAULT = "Geschwindigkeit v [m/s]"; private FLYSArtifact artifact; @@ -78,7 +100,32 @@ if (facet == null) { return; } - + if (getXBounds(0) != null && getDomainAxisRange() != null) { + logger.debug(Arrays.toString(getDomainAxisRangeFromRequest())); + Bounds bounds = + calculateZoom(getXBounds(0), getDomainAxisRange()); + context.putContextValue("startkm", bounds.getLower()); + context.putContextValue("endkm", bounds.getUpper()); + } + else if (getXBounds(0) != null && getDomainAxisRange() == null) { + context.putContextValue("startkm", getXBounds(0).getLower()); + context.putContextValue("endkm", getXBounds(0).getUpper()); + } + else if (getXBounds(0) == null && getDomainAxisRange() == null) { + FLYSArtifact artifact = (FLYSArtifact)bundle.getArtifact(); + RangeAccess access = new RangeAccess(artifact, context); + context.putContextValue("startkm", access.getFrom()); + context.putContextValue("endkm", access.getTo()); + } + else if (getXBounds(0) == null && getDomainAxisRange() != null){ + FLYSArtifact artifact = (FLYSArtifact)bundle.getArtifact(); + RangeAccess access = new RangeAccess(artifact, context); + Bounds b = new DoubleBounds(access.getFrom(), access.getTo()); + Bounds bounds = + calculateZoom(b, getDomainAxisRange()); + context.putContextValue("startkm", bounds.getLower()); + context.putContextValue("endkm", bounds.getUpper()); + } if (name.equals(SEDIMENT_LOAD_COARSE)) { doSedimentLoadCoarseOut( (SedimentLoadResult) bundle.getData(context), @@ -135,6 +182,62 @@ attr, visible); } + else if (name.equals(FLOW_VELOCITY_TOTALCHANNEL)) { + doFlowVelocityTotalOut( + (FlowVelocityData) bundle.getData(context), + bundle, + attr, + visible); + } + else if (name.equals(FLOW_VELOCITY_TOTALCHANNEL_FILTERED)) { + doFlowVelocityTotalOut( + (FlowVelocityData) bundle.getData(context), + bundle, + attr, + visible); + } + else if (name.equals(FLOW_VELOCITY_MAINCHANNEL)) { + doFlowVelocityMainOut( + (FlowVelocityData) bundle.getData(context), + bundle, + attr, + visible); + } + else if (name.equals(FLOW_VELOCITY_MAINCHANNEL_FILTERED)) { + doFlowVelocityMainOut( + (FlowVelocityData) bundle.getData(context), + bundle, + attr, + visible); + } + else if (name.equals(BED_DIFFERENCE_YEAR)) { + doBedDifferenceYearOut( + (BedDiffYearResult) bundle.getData(context), + bundle, + attr, + visible); + } + else if (name.equals(BED_DIFFERENCE_YEAR_FILTERED)) { + doBedDifferenceYearOut( + (BedDiffYearResult) bundle.getData(context), + bundle, + attr, + visible); + } + else if (name.equals(BED_DIFFERENCE_EPOCH)) { + doBedDifferenceEpochOut( + (BedDiffEpochResult) bundle.getData(context), + bundle, + attr, + visible); + } + else if (name.equals(W_DIFFERENCES)) { + doWDifferencesOut( + (WKms) bundle.getData(context), + bundle, + attr, + visible); + } else if (name.equals(LONGITUDINAL_ANNOTATION)) { doAnnotations( (FLYSAnnotation) bundle.getData(context), @@ -174,6 +277,16 @@ label = msg(I18N_YAXIS_LABEL_1, I18N_YAXIS_LABEL_DEFAULT_1); } } + else if (pos == YAXIS.V.idx) { + label = msg(I18N_YAXIS_V_LABEL, I18N_YAXIS_V_LABEL_DEFAULT); + } + else if (pos == YAXIS.D.idx) { + label = msg(I18N_YAXIS_D_LABEL, I18N_YAXIS_D_LABEL_DEFAULT); + } + else if (pos == YAXIS.DW.idx) { + label = msg(I18N_WDIFF_YAXIS_LABEL, I18N_WDIFF_YAXIS_LABEL_DEFAULT); + } + return label; } @@ -249,4 +362,78 @@ addAxisSeries(series, YAXIS.L.idx, visible); } + protected void doFlowVelocityMainOut( + FlowVelocityData data, + ArtifactAndFacet aandf, + Document theme, + boolean visible + ) { + XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); + StyledSeriesBuilder.addPoints(series, data.getMainChannelPoints(), true); + + addAxisSeries(series, YAXIS.V.idx, visible); + } + + protected void doFlowVelocityTotalOut( + FlowVelocityData data, + ArtifactAndFacet aandf, + Document theme, + boolean visible + ) { + if (data == null) { + logger.warn("No data to add to FlowVelocity chart."); + return; + } + + XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); + StyledSeriesBuilder.addPoints(series, data.getTotalChannelPoints(), true); + + addAxisSeries(series, YAXIS.V.idx, visible); + } + + protected void doBedDifferenceYearOut( + BedDiffYearResult data, + ArtifactAndFacet aandf, + Document theme, + boolean visible + ) { + XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); + StyledSeriesBuilder.addPoints(series, data.getDifferencesData(), true); + + addAxisSeries(series, YAXIS.D.idx, visible); + } + + protected void doBedDifferenceEpochOut( + BedDiffEpochResult data, + ArtifactAndFacet aandf, + Document theme, + boolean visible + ) { + XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); + StyledSeriesBuilder.addPoints(series, data.getDifferencesData(), true); + + addAxisSeries(series, YAXIS.D.idx, visible); + } + + protected void doWDifferencesOut( + WKms wkms, + ArtifactAndFacet aandf, + Document theme, + boolean visible + ) { + if (wkms == null) { + logger.warn("No data to add to WDifferencesChart."); + return; + } + + XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); + + StyledSeriesBuilder.addPoints(series, wkms); + + addAxisSeries(series, YAXIS.D.idx, visible); + if (DataUtil.guessWaterIncreasing(wkms.allWs())) { + setInverted(true); + } + } + }