[PATCH 2 of 4] issue1391: Unify datacage elements in discharge curve outs and add historical discharges

Wald Commits scm-commit at wald.intevation.org
Mon Jul 29 12:20:24 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1375092972 -7200
# Node ID f41ba63e7a434329b64d698ecb157f9d43d89ace
# Parent  0b0325d1ab7f4f01bf09e70a831af948e9aaebad
issue1391: Unify datacage elements in discharge curve outs and add historical discharges

diff -r 0b0325d1ab7f -r f41ba63e7a43 artifacts/doc/conf/meta-data.xml
--- a/artifacts/doc/conf/meta-data.xml	Mon Jul 29 12:14:51 2013 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Mon Jul 29 12:16:12 2013 +0200
@@ -146,8 +146,29 @@
                   <dc:when test="$out = 'discharge_longitudinal_section'">
                     <dc:call-macro name="longitudinal-section-prototype"/>
                   </dc:when>
+                  <dc:when test="$out = 'historical_discharge_wq'">
+                    <dc:call-macro name="historical-discharge-curve"/>
+                    <dc:call-macro name="discharge_table_gauge"/>
+                    <dc:call-macro name="basedata_2_fixations_wqkms"/>
+                    <dc:call-macro name="basedata_5_flood-protections"/>
+                    <dc:call-macro name="basedata_0"/>
+                    <dc:call-macro name="basedata_1_additionals"/>
+                    <dc:call-macro name="basedata_4_heightmarks-points"/>
+                    <computed_discharge_curve>
+                      <dc:call-macro name="mainvalues"/>
+                    </computed_discharge_curve>
+                  </dc:when>
                   <dc:when test="$out = 'discharge_curve'">
-                    <dc:call-macro name="mainvalues"/>
+                    <dc:call-macro name="historical-discharge-curve"/>
+                    <dc:call-macro name="discharge_table_gauge"/>
+                    <dc:call-macro name="basedata_2_fixations_wqkms"/>
+                    <dc:call-macro name="basedata_5_flood-protections"/>
+                    <dc:call-macro name="basedata_0"/>
+                    <dc:call-macro name="basedata_1_additionals"/>
+                    <dc:call-macro name="basedata_4_heightmarks-points"/>
+                    <computed_discharge_curve>
+                      <dc:call-macro name="mainvalues"/>
+                    </computed_discharge_curve>
                   </dc:when>
                   <dc:when test="$out = 'duration_curve'">
                     <dc:call-macro name="mainvalues"/>
@@ -256,6 +277,7 @@
                     </dc:choose>
                   </dc:when>
                   <dc:when test="$out = 'computed_discharge_curve'">
+                    <dc:call-macro name="historical-discharge-curve"/>
                     <dc:call-macro name="discharge_table_gauge"/>
                     <dc:call-macro name="basedata_2_fixations_wqkms"/>
                     <dc:call-macro name="basedata_5_flood-protections"/>
@@ -356,6 +378,7 @@
                       <dc:call-macro name="fix-derivate-curve"/>
                     </dc:when>
                     <dc:when test="$out = 'fix_wq_curve'">
+                      <dc:call-macro name="historical-discharge-curve"/>
                       <dc:call-macro name="fix-wq-curve"/>
                       <dc:call-macro name="waterlevels-fix"/>
                     </dc:when>
@@ -460,6 +483,46 @@
       </dc:filter>
     </dc:macro>
 
+
+    <dc:macro name="historical-discharge-curve">
+      <dc:context>
+        <dc:statement>
+          SELECT g.id   AS gauge_id,
+                 g.name AS gauge_name,
+                 dt.id AS dt_id,
+                 t.start_time AS start_time,
+                 t.stop_time AS stop_time,
+                 dt.description AS desc,
+                 dt.bfg_id AS bfg_id
+          FROM gauges g
+          JOIN discharge_tables dt ON g.id = dt.gauge_id
+          LEFT JOIN time_intervals t ON dt.time_interval_id = t.id
+          LEFT JOIN ranges r ON g.range_id = r.id
+          WHERE g.river_id = ${river_id}
+          AND dt.kind <> 0
+          AND NOT((${tokm} < r.a) or (${fromkm} > r.b))
+          ORDER BY start_time
+        </dc:statement>
+        <dc:if test="dc:has-result()">
+          <historical_discharge_curves>
+            <dc:group expr="$gauge_name">
+              <dc:for-each>
+                <dc:variable name="combined_desc" expr="concat($bfg_id, ' ', dc:date-format('dd.MM.yyyy', $start_time), ' - ', dc:date-format('dd.MM.yyyy', $stop_time))"/>
+                <dc:message>
+                  Hallo ANDRE23 {dc:dump-variables()}
+                </dc:message>
+                <histdis name="{$combined_desc}"
+                  description="{$combined_desc}"
+                  factory="gaugedischarge" target_out="{$out}"
+                  ids="{$gauge_name};{$dt_id};{$combined_desc}"/>
+              </dc:for-each>
+            </dc:group>
+          </historical_discharge_curves>
+        </dc:if>
+      </dc:context>
+    </dc:macro>
+
+
     <dc:macro name="computed-discharge-curve">
       <dc:filter expr="$facet_name = 'computed_discharge_curve.q'">
         <dc:if test="dc:has-result()">


More information about the Dive4elements-commits mailing list