[Dive4elements-commits] [PATCH 1 of 4] Added new facets for filtered bed height diffs to have filtered and raw data
Wald Commits
scm-commit at wald.intevation.org
Thu Dec 13 17:20:45 CET 2012
# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1355415533 -3600
# Node ID 12e3da5724e66e37aaf952d1b8fced64e71a331b
# Parent 4ca05e5f33994277cc2d611db324f86c38c65cd1
Added new facets for filtered bed height diffs to have filtered and raw data.
diff -r 4ca05e5f3399 -r 12e3da5724e6 flys-artifacts/doc/conf/artifacts/minfo.xml
--- a/flys-artifacts/doc/conf/artifacts/minfo.xml Thu Dec 13 15:57:09 2012 +0100
+++ b/flys-artifacts/doc/conf/artifacts/minfo.xml Thu Dec 13 17:18:53 2012 +0100
@@ -196,6 +196,7 @@
<outputmode name="bed_difference_height_year" description="output.absolute_height" mime-type="image/png" type="chart">
<facets>
<facet name="bedheight_difference.height_year" description="A facet for absolute heights"/>
+ <facet name="bedheight_difference.height_year.filtered" description="A facet for absolute heights"/>
<facet name="bedheight_difference.manualpoints" />
<facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
<facet name="fix_sector_average_ls_0" description="Datacage facet"/>
@@ -209,10 +210,13 @@
<outputmode name="bed_difference_year" description="output.difference_year" mime-type="img/png" type="chart">
<facets>
<facet name="bedheight_difference.year" description="A facet for bed height differences"/>
+ <facet name="bedheight_difference.year.filtered" description="A facet for bed height differences"/>
<facet name="bedheight_difference.manualpoints" />
<facet name="bedheight_difference.morph_width" description="A facet for morphologic width"/>
<facet name="bedheight_difference.year.height1" description="A facet for raw heights."/>
<facet name="bedheight_difference.year.height2" description="A facet for raw heights."/>
+ <facet name="bedheight_difference.year.height1.filtered" description="A facet for raw heights."/>
+ <facet name="bedheight_difference.year.height2.filtered" description="A facet for raw heights."/>
<facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
<facet name="fix_sector_average_ls_0" description="Datacage facet"/>
<facet name="fix_sector_average_ls_1" description="Datacage facet"/>
diff -r 4ca05e5f3399 -r 12e3da5724e6 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Thu Dec 13 15:57:09 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Thu Dec 13 17:18:53 2012 +0100
@@ -260,13 +260,20 @@
String BED_QUALITY_BEDLOAD_DIAMETER = "bed_longitudinal_section.bedload_diameter";
String BED_DIFFERENCE_YEAR = "bedheight_difference.year";
+ String BED_DIFFERENCE_YEAR_FILTERED = "bedheight_difference.year.filtered";
String BED_DIFFERENCE_HEIGHT_YEAR = "bedheight_difference.height_year";
+ String BED_DIFFERENCE_HEIGHT_YEAR_FILTERED = "bedheight_difference.height_year.filtered";
String BED_DIFFERENCE_EPOCH = "bedheight_difference.epoch";
+ String BED_DIFFERENCE_EPOCH_FILTERED = "bedheight_difference.epoch.filtered";
String BED_DIFFERENCE_MORPH_WIDTH = "bedheight_difference.morph_width";
String BED_DIFFERENCE_YEAR_HEIGHT1 = "bedheight_difference.year.height1";
String BED_DIFFERENCE_YEAR_HEIGHT2 = "bedheight_difference.year.height2";
+ String BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED = "bedheight_difference.year.height1.filtered";
+ String BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED = "bedheight_difference.year.height2.filtered";
String BED_DIFFERENCE_EPOCH_HEIGHT1 = "bedheight_difference.epoch.height1";
String BED_DIFFERENCE_EPOCH_HEIGHT2 = "bedheight_difference.epoch.height2";
+ String BED_DIFFERENCE_EPOCH_HEIGHT1_FILTERED = "bedheight_difference.epoch.height1.filtered";
+ String BED_DIFFERENCE_EPOCH_HEIGHT2_FILTERED = "bedheight_difference.epoch.height2.filtered";
String SEDIMENT_LOAD_COARSE = "sedimentload.coarse";
String SEDIMENT_LOAD_SAND = "sedimentload.sand";
diff -r 4ca05e5f3399 -r 12e3da5724e6 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochFacet.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochFacet.java Thu Dec 13 15:57:09 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochFacet.java Thu Dec 13 17:18:53 2012 +0100
@@ -37,32 +37,8 @@
stateId, type, false);
BedDiffEpochResult[] data =
- (BedDiffEpochResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
- Double start = (Double)context.getContextValue("startkm");
- Double end = (Double)context.getContextValue("endkm");
+ (BedDiffEpochResult[]) res.getData();
- if(start != null && end != null) {
- FLYSContext fc = (FLYSContext)context.globalContext();
- ZoomScale scales = (ZoomScale)fc.get("zoomscale");
- RiverAccess access = new RiverAccess((FLYSArtifact)artifact);
- String river = access.getRiver();
-
- double radius = scales.getRadius(river, start, end);
- BedDiffEpochResult oldData = data[index];
- BedDiffEpochResult newData = new BedDiffEpochResult();
- newData.setStart(oldData.getStart());
- newData.setEnd(oldData.getEnd());
- double[][] diffs = MovingAverage.weighted(oldData.getDifferencesData(), radius);
- double[][] heights1 = MovingAverage.weighted(oldData.getHeights1Data(), radius);
- double[][] heights2 = MovingAverage.weighted(oldData.getHeights2Data(), radius);
- for(int j = 0; j < diffs[0].length; j++) {
- newData.addKm(diffs[0][j]);
- newData.addDifference(diffs[1][j]);
- newData.addHeight1(heights1[1][j]);
- newData.addHeight2(heights2[1][j]);
- }
- return newData;
- }
return data != null && data.length > index ? data[index] : null;
}
diff -r 4ca05e5f3399 -r 12e3da5724e6 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochFilterFacet.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochFilterFacet.java Thu Dec 13 17:18:53 2012 +0100
@@ -0,0 +1,80 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.CallContext;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.RiverAccess;
+import de.intevation.flys.artifacts.context.FLYSContext;
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.math.MovingAverage;
+import de.intevation.flys.artifacts.model.ZoomScale;
+import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffEpochFilterFacet
+extends DataFacet
+{
+ private static Logger logger = Logger.getLogger(BedDensityFacet.class);
+
+ public BedDiffEpochFilterFacet() {
+ }
+
+ public BedDiffEpochFilterFacet(int idx, String name, String description,
+ ComputeType type, String stateId, String hash) {
+ super(idx, name, description, type, hash, stateId);
+ }
+
+ public Object getData(Artifact artifact, CallContext context) {
+ logger.debug("Get data for bed density at index: " + index);
+
+ FLYSArtifact flys = (FLYSArtifact) artifact;
+
+ CalculationResult res = (CalculationResult) flys.compute(context, hash,
+ stateId, type, false);
+
+ BedDiffEpochResult[] data =
+ (BedDiffEpochResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+ Double start = (Double)context.getContextValue("startkm");
+ Double end = (Double)context.getContextValue("endkm");
+
+ if(start != null && end != null) {
+ FLYSContext fc = (FLYSContext)context.globalContext();
+ ZoomScale scales = (ZoomScale)fc.get("zoomscale");
+ RiverAccess access = new RiverAccess((FLYSArtifact)artifact);
+ String river = access.getRiver();
+
+ double radius = scales.getRadius(river, start, end);
+ BedDiffEpochResult oldData = data[index];
+ BedDiffEpochResult newData = new BedDiffEpochResult();
+ newData.setStart(oldData.getStart());
+ newData.setEnd(oldData.getEnd());
+ double[][] diffs = MovingAverage.weighted(oldData.getDifferencesData(), radius);
+ double[][] heights1 = MovingAverage.weighted(oldData.getHeights1Data(), radius);
+ double[][] heights2 = MovingAverage.weighted(oldData.getHeights2Data(), radius);
+ for(int j = 0; j < diffs[0].length; j++) {
+ newData.addKm(diffs[0][j]);
+ newData.addDifference(diffs[1][j]);
+ newData.addHeight1(heights1[1][j]);
+ newData.addHeight2(heights2[1][j]);
+ }
+ return newData;
+ }
+ return data != null && data.length > index ? data[index] : null;
+ }
+
+ /** Copy deeply. */
+ @Override
+ public Facet deepCopy() {
+ BedDiffEpochFilterFacet copy = new BedDiffEpochFilterFacet();
+ copy.set(this);
+ copy.type = type;
+ copy.hash = hash;
+ copy.stateId = stateId;
+ return copy;
+ }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r 4ca05e5f3399 -r 12e3da5724e6 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearFacet.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearFacet.java Thu Dec 13 15:57:09 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearFacet.java Thu Dec 13 17:18:53 2012 +0100
@@ -38,34 +38,7 @@
BedDiffYearResult[] data =
(BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
- Double start = (Double)context.getContextValue("startkm");
- Double end = (Double)context.getContextValue("endkm");
- if(start != null && end != null) {
- FLYSContext fc = (FLYSContext)context.globalContext();
- ZoomScale scales = (ZoomScale)fc.get("zoomscale");
- RiverAccess access = new RiverAccess((FLYSArtifact)artifact);
- String river = access.getRiver();
- double radius = scales.getRadius(river, start, end);
- BedDiffYearResult oldData = data[index];
- BedDiffYearResult newData = new BedDiffYearResult();
- newData.setStart(oldData.getStart());
- newData.setEnd(oldData.getEnd());
- double[][] diffs = MovingAverage.weighted(oldData.getDifferencesData(), radius);
- double[][] heights1 = MovingAverage.weighted(oldData.getHeights1Data(), radius);
- double[][] heights2 = MovingAverage.weighted(oldData.getHeights2Data(), radius);
- double[][] morph = oldData.getMorphWidthData();
- double[][] year = MovingAverage.weighted(oldData.getHeightPerYearData(), radius);
- for(int j = 0; j < diffs[0].length; j++) {
- newData.addKm(diffs[0][j]);
- newData.addBedHeights(year[1][j]);
- newData.addMorphWidth(morph[1][j]);
- newData.addDifference(diffs[1][j]);
- newData.addHeight1(heights1[1][j]);
- newData.addHeight2(heights2[1][j]);
- }
- return newData;
- }
return data != null && data.length > index ? data[index] : null;
}
diff -r 4ca05e5f3399 -r 12e3da5724e6 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearFilterFacet.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearFilterFacet.java Thu Dec 13 17:18:53 2012 +0100
@@ -0,0 +1,83 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.CallContext;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.RiverAccess;
+import de.intevation.flys.artifacts.context.FLYSContext;
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.math.MovingAverage;
+import de.intevation.flys.artifacts.model.ZoomScale;
+import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffYearFilterFacet
+extends DataFacet
+{
+ private static Logger logger = Logger.getLogger(BedDiffYearFilterFacet.class);
+
+ public BedDiffYearFilterFacet() {
+ }
+
+ public BedDiffYearFilterFacet(int idx, String name, String description,
+ ComputeType type, String stateId, String hash) {
+ super(idx, name, description, type, hash, stateId);
+ }
+
+ public Object getData(Artifact artifact, CallContext context) {
+ logger.debug("Get data for bed density at index: " + index);
+
+ FLYSArtifact flys = (FLYSArtifact) artifact;
+
+ CalculationResult res = (CalculationResult) flys.compute(context, hash,
+ stateId, type, false);
+
+ BedDiffYearResult[] data =
+ (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+ Double start = (Double)context.getContextValue("startkm");
+ Double end = (Double)context.getContextValue("endkm");
+ if(start != null && end != null) {
+ FLYSContext fc = (FLYSContext)context.globalContext();
+ ZoomScale scales = (ZoomScale)fc.get("zoomscale");
+ RiverAccess access = new RiverAccess((FLYSArtifact)artifact);
+ String river = access.getRiver();
+
+ double radius = scales.getRadius(river, start, end);
+ BedDiffYearResult oldData = data[index];
+ BedDiffYearResult newData = new BedDiffYearResult();
+ newData.setStart(oldData.getStart());
+ newData.setEnd(oldData.getEnd());
+ double[][] diffs = MovingAverage.weighted(oldData.getDifferencesData(), radius);
+ double[][] heights1 = MovingAverage.weighted(oldData.getHeights1Data(), radius);
+ double[][] heights2 = MovingAverage.weighted(oldData.getHeights2Data(), radius);
+ double[][] morph = oldData.getMorphWidthData();
+ double[][] year = MovingAverage.weighted(oldData.getHeightPerYearData(), radius);
+ for(int j = 0; j < diffs[0].length; j++) {
+ newData.addKm(diffs[0][j]);
+ newData.addBedHeights(year[1][j]);
+ newData.addMorphWidth(morph[1][j]);
+ newData.addDifference(diffs[1][j]);
+ newData.addHeight1(heights1[1][j]);
+ newData.addHeight2(heights2[1][j]);
+ }
+ return newData;
+ }
+ return data != null && data.length > index ? data[index] : null;
+ }
+
+ /** Copy deeply. */
+ @Override
+ public Facet deepCopy() {
+ BedDiffYearFilterFacet copy = new BedDiffYearFilterFacet();
+ copy.set(this);
+ copy.type = type;
+ copy.hash = hash;
+ copy.stateId = stateId;
+ return copy;
+ }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
More information about the Dive4elements-commits
mailing list