annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensityFacet.java @ 8587:07c9ac22f611

(issue1755) Generalise BedQuality result handling The bedquality calculation now produces a result for each time period which has BedQualityResultValues for each specific result type. Formally this was split up in density, porosity and diameter classes with some bedload diameter classes mixed in for extra fun. The intent of this commit is to allow more shared code and generic access patterns to the BedQuality results.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 18 Mar 2015 18:42:08 +0100
parents e4606eae8ea5
children 0a5239a1e46e
rev   line source
7199
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 *
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6 * documentation coming with Dive4Elements River for details.
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 */
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 package org.dive4elements.river.artifacts.model.minfo;
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import org.dive4elements.artifactdatabase.state.Facet;
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import org.dive4elements.artifacts.Artifact;
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import org.dive4elements.artifacts.CallContext;
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import org.dive4elements.river.artifacts.D4EArtifact;
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import org.dive4elements.river.artifacts.model.DataFacet;
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 import org.apache.log4j.Logger;
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 /** Facet to access sediment density values measured in one year. */
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 public class SedimentDensityFacet
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 extends DataFacet
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7894
diff changeset
29 /** Very own log. */
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7894
diff changeset
30 private static Logger log = Logger.getLogger(SedimentDensityFacet.class);
7199
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 /** Used as tolerance value when fetching measurement stations. */
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 private static double EPSILON = 1e-5;
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 public SedimentDensityFacet() {
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 }
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 public SedimentDensityFacet(int idx, String name, String description,
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 ComputeType type, String stateId, String hash) {
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 super(idx, name, description, type, hash, stateId);
7894
42076d94977e Added metadata to facets.
Raimund Renkert <rrenkert@intevation.de>
parents: 7206
diff changeset
42 this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
42076d94977e Added metadata to facets.
Raimund Renkert <rrenkert@intevation.de>
parents: 7206
diff changeset
43 this.metaData.put("Y", "chart.yaxis.label.sedimentdensity");
7199
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 }
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 @Override
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 public Object getData(Artifact artifact, CallContext context) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7894
diff changeset
48 log.debug("Get data for sediment density at index: " + index);
7199
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 D4EArtifact flys = (D4EArtifact) artifact;
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51
7206
cb3965dbf22e issue1435: SedimentDensityFacet: Access sediment density data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7205
diff changeset
52 SedimentDensity res = (SedimentDensity) flys.compute(context, hash,
7199
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 stateId, type, false);
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 if (res == null) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7894
diff changeset
56 log.error("No SedimentDensity");
7199
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 }
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58
7206
cb3965dbf22e issue1435: SedimentDensityFacet: Access sediment density data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7205
diff changeset
59 return res;
7199
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 }
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 /** Copy deeply. */
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 @Override
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 public Facet deepCopy() {
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 SedimentDensityFacet copy = new SedimentDensityFacet();
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67 copy.set(this);
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 copy.type = type;
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 copy.hash = hash;
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 copy.stateId = stateId;
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 return copy;
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 }
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 }
baf04164fcc6 issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org