[PATCH] Suggestion: Load official epochs via recommendations instead of a pseudo-calculation
Wald Commits
scm-commit at wald.intevation.org
Tue Sep 9 10:54:00 CEST 2014
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1410252830 -7200
# Node ID a65afd85d516d485f127a99af7976accd7257183
# Parent 61fd22f65bd459b99ea2e142e31cf55db85d8dfc
Suggestion: Load official epochs via recommendations instead of a pseudo-calculation.
diff -r 61fd22f65bd4 -r a65afd85d516 artifacts/doc/conf/meta-data.xml
--- a/artifacts/doc/conf/meta-data.xml Mon Sep 08 19:48:17 2014 +0200
+++ b/artifacts/doc/conf/meta-data.xml Tue Sep 09 10:53:50 2014 +0200
@@ -115,6 +115,7 @@
</dc:when>
<dc:when test="$out = 'sedimentload_ls'">
<dc:call-macro name="annotations"/>
+ <dc:call-macro name="sedimentload_off_epochs"/>
</dc:when>
<dc:when test="$out = 'bed_longitudinal_section'">
<dc:call-macro name="annotations"/>
@@ -1441,7 +1442,7 @@
</dc:choose>
<dc:if test="$kind = 'official'">
<dc:variable name="info" type="string"
- expr="concat('Amtliche Epoche<BR>', $info)"/>
+ expr="concat('Amtliche Epoche<BR>', dc:get('info'))"/>
</dc:if>
<dc:macro-body/>
</dc:for-each>
@@ -3073,6 +3074,85 @@
</dc:if>
</dc:macro>
+
+ <dc:macro name="sedimentload_off_epoch_filter">
+ <dc:if test="dc:has-result()">
+ <dc:if test="string-length(dc:get('epochs')) > 0">
+ <dc:variable name="start" type="number"
+ expr="dc:min-number(dc:find-all('\d{4}', $epochs))"/>
+ <dc:variable name="end" type="number"
+ expr="dc:max-number(dc:find-all('\d{4}', $epochs))"/>
+ </dc:if>
+ <dc:filter expr="not(number($end) <
+ number(dc:date-format('yyyy', $startyear))
+ or number($start) >
+ number(dc:date-format('yyyy', $endyear)))">
+ <dc:macro-body/>
+ </dc:filter>
+ </dc:if>
+ </dc:macro>
+
+ <dc:macro name="sedimentload_off_epochs">
+ <dc:variable name="sq_time_id" type="number" expr="number($sq_ti_id)"/>
+ <dc:context>
+ <dc:comment> data at measurement stations </dc:comment>
+ <dc:statement>
+ SELECT DISTINCT
+ sl.id AS slid,
+ slk.kind AS kind,
+ ti.start_time AS startyear,
+ ti.stop_time AS endyear,
+ gf.name AS fraction
+ FROM sediment_load sl
+ JOIN sediment_load_kinds slk ON slk.id = sl.kind
+ 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 ms.river_id = r.id
+ JOIN time_intervals ti ON sl.time_interval_id = ti.id
+ JOIN grain_fraction gf ON gf.id = sl.grain_fraction_id
+ WHERE r.id = ${river_id}
+ AND sq_time_interval_id = ${sq_time_id}
+ AND ms.station BETWEEN ${fromkm} AND ${tokm}
+ AND slk.kind = 'official'
+ </dc:statement>
+ <dc:call-macro name="sedimentload_off_epoch_filter">
+ <dc:call-macro name="loads">
+ <dc:call-macro name="load"/>
+ </dc:call-macro>
+ </dc:call-macro>
+ </dc:context>
+ <dc:context>
+ <dc:comment> longitudinal sections </dc:comment>
+ <dc:statement>
+ SELECT DISTINCT
+ sl.id AS slid,
+ slk.kind AS kind,
+ ti.start_time AS startyear,
+ ti.stop_time AS endyear,
+ sq_time_interval_id AS sqid,
+ gf.name AS fraction
+ FROM sediment_load_ls sl
+ JOIN sediment_load_kinds slk ON slk.id = sl.kind
+ JOIN rivers r ON sl.river_id = r.id
+ JOIN sediment_load_ls_values slv
+ ON sl.id = slv.sediment_load_ls_id
+ JOIN time_intervals ti ON sl.time_interval_id = ti.id
+ JOIN grain_fraction gf ON gf.id = sl.grain_fraction_id
+ WHERE r.id = ${river_id}
+ AND sq_time_interval_id = ${sq_time_id}
+ AND slv.station BETWEEN ${fromkm} AND ${tokm}
+ AND slk.kind = 'official'
+ </dc:statement>
+ <dc:call-macro name="sedimentload_off_epoch_filter">
+ <dc:call-macro name="loads">
+ <dc:call-macro name="load_ls"/>
+ </dc:call-macro>
+ </dc:call-macro>
+ </dc:context>
+ </dc:macro>
+
<!-- Common stuff -->
<dc:macro name="km-filtered-wsts">
diff -r 61fd22f65bd4 -r a65afd85d516 artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/YearEpochSelect.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/YearEpochSelect.java Mon Sep 08 19:48:17 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/YearEpochSelect.java Tue Sep 09 10:53:50 2014 +0200
@@ -43,6 +43,8 @@
{
CallMeta meta = context.getMeta();
Element[] elements;
+
+ /* Disable calculation of official epochs
if (((D4EArtifact)artifact).getCurrentStateId()
.equals("state.minfo.sediment.load.year_epoch")
) {
@@ -57,7 +59,8 @@
}
else {
elements = new Element[2];
- }
+ } */
+ elements = new Element[2];
elements[0] = createItem(
ec,
new String[] {
More information about the Dive4Elements-commits
mailing list