[PATCH] Load discharge curves via recommendations in historical discharge calculation. ToDo: Remove the other logic to load them

Wald Commits scm-commit at wald.intevation.org
Thu Oct 30 14:20:31 CET 2014


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1414675228 -3600
# Node ID 2b4191f78ea64874a8f43898ae36b4737cc9fe66
# Parent  081a57c8054037a247bd3366cf200b485f7faf55
Load discharge curves via recommendations in historical discharge calculation. ToDo: Remove the other logic to load them.

diff -r 081a57c80540 -r 2b4191f78ea6 artifacts/doc/conf/meta-data.xml
--- a/artifacts/doc/conf/meta-data.xml	Thu Oct 30 14:17:49 2014 +0100
+++ b/artifacts/doc/conf/meta-data.xml	Thu Oct 30 14:20:28 2014 +0100
@@ -76,6 +76,7 @@
                   </dc:when>
                   <dc:comment> Discharge curves </dc:comment>
                   <dc:when test="$out = 'historical_discharge_wq'">
+                    <dc:call-macro name="hist_discharge_rec"/>
                     <dc:call-macro name="mainvalues"/>
                   </dc:when>
                   <dc:when test="$out = 'discharge_curve'">
@@ -1018,6 +1019,43 @@
       <dc:call-macro name="qmainvalues"/>
     </dc:macro>
 
+    <!-- discharge curves -->
+    <dc:macro name="hist_discharge_factory">
+      <dc:for-each>
+        <dc:variable name="validity"
+                     expr="concat(
+                           dc:date-format('dd.MM.yyyy', $start_time),
+                           ' - ',
+                           dc:date-format('dd.MM.yyyy', $stop_time))"/>
+        <histdis name="{concat($bfg_id, ' ', $validity)}"
+                 description="{concat($bfg_id, ' ', $validity)}"
+                 factory="gaugedischarge" target_out="{$out}"
+                 ids="{$gauge_name};{$dt_id};{concat($bfg_id, ' ',
+                      $gauge_name, ' ', $validity)}"/>
+      </dc:for-each>
+    </dc:macro>
+
+    <dc:macro name="hist_discharge_rec">
+      <dc:variable name="start" type="number"
+                   expr="dc:date-format('yyyyMMdd',
+                           number(substring-before($year_range, ';')))"/>
+      <dc:variable name="stop" type="number"
+                   expr="dc:date-format('yyyyMMdd',
+                           number(substring-after($year_range, ';')))"/>
+      <dc:variable name="refgauge" type="number"
+                   expr="dc:get('reference_gauge')"/>
+      <dc:context>
+        <dc:call-macro name="discharge_curves"/>
+        <dc:filter expr="$kind = 1 and
+                         number(dc:date-format('yyyyMMdd', $start_time))
+                           < $stop and
+                         number(dc:date-format('yyyyMMdd', $stop_time))
+                           > $start">
+          <dc:call-macro name="hist_discharge_factory"/>
+        </dc:filter>
+      </dc:context>
+    </dc:macro>
+
     <dc:macro name="discharge_table_gauge">
       <dc:variable name="refgauge" type="number"
                    expr="dc:get('reference_gauge')"/>
@@ -1045,18 +1083,7 @@
           <historical_discharge_curves>
             <dc:group expr="$gauge_name">
               <gauge name="{dc:group-key()}">
-                <dc:for-each>
-                  <dc:variable name="validity"
-                               expr="concat(
-                                     dc:date-format('dd.MM.yyyy', $start_time),
-                                     ' - ',
-                                     dc:date-format('dd.MM.yyyy', $stop_time))"/>
-                  <histdis name="{concat($bfg_id, ' ', $validity)}"
-                           description="{concat($bfg_id, ' ', $validity)}"
-                           factory="gaugedischarge" target_out="{$out}"
-                           ids="{$gauge_name};{$dt_id};{concat($bfg_id, ' ',
-                                  $gauge_name, ' ', $validity)}"/>
-                </dc:for-each>
+                <dc:call-macro name="hist_discharge_factory"/>
               </gauge>
             </dc:group>
           </historical_discharge_curves>


More information about the Dive4Elements-commits mailing list