changeset 4372:19772b414d46

New facet and result set for sediment load. * Added new facet and updated sediment load config and facet types. * Added new result set for sediment load.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 02 Nov 2012 14:53:51 +0100
parents 26afee1b8959
children 1fb224bb2c6b
files flys-artifacts/doc/conf/artifacts/minfo.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadFraction.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadResult.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadCalculate.java
diffstat 6 files changed, 724 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/artifacts/minfo.xml	Fri Nov 02 14:49:20 2012 +0100
+++ b/flys-artifacts/doc/conf/artifacts/minfo.xml	Fri Nov 02 14:53:51 2012 +0100
@@ -355,8 +355,8 @@
         </transition>
 
         <state id="state.minfo.sediment.load.period" description="state.minfo.bed.period" state="de.intevation.flys.artifacts.states.minfo.SedimentLoadYearSelect">
-            <data name="start" type="Long"/>
-            <data name="end" type="Long"/>
+            <data name="start" type="Integer"/>
+            <data name="end" type="Integer"/>
         </state>
 
         <state id="state.minfo.sediment.load.epochs" description="state.minfo.bed.epochs" state="de.intevation.flys.artifacts.states.minfo.SedimentLoadEpochSelect">
@@ -393,8 +393,15 @@
 
         <state id="state.minfo.sediment.load.calculate" description="state.minfo.sediment.load.calculate" state="de.intevation.flys.artifacts.states.minfo.SedimentLoadCalculate">
             <outputmodes>
-                <outputmode name="dummy" description="output.dummy" mime-type="image/png" type="chart">
+                <outputmode name="sedimentload_ls" description="output.sedimentload.ls" mime-type="image/png" type="chart">
                     <facets>
+                        <facet name="sedimentload.coarse"/>
+                        <facet name="sedimentload.sand"/>
+                        <facet name="sedimentload.finemiddle"/>
+                        <facet name="sedimentload.susp_sand"/>
+                        <facet name="sedimentload.susp_sand_bed"/>
+                        <facet name="sedimentload.susp_sediment"/>
+                        <facet name="sedimentload.total"/>
                     </facets>
                 </outputmode>
             </outputmodes>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Fri Nov 02 14:49:20 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Fri Nov 02 14:53:51 2012 +0100
@@ -251,6 +251,14 @@
     String BED_DIFFERENCE_EPOCH_HEIGHT1 = "bedheight_difference.epoch.height1";
     String BED_DIFFERENCE_EPOCH_HEIGHT2 = "bedheight_difference.epoch.height2";
 
+    String SEDIMENT_LOAD_COARSE        = "sedimentload.coarse";
+    String SEDIMENT_LOAD_SAND          = "sedimentload.sand";
+    String SEDIMENT_LOAD_FINEMIDDLE    = "sedimentload.finemiddle";
+    String SEDIMENT_LOAD_SUSP_SAND     = "sedimentload.susp_sand";
+    String SEDIMENT_LOAD_SUSP_SAND_BED = "sedimentload.susp_sand_bed";
+    String SEDIMENT_LOAD_SUSP_SEDIMENT = "sedimentload.susp_sediment";
+    String SEDIMENT_LOAD_TOTAL         = "sediemntload.total";
+
     String SQ_OVERVIEW       = "sq_overview";
 
     String SQ_A_CURVE       = "sq_a_curve";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadFacet.java	Fri Nov 02 14:53:51 2012 +0100
