changeset 8461:2b4191f78ea6

Load discharge curves via recommendations in historical discharge calculation. ToDo: Remove the other logic to load them.
author Tom Gottfried <tom@intevation.de>
date Thu, 30 Oct 2014 14:20:28 +0100
parents 081a57c80540
children 1127dbe95083
files artifacts/doc/conf/meta-data.xml
diffstat 1 files changed, 39 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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))
+                           &lt; $stop and
+                         number(dc:date-format('yyyyMMdd', $stop_time))
+                           &gt; $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>

http://dive4elements.wald.intevation.org