@@ -0,0 +1,52 @@
+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.model.CalculationResult;
+import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
+
+
+public class SedimentLoadFacet
+extends DataFacet
+{
+    private static Logger logger = Logger.getLogger(SedimentLoadFacet.class);
+
+    public SedimentLoadFacet() {
+    }
+
+    public SedimentLoadFacet(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 sediment load at index: " + index);
+
+        FLYSArtifact flys = (FLYSArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        Object[] data =
+            (SedimentLoadResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+
+        return data != null && data.length > index ? data[index] : null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        SedimentLoadFacet copy = new SedimentLoadFacet();
+        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 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadFraction.java	Fri Nov 02 14:53:51 2012 +0100
@@ -0,0 +1,81 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import de.intevation.flys.artifacts.model.NamedObjectImpl;
+
+
+public class SedimentLoadFraction
+extends NamedObjectImpl
+{
+    double sand;
+    double fine_middle;
+    double coarse;
+    double susp_sand;
+    double susp_sand_bed;
+    double susp_sediment;
+    double total;
+
+    public SedimentLoadFraction() {
+        sand = 0d;
+        fine_middle = 0d;
+        coarse = 0d;
+        susp_sand = 0d;
+        susp_sand_bed = 0d;
+        susp_sediment = 0d;
+    }
+
+    public double getSand() {
+        return sand;
+    }
+
+    public void setSand(double sand) {
+        this.sand = sand;
+    }
+
+    public double getFine_middle() {
+        return fine_middle;
+    }
+
+    public void setFine_middle(double fine_middle) {
+        this.fine_middle = fine_middle;
+    }
+
+    public double getCoarse() {
+        return coarse;
+    }
+
+    public void setCoarse(double coarse) {
+        this.coarse = coarse;
+    }
+
+    public double getSusp_sand() {
+        return susp_sand;
+    }
+
+    public void setSusp_sand(double susp_sand) {
+        this.susp_sand = susp_sand;
+    }
+
+    public double getSusp_sand_bed() {
+        return susp_sand_bed;
+    }
+
+    public void setSusp_sand_bed(double susp_sand_bed) {
+        this.susp_sand_bed = susp_sand_bed;
+    }
+
+    public double getSusp_sediment() {
+        return susp_sediment;
+    }
+
+    public void setSusp_sediment(double susp_sediment) {
+        this.susp_sediment = susp_sediment;
+    }
+
+    public double getTotal() {
+        return total;
+    }
+
+    public void setTotal(double total) {
+        this.total = total;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadResult.java	Fri Nov 02 14:53:51 2012 +0100
@@ -0,0 +1,183 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import gnu.trove.TDoubleArrayList;
+
+import java.io.Serializable;
+import java.util.Set;
+
+public class SedimentLoadResult
+implements Serializable
+{
+    protected int startYear;
+    protected int endYear;
+    protected SedimentLoad load;
+
+    public SedimentLoadResult() {
+    }
+
+    public SedimentLoadResult(
+        int startYear,
+        int endYear,
+        SedimentLoad load
+    ) {
+        this.startYear = startYear;
+        this.endYear = endYear;
+        this.load = load;
+    }
+
+    public int getStartYear() {
+        return this.startYear;
+    }
+
+    public void setStartYear(int year) {
+        this.startYear = year;
+    }
+
+    public int getEndYear() {
+        return this.endYear;
+    }
+
+    public void setEndYear(int year) {
+        this.endYear = year;
+    }
+
+    public double[][] getTotalData () {
+        Set<Double> kms = this.load.getKms();
+        TDoubleArrayList k = new TDoubleArrayList();
+        TDoubleArrayList total = new TDoubleArrayList();
+        for (double km : kms) {
+            if (load.getFraction(km).getTotal() > 0d) {
+                k.add(km);
+                total.add(load.getFraction(km).getTotal());
+            }
+        }
+        return new double [][] {
+            k.toNativeArray(),
+            total.toNativeArray()
+        };
+    }
+
+    public double[][] getSandData() {
+        Set<Double> kms = this.load.getKms();
+        TDoubleArrayList k = new TDoubleArrayList();
+        TDoubleArrayList sand = new TDoubleArrayList();
+        for(double km : kms) {
+            if (load.getFraction(km).getSand() > 0d) {
+                k.add(km);
+                sand.add(load.getFraction(km).getSand());
+            }
+        }
+        return new double [][] {
+            k.toNativeArray(),
+            sand.toNativeArray()
+        };
+    }
+
+    public double[][] getFineMiddleData() {
+        Set<Double> kms = this.load.getKms();
+        TDoubleArrayList k = new TDoubleArrayList();
+        TDoubleArrayList fm = new TDoubleArrayList();
+        for (double km : kms) {
+            if (load.getFraction(km).getFine_middle() > 0d) {
+                k.add(km);
+                fm.add(load.getFraction(km).getFine_middle());
+            }
+        }
+        return new double [][] {
+            k.toNativeArray(),
+            fm.toNativeArray()
+        };
+    }
+
+    public double[][] getCoarseData() {
+        Set<Double> kms = this.load.getKms();
+        TDoubleArrayList k = new TDoubleArrayList();
+        TDoubleArrayList coarse = new TDoubleArrayList();
+        for (double km : kms) {
+            if (load.getFraction(km).getCoarse() > 0d) {
+                k.add(km);
+                coarse.add(load.getFraction(km).getCoarse());
+            }
+        }
+        return new double [][] {
+            k.toNativeArray(),
+            coarse.toNativeArray()
+        };
+    }
+
+    public double[][] getSuspSandData() {
+        Set<Double> kms = this.load.getKms();
+        TDoubleArrayList k = new TDoubleArrayList();
+        TDoubleArrayList ss = new TDoubleArrayList();
+        for (double km : kms) {
+            if (load.getFraction(km).getSusp_sand() > 0d) {
+                k.add(km);
+                ss.add(load.getFraction(km).getSusp_sand());
+            }
+        }
+        return new double [][] {
+            k.toNativeArray(),
+            ss.toNativeArray()
+        };
+    }
+
+    public double[][] getSuspSandBedData() {
+        Set<Double> kms = this.load.getKms();
+        TDoubleArrayList k = new TDoubleArrayList();
+        TDoubleArrayList ss = new TDoubleArrayList();
+        for (double km : kms) {
+            if (load.getFraction(km).getSusp_sand_bed() > 0d) {
+                k.add(km);
+                ss.add(load.getFraction(km).getSusp_sand_bed());
+            }
+        }
+        return new double [][] {
+            k.toNativeArray(),
+            ss.toNativeArray()
+        };
+    }
+
+    public double[][] getSuspSedimentData() {
+        Set<Double> kms = this.load.getKms();
+        TDoubleArrayList k = new TDoubleArrayList();
+        TDoubleArrayList ss = new TDoubleArrayList();
+        for (double km : kms) {
+            if (load.getFraction(km).getSusp_sediment() > 0d) {
+                k.add(km);
+                ss.add(load.getFraction(km).getSusp_sediment());
+            }
+        }
+        return new double [][] {
+            k.toNativeArray(),
+            ss.toNativeArray()
+        };
+    }
+
+    public boolean hasCoarseData() {
+        return getCoarseData().length > 0;
+    }
+
+    public boolean hasFineMiddleData() {
+        return getFineMiddleData().length > 0;
+    }
+
+    public boolean hasSandData() {
+        return getSandData().length > 0;
+    }
+
+    public boolean hasSuspSandData() {
+        return getSuspSandData().length > 0;
+    }
+
+    public boolean hasSuspSandBedData() {
+        return getSuspSandBedData().length > 0;
+    }
+
+    public boolean hasSuspSedimentData() {
+        return getSuspSedimentData().length > 0;
+    }
+
+    public boolean hasTotalData() {
+        return getTotalData().length > 0;
+    }
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadCalculate.java	Fri Nov 02 14:49:20 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadCalculate.java	Fri Nov 02 14:53:51 2012 +0100
@@ -1,6 +1,22 @@
 package de.intevation.flys.artifacts.states.minfo;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.SedimentLoadAccess;
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.DataFacet;
 import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.minfo.SedimentLoadCalculation;
+import de.intevation.flys.artifacts.model.minfo.SedimentLoadFacet;
+import de.intevation.flys.artifacts.model.minfo.SedimentLoadResult;
+import de.intevation.flys.artifacts.resources.Resources;
 import de.intevation.flys.artifacts.states.DefaultState;
 
 
@@ -9,4 +25,378 @@
 implements FacetTypes 
 {
 
+    private static final long serialVersionUID = 1L;
+
+    private static final Logger logger = Logger
+        .getLogger(SedimentLoadCalculate.class);
+
+    public static final String I18N_FACET_SEDIMENTLOAD_COARSE = "facet.sedimentload.coarse";
+    public static final String I18N_FACET_SEDIMENTLOAD_SAND = "facet.sedimentload.sand";
+    public static final String I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE = "facet.sedimentload.fine_middle";
+    public static final String I18N_FACET_SEDIMENTLOAD_SUSPSAND = "facet.sedimentload.susp_sand";
+    public static final String I18N_FACET_SEDIMENTLOAD_SUSPSANDBED = "facet.sediemntload.susp_sand_bed";
+    public static final String I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT = "facet.sedimentload.susp_sediment";
+    public static final String I18N_FACET_SEDIMENTLOAD_TOTAL = "facet.sedimentload.total";
+
+    @Override
+    public Object computeAdvance(FLYSArtifact artifact, String hash,
+        CallContext context, List<Facet> facets, Object old) {
+        logger.debug("SedimentLoadCalculate.computeAdvance");
+
+        List<Facet> newFacets = new ArrayList<Facet>();
+
+        SedimentLoadAccess access = new SedimentLoadAccess(artifact);
+
+        CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old
+            : new SedimentLoadCalculation().calculate(access);
+
+        if (facets == null || res == null) {
+            return res;
+        }
+
+        SedimentLoadResult[] results = (SedimentLoadResult[]) res.getData();
+
+        if (results == null || results.length == 0) {
+            logger.warn("Calculation computed no results!");
+            return res;
+        }
+
+        String type = access.getYearEpoch();
+        if (type.equals("year")) {
+            generateYearFacets(context, newFacets, results, getID(), hash);
+        }
+        else if (type.equals("epoch")) {
+            generateEpochFacets(context, newFacets, results, getID(), hash);
+        }
+        else if (type.equals("off_epoch")) {
+            generateOffEpochFacets(context, newFacets, results, getID(), hash);
+        }
+        logger.debug("Created " + newFacets.size() + " new Facets.");
+
+        facets.addAll(newFacets);
+
+        return res;
+    }
+
+    protected void generateYearFacets(CallContext context, List<Facet> newFacets,
+        SedimentLoadResult[] results, String stateId, String hash) {
+        logger.debug("SedimentLoadCalculate.generateFacets");
+
+        CallMeta meta = context.getMeta();
+
+//      newFacets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id));
+        for (int idx = 0; idx < results.length; idx++) {
+            SedimentLoadResult res = results[idx];
+            if (res.hasCoarseData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_COARSE,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_COARSE,
+                        I18N_FACET_SEDIMENTLOAD_COARSE) +
+                        " - " + res.getStartYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasSandData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_SAND,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_SAND,
+                        I18N_FACET_SEDIMENTLOAD_SAND) +
+                        " - " + res.getStartYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasFineMiddleData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_FINEMIDDLE,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE,
+                        I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE) +
+                        " - " + res.getStartYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasSuspSandData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_SUSP_SAND,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSAND,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSAND)
+                        + " - " + res.getStartYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasSuspSandBedData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_SUSP_SAND_BED,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSANDBED,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSANDBED) +
+                        " - " + res.getStartYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasSuspSedimentData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_SUSP_SEDIMENT,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT) +
+                        " - " + res.getStartYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+
+            }
+            if (res.hasTotalData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_TOTAL,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_TOTAL,
+                        I18N_FACET_SEDIMENTLOAD_TOTAL) +
+                        " - " + res.getStartYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+        }
+    }
+
+    protected void generateEpochFacets(
+        CallContext context,
+        List<Facet> newFacets,
+        SedimentLoadResult[] results,
+        String stateId,
+        String hash
+    ) {
+        logger.debug("SedimentLoadCalculate.generateEpochFacets");
+
+        CallMeta meta = context.getMeta();
+
+//      newFacets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id));
+        for (int idx = 0; idx < results.length; idx++) {
+            SedimentLoadResult res = results[idx];
+            if (res.hasCoarseData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_COARSE,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_COARSE,
+                        I18N_FACET_SEDIMENTLOAD_COARSE) +
+                        " - " + res.getStartYear() + "-" + res.getEndYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasSandData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_SAND,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_SAND,
+                        I18N_FACET_SEDIMENTLOAD_SAND) +
+                        " - " + res.getStartYear() + "-" + res.getEndYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasFineMiddleData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_FINEMIDDLE,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE,
+                        I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE) +
+                        " - " + res.getStartYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasSuspSandData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_SUSP_SAND,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSAND,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSAND)
+                        + " - " + res.getStartYear() + "-" + res.getEndYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasSuspSandBedData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_SUSP_SAND_BED,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSANDBED,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSANDBED) +
+                        " - " + res.getStartYear() + "-" + res.getEndYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasSuspSedimentData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_SUSP_SEDIMENT,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT) +
+                        " - " + res.getStartYear() + "-" + res.getEndYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+
+            }
+            if (res.hasTotalData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_TOTAL,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_TOTAL,
+                        I18N_FACET_SEDIMENTLOAD_TOTAL) +
+                        " - " + res.getStartYear() + "-" + res.getEndYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+        }
+    }
+
+    protected void generateOffEpochFacets(
+        CallContext context,
+        List<Facet> newFacets,
+        SedimentLoadResult[] results,
+        String stateId,
+        String hash
+    ) {
+        logger.debug("SedimentLoadCalculate.generateOffEpochFacets");
+
+        CallMeta meta = context.getMeta();
+
+//      newFacets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id));
+        for (int idx = 0; idx < results.length; idx++) {
+            SedimentLoadResult res = results[idx];
+            if (res.hasCoarseData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_COARSE,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_COARSE,
+                        I18N_FACET_SEDIMENTLOAD_COARSE) +
+                        " - " + res.getStartYear() + "-" + res.getEndYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasSandData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_SAND,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_SAND,
+                        I18N_FACET_SEDIMENTLOAD_SAND) +
+                        " - " + res.getStartYear() + "-" + res.getEndYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasFineMiddleData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_FINEMIDDLE,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE,
+                        I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE) +
+                        " - " + res.getStartYear() + "-" + res.getEndYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasSuspSandData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_SUSP_SAND,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSAND,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSAND) +
+                        " - " + res.getStartYear() + "-" + res.getEndYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasSuspSandBedData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_SUSP_SAND_BED,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSANDBED,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSANDBED) +
+                        " - " + res.getStartYear() + "-" + res.getEndYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (res.hasSuspSedimentData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_SUSP_SEDIMENT,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT,
+                        I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT) +
+                        " - " + res.getStartYear() + "-" + res.getEndYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+
+            }
+            if (res.hasTotalData()) {
+                newFacets.add(new SedimentLoadFacet(
+                    idx,
+                    SEDIMENT_LOAD_TOTAL,
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_SEDIMENTLOAD_TOTAL,
+                        I18N_FACET_SEDIMENTLOAD_TOTAL) +
+                        " - " + res.getStartYear() + "-" + res.getEndYear(),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+        }
+    }
 }

http://dive4elements.wald.intevation.org