diff artifacts/doc/conf/meta-data.xml @ 8314:5294660df81b

merged.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 24 Sep 2014 12:02:37 +0200
parents b5e63ad6d307
children 1e4e5ff44aa9
line wrap: on
line diff
--- a/artifacts/doc/conf/meta-data.xml	Wed Sep 24 12:02:05 2014 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Wed Sep 24 12:02:37 2014 +0200
@@ -84,7 +84,7 @@
                   <dc:when test="$out = 'computed_discharge_curve'">
                     <dc:call-macro name="mainvalues"/>
                     <dc:call-macro name="basedata_3_officials_wq"/>
-                    <dc:call-macro name="basedata_2_fixations_wqkms"/>
+                    <dc:call-macro name="basedata_2_fixations_wq"/>
                   </dc:when>
                   <dc:when test="$out = 'fix_wq_curve'">
                     <dc:call-macro name="mainvalues"/>
@@ -182,35 +182,19 @@
                   <dc:comment> Discharge curves </dc:comment>
                   <dc:when test="$out = 'historical_discharge_wq'">
                     <dc:call-macro name="discharge-curve-prototype"/>
-                    <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="discharge-prototype"/>
-                    <computed_discharge_curve>
-                      <dc:call-macro name="mainvalues"/>
-                    </computed_discharge_curve>
+                    <dc:call-macro name="discharge-curve-prototype"/>
                   </dc:when>
                   <dc:when test="$out = 'fix_wq_curve'">
-                    <dc:call-macro name="discharge-prototype"/>
+                    <dc:call-macro name="discharge-curve-prototype"/>
                   </dc:when>
                   <dc:when test="$out = 'computed_discharge_curve'">
                     <dc:call-macro name="discharge-curve-prototype"/>
-                    <dc:call-macro name="basedata_0_wq"/>
-                    <dc:call-macro name="basedata_1_additionals_wq"/>
-                    <dc:call-macro name="basedata_5_flood-protections"/>
-                    <computed_discharge_curve>
-                      <dc:call-macro name="mainvalues"/>
-                    </computed_discharge_curve>
                   </dc:when>
                   <dc:when test="starts-with($out, 'sq_relation') or
                                  $out = 'sq_overview'">
-                    <dc:call-macro name="sqrelations"/>
+                    <dc:call-macro name="discharge-curve-prototype"/>
                   </dc:when>
                   <dc:comment> Cross sections </dc:comment>
                   <dc:when test="$out = 'cross_section'">
@@ -478,7 +462,6 @@
 
 
     <dc:macro name="historical_discharge_curve">
-      <dc:variable name="refgauge" type="number" expr="$reference_gauge"/>
       <dc:context>
         <dc:statement>
           SELECT g.id   AS gauge_id,
@@ -493,7 +476,7 @@
           WHERE g.river_id = ${river_id}
             AND dt.kind &lt;&gt; 0
             AND ((g.station = ${fromkm} AND g.station = ${tokm})
-              OR g.official_number = ${refgauge})
+              OR g.official_number = ${reference_gauge})
           ORDER BY start_time
         </dc:statement>
         <dc:if test="dc:has-result()">
@@ -1091,6 +1074,8 @@
         </dc:if>
       </dc:filter>
     </dc:macro>
+
+
     <!-- Macros to load system data -->
 
     <dc:macro name="annotations">
@@ -1144,6 +1129,89 @@
       </hyks>
     </dc:macro>
 
+
+    <!-- wst-data -->
+
+    <!-- model-waterlevels -->
+    <dc:macro name="basedata_0_macro">
+      <dc:filter expr="$kind = 0">
+        <dc:if test="dc:has-result()">
+          <basedata>
+            <dc:group expr="$wst_description">
+              <basedata name="{dc:group-key()}">
+                <dc:for-each>
+                  <dc:macro-body/>
+                </dc:for-each>
+              </basedata>
+            </dc:group>
+          </basedata>
+        </dc:if>
+      </dc:filter>
+    </dc:macro>
+
+    <dc:macro name="basedata_0">
+      <dc:call-macro name="basedata_0_macro">
+        <column name="{$wst_column_name}"
+                ids="base_data-wstv-{$wst_column_position}-{$wst_id}"
+                factory="staticwqkms" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <dc:macro name="basedata_0_wq">
+      <dc:call-macro name="basedata_0_macro">
+        <column name="{$wst_column_name}"
+                ids="base_data-wstv-{$wst_column_position}-{$wst_id}"
+                factory="wqinterpol" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <!-- additional longitudinal sections -->
+    <dc:macro name="basedata_1_additionals_macro">
+      <dc:filter expr="$kind=1">
+        <dc:if test="dc:has-result()">
+          <additionals>
+            <dc:group expr="dc:replace($wst_description, 'Zus.Längsschnitte/', '')">
+              <additional name="{dc:group-key()}">
+                <dc:for-each>
+                  <dc:macro-body/>
+                </dc:for-each>
+              </additional>
+            </dc:group>
+          </additionals>
+        </dc:if>
+      </dc:filter>
+    </dc:macro>
+
+    <dc:macro name="basedata_1_additionals">
+      <dc:call-macro name="basedata_1_additionals_macro">
+        <column name="{$wst_column_name}"
+                ids="additionals-wstv-{$wst_column_position}-{$wst_id}"
+                factory="staticwqkms" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <dc:macro name="basedata_1_additionals_wq">
+      <dc:call-macro name="basedata_1_additionals_macro">
+        <column name="{$wst_column_name}"
+                ids="base_data-wstv-{$wst_column_position}-{$wst_id}"
+                factory="wqinterpol" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <dc:macro name="basedata_1_additionals-relative_point">
+      <dc:call-macro name="basedata_1_additionals_macro">
+        <column name="{$wst_column_name}"
+                ids="additionals-wstv-{$wst_column_position}-{$wst_id}"
+                factory="staticwkms" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <!-- fixations -->
     <dc:macro name="fixings-macro">
       <dc:filter expr="$kind=2">
         <dc:if test="dc:has-result()">
@@ -1160,15 +1228,6 @@
       </dc:filter>
     </dc:macro>
 
-    <dc:macro name="basedata_2_fixations_wqkms">
-      <dc:call-macro name="fixings-macro">
-        <column name="{$wst_column_name}"
-                ids="fixations-wstv-{$wst_column_position}-{$wst_id}"
-                factory="wqinterpol" target_out="{$out}"
-                info="{$info} [km {$deffrom} - {$defto}]"/>
-      </dc:call-macro>
-    </dc:macro>
-
     <dc:macro name="basedata_2_fixations">
       <dc:call-macro name="fixings-macro">
         <column name="{$wst_column_name}"
@@ -1178,38 +1237,33 @@
       </dc:call-macro>
     </dc:macro>
 
-    <dc:macro name="basedata_3_officials">
+    <dc:macro name="basedata_2_fixations_wq">
+      <dc:call-macro name="fixings-macro">
+        <column name="{$wst_column_name}"
+                ids="fixations-wstv-{$wst_column_position}-{$wst_id}"
+                factory="wqinterpol" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <dc:macro name="basedata_2_fixations_relative_point">
+      <dc:call-macro name="fixings-macro">
+        <column name="{$wst_column_name}"
+                ids="fixations-wstv-{$wst_column_position}-{$wst_id}"
+                factory="staticwkms" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <!-- official lines -->
+    <dc:macro name="basedata_3_macro">
       <dc:filter expr="$kind=3">
         <dc:if test="dc:has-result()">
           <officiallines>
             <dc:group expr="$wst_description">
               <official name="{dc:group-key()}">
                 <dc:for-each>
-                  <column name="{$wst_column_name}"
-                          ids="additionals-wstv-{$wst_column_position}-{$wst_id}"
-                          factory="staticwqkms"
-                          target_out="{$out}"
-                          info="{$info} [km {$deffrom} - {$defto}]"/>
-                </dc:for-each>
-              </official>
-            </dc:group>
-          </officiallines>
-        </dc:if>
-      </dc:filter>
-    </dc:macro>
-
-    <dc:macro name="basedata_3_officials_wq">
-      <dc:filter expr="$kind=3">
-        <dc:if test="dc:has-result()">
-          <officiallines>
-            <dc:group expr="$wst_description">
-              <official name="{dc:group-key()}">
-                <dc:for-each>
-                  <column name="{$wst_column_name}"
-                          ids="officials_wq-wstv-{$wst_column_position}-{$wst_id}"
-                          factory="wqinterpol"
-                          target_out="{$out}"
-                          info="{$info} [km {$deffrom} - {$defto}]"/>
+                  <dc:macro-body/>
                 </dc:for-each>
               </official>
             </dc:group>
@@ -1218,17 +1272,35 @@
       </dc:filter>
     </dc:macro>
 
-    <dc:macro name="basedata_4_heightmarks-points">
+    <dc:macro name="basedata_3_officials">
+      <dc:call-macro name="basedata_3_macro">
+        <column name="{$wst_column_name}"
+                ids="additionals-wstv-{$wst_column_position}-{$wst_id}"
+                factory="staticwqkms"
+                target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <dc:macro name="basedata_3_officials_wq">
+      <dc:call-macro name="basedata_3_macro">
+        <column name="{$wst_column_name}"
+                ids="officials_wq-wstv-{$wst_column_position}-{$wst_id}"
+                factory="wqinterpol"
+                target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <!-- flood marks -->
+    <dc:macro name="basedata_4_macro">
       <dc:filter expr="$kind=4">
         <dc:if test="dc:has-result()">
           <heightmarks>
             <dc:group expr="dc:replace($wst_description, 'HW-Marken/', '')">
               <heightmark name="{dc:group-key()}">
                 <dc:for-each>
-                  <column name="{$wst_column_name}"
-                          ids="heightmarks_points-wstv-{$wst_column_position}-{$wst_id}"
-                          factory="staticwkms" target_out="{$out}"
-                          info="{$info} [km {$deffrom} - {$defto}]"/>
+                  <dc:macro-body/>
                 </dc:for-each>
               </heightmark>
             </dc:group>
@@ -1237,32 +1309,170 @@
       </dc:filter>
     </dc:macro>
 
+    <dc:macro name="basedata_4_heightmarks-points">
+      <dc:call-macro name="basedata_4_macro">
+        <column name="{$wst_column_name}"
+                ids="heightmarks_points-wstv-{$wst_column_position}-{$wst_id}"
+                factory="staticwkms" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <dc:macro name="basedata_4_heightmarks-points_wq">
+      <dc:call-macro name="basedata_4_macro">
+        <column name="{$wst_column_name}"
+                ids="heightmarks_points-wstv-{$wst_column_position}-{$wst_id}"
+                factory="wqinterpol" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
     <dc:macro name="basedata_4_heightmarks-points-relative_points">
-      <dc:filter expr="$kind=4">
+      <dc:call-macro name="basedata_4_macro">
+        <column name="{$wst_column_name}"
+                ids="heightmarks_points-wstv-{$wst_column_position}-{$wst_id}"
+                factory="staticwkms" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <!-- flood protection structures -->
+    <dc:macro name="basedata_5_macro">
+      <dc:filter expr="$kind=5">
         <dc:if test="dc:has-result()">
-          <heightmarks>
-            <dc:group expr="dc:replace($wst_description, 'HW-Marken/', '')">
-              <relativepoint name="{dc:group-key()}">
+          <flood_protections>
+            <dc:group expr="dc:replace($wst_description, 'HW-Schutzanlagen/', '')">
+              <flood_protection name="{dc:group-key()}">
                 <dc:for-each>
-                  <column name="{$wst_column_name}"
-                          ids="heightmarks_points-wstv-{$wst_column_position}-{$wst_id}"
-                          factory="staticwkms" target_out="{$out}"
-                          info="{$info} [km {$deffrom} - {$defto}]"/>
+                  <dc:macro-body/>
                 </dc:for-each>
-              </relativepoint>
+              </flood_protection>
             </dc:group>
-          </heightmarks>
+          </flood_protections>
         </dc:if>
       </dc:filter>
     </dc:macro>
 
+    <dc:macro name="basedata_5_flood-protections">
+      <dc:call-macro name="basedata_5_macro">
+        <column name="{$wst_column_name}"
+                ids="flood_protection-wstv-{$wst_column_position}-{$wst_id}"
+                factory="staticwkms" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <dc:macro name="basedata_5_flood-protections_wq">
+      <dc:call-macro name="basedata_5_macro">
+        <column name="{$wst_column_name}"
+                ids="flood_protection-wstv-{$wst_column_position}-{$wst_id}"
+                factory="wqinterpol" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <dc:macro name="basedata_5_flood-protections_relative_points">
+      <dc:call-macro name="basedata_5_macro">
+        <column name="{$wst_column_name}"
+                ids="flood_protection-wstv-{$wst_column_position}-{$wst_id}"
+                factory="staticwkms" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <!-- waterlevel differences imported from CSV-files for M-INFO -->
+    <dc:macro name="basedata_6_delta_w">
+      <dc:filter expr="$kind=6">
+        <dc:if test="dc:has-result()">
+          <delta_w>
+            <delta_w_cm>
+              <dc:filter expr="contains($wst_description, 'cm.csv')">
+                <dc:group expr="dc:replace($wst_description, 'CSV/', '')">
+                  <relativepoint name="{dc:group-key()}">
+                    <dc:for-each>
+                      <column name="{$wst_column_name}"
+                              ids="delta_w-wstv-{$wst_column_position}-{$wst_id}"
+                              factory="staticwkms"
+                              target_out="{$out}"
+                              info="{$info} [km {$deffrom} - {$defto}]"/>
+                    </dc:for-each>
+                  </relativepoint>
+                </dc:group>
+              </dc:filter>
+            </delta_w_cm>
+            <delta_w_cma>
+              <dc:filter expr="contains($wst_description, 'cm-a.csv')">
+                <dc:group expr="dc:replace($wst_description, 'CSV/', '')">
+                  <relativepoint name="{dc:group-key()}">
+                    <dc:for-each>
+                      <column name="{$wst_column_name}"
+                              ids="delta_w_cma-wstv-{$wst_column_position}-{$wst_id}"
+                              factory="staticwkms" target_out="{$out}"
+                              info="{$info} [km {$deffrom} - {$defto}]"/>
+                    </dc:for-each>
+                  </relativepoint>
+                </dc:group>
+              </dc:filter>
+            </delta_w_cma>
+          </delta_w>
+        </dc:if>
+      </dc:filter>
+    </dc:macro>
+
+    <!-- waterlevels imported from CSV-files for M-INFO -->
+    <dc:macro name="basedata_7_macro">
+      <dc:filter expr="$kind=7">
+        <dc:if test="dc:has-result()">
+          <wlevel>
+            <dc:group expr="dc:replace($wst_description, 'CSV/', '')">
+              <relativepoint name="{dc:group-key()}">
+                <dc:for-each>
+                  <dc:macro-body/>
+                </dc:for-each>
+              </relativepoint>
+            </dc:group>
+          </wlevel>
+        </dc:if>
+      </dc:filter>
+    </dc:macro>
+
+    <dc:macro name="basedata_7_waterlevels">
+      <dc:call-macro name="basedata_7_macro">
+        <column name="{$wst_column_name}"
+                ids="additionals-wstv-{$wst_column_position}-{$wst_id}"
+                factory="staticwqkms" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+    <dc:macro name="basedata_7_waterlevels_wq">
+      <dc:call-macro name="basedata_7_macro">
+        <column name="{$wst_column_name}"
+                ids="additionals-wstv-{$wst_column_position}-{$wst_id}"
+                factory="wqinterpol" target_out="{$out}"
+                info="{$info} [km {$deffrom} - {$defto}]"/>
+      </dc:call-macro>
+    </dc:macro>
+
+
+    <!-- prototypes -->
+
     <dc:macro name="discharge-curve-prototype">
-        <dc:call-macro name="discharge_table_gauge"/>
+        <computed_discharge_curve>
+          <dc:call-macro name="discharge_table_gauge"/>
+          <dc:call-macro name="mainvalues"/>
+        </computed_discharge_curve>
         <dc:call-macro name="historical_discharge_curve"/>
         <dc:call-macro name="basedata_0_wq"/>
+        <dc:call-macro name="basedata_1_additionals_wq"/>
+        <dc:call-macro name="basedata_2_fixations_wq"/>
         <dc:call-macro name="basedata_3_officials_wq"/>
-        <dc:call-macro name="basedata_2_fixations_wqkms"/>
-        <dc:call-macro name="basedata_4_heightmarks-points"/>
+        <dc:call-macro name="basedata_4_heightmarks-points_wq"/>
+        <dc:call-macro name="basedata_5_flood-protections_wq"/>
+        <minfo>
+          <dc:call-macro name="sqrelations"/>
+          <dc:call-macro name="basedata_7_waterlevels_wq"/>
+        </minfo>
     </dc:macro>
 
     <dc:macro name="longitudinal-section-prototype">
@@ -1306,25 +1516,8 @@
       <dc:call-macro name="sediment-load"/>
     </dc:macro>
 
-    <dc:macro name="discharge-prototype">
-      <dc:call-macro name="discharge-curve-prototype"/>
-      <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_1_additionals_marks"/>
-      <dc:call-macro name="basedata_4_heightmarks-points"/>
-      <dc:call-macro name="basedata_1_additionals-relative_point"/>
-      <dc:call-macro name="basedata_2_fixations_relative_point"/>
-      <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/>
-      <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
-      <dc:call-macro name="mainvalues"/>
-      <dc:call-macro name="annotations"/>
 
-      <computed_discharge_curve>
-        <dc:call-macro name="mainvalues"/>
-      </computed_discharge_curve>
-    </dc:macro>
-
+    <!-- porosities -->
     <dc:macro name="porosities">
       <porosities>
       <dc:context>
@@ -1390,6 +1583,7 @@
       </densities>
     </dc:macro>
 
+    <!-- sediment load -->
     <dc:macro name="load">
       <year description="{$timespan}"
             factory="sedimentload"
@@ -1543,26 +1737,7 @@
       </sedimentloads>
     </dc:macro>
 
-
-    <dc:macro name="basedata_5_flood-protections">
-      <dc:filter expr="$kind=5">
-        <dc:if test="dc:has-result()">
-          <flood_protections>
-            <dc:group expr="dc:replace($wst_description, 'HW-Schutzanlagen/', '')">
-              <flood_protection name="{dc:group-key()}">
-                <dc:for-each>
-                  <column name="{$wst_column_name}"
-                          ids="flood_protection-wstv-{$wst_column_position}-{$wst_id}"
-                          factory="staticwkms" target_out="{$out}"
-                          info="{$info} [km {$deffrom} - {$defto}]"/>
-                </dc:for-each>
-              </flood_protection>
-            </dc:group>
-          </flood_protections>
-        </dc:if>
-      </dc:filter>
-    </dc:macro>
-
+    <!-- annotations -->
     <dc:macro name="annotations_per_type">
       <annotations>
         <dc:context>
@@ -1599,122 +1774,6 @@
       </sources_sinks>
     </dc:macro>
 
-    <dc:macro name="basedata_2_fixations_relative_point">
-      <dc:filter expr="$kind=2">
-        <dc:if test="dc:has-result()">
-          <fixations>
-            <dc:group expr="dc:replace($wst_description, 'Fixierungen/', '')">
-              <relativepoint name="{dc:group-key()}">
-                <dc:for-each>
-                  <column name="{$wst_column_name}"
-                          ids="fixations-wstv-{$wst_column_position}-{$wst_id}"
-                          factory="staticwkms" target_out="{$out}"
-                          info="{$info} [km {$deffrom} - {$defto}]"/>
-                </dc:for-each>
-              </relativepoint>
-            </dc:group>
-          </fixations>
-        </dc:if>
-      </dc:filter>
-    </dc:macro>
-
-    <dc:macro name="basedata_5_flood-protections_relative_points">
-      <dc:filter expr="$kind=5">
-        <dc:if test="dc:has-result()">
-          <flood_protections>
-            <dc:group expr="$wst_description">
-              <relativepoint name="{dc:group-key()}">
-                <dc:for-each>
-                  <column name="{$wst_column_name}"
-                          ids="flood_protection-wstv-{$wst_column_position}-{$wst_id}"
-                          factory="staticwkms" target_out="{$out}"
-                          info="{$info} [km {$deffrom} - {$defto}]"/>
-                </dc:for-each>
-              </relativepoint>
-            </dc:group>
-          </flood_protections>
-        </dc:if>
-      </dc:filter>
-    </dc:macro>
-
-    <dc:macro name="basedata_1_additionals-relative_point">
-      <dc:filter expr="$kind=1">
-        <dc:if test="dc:has-result()">
-          <additionals>
-            <dc:group expr="$wst_description">
-              <relativepoint name="{dc:group-key()}">
-                <dc:for-each>
-                  <column name="{$wst_column_name}"
-                          ids="additionals-wstv-{$wst_column_position}-{$wst_id}"
-                          factory="staticwkms" target_out="{$out}"
-                          info="{$info} [km {$deffrom} - {$defto}]"/>
-                </dc:for-each>
-              </relativepoint>
-            </dc:group>
-          </additionals>
-        </dc:if>
-      </dc:filter>
-    </dc:macro>
-
-
-    <dc:macro name="basedata_7_waterlevels">
-      <dc:filter expr="$kind=7">
-        <dc:if test="dc:has-result()">
-          <wlevel>
-            <dc:group expr="dc:replace($wst_description, 'CSV/', '')">
-              <relativepoint name="{dc:group-key()}">
-                <dc:for-each>
-                  <column name="{$wst_column_name}"
-                          ids="additionals-wstv-{$wst_column_position}-{$wst_id}"
-                          factory="staticwqkms" target_out="{$out}"
-                          info="{$info} [km {$deffrom} - {$defto}]"/>
-                </dc:for-each>
-              </relativepoint>
-            </dc:group>
-          </wlevel>
-        </dc:if>
-      </dc:filter>
-    </dc:macro>
-
-
-    <dc:macro name="basedata_6_delta_w">
-      <dc:filter expr="$kind=6">
-        <dc:if test="dc:has-result()">
-          <delta_w>
-            <delta_w_cm>
-              <dc:filter expr="contains($wst_description, 'cm.csv')">
-                <dc:group expr="dc:replace($wst_description, 'CSV/', '')">
-                  <relativepoint name="{dc:group-key()}">
-                    <dc:for-each>
-                      <column name="{$wst_column_name}"
-                              ids="delta_w-wstv-{$wst_column_position}-{$wst_id}"
-                              factory="staticwkms"
-                              target_out="{$out}"
-                              info="{$info} [km {$deffrom} - {$defto}]"/>
-                    </dc:for-each>
-                  </relativepoint>
-                </dc:group>
-              </dc:filter>
-            </delta_w_cm>
-            <delta_w_cma>
-              <dc:filter expr="contains($wst_description, 'cm-a.csv')">
-                <dc:group expr="dc:replace($wst_description, 'CSV/', '')">
-                  <relativepoint name="{dc:group-key()}">
-                    <dc:for-each>
-                      <column name="{$wst_column_name}"
-                              ids="delta_w_cma-wstv-{$wst_column_position}-{$wst_id}"
-                              factory="staticwkms" target_out="{$out}"
-                              info="{$info} [km {$deffrom} - {$defto}]"/>
-                    </dc:for-each>
-                  </relativepoint>
-                </dc:group>
-              </dc:filter>
-            </delta_w_cma>
-          </delta_w>
-        </dc:if>
-      </dc:filter>
-    </dc:macro>
-
     <dc:macro name="discharge_table_gauge">
       <dc:context>
         <dc:statement>
@@ -1728,7 +1787,7 @@
           WHERE g.river_id = ${river_id}
           AND dt.kind = 0
           AND ((g.station = ${fromkm} AND g.station = ${tokm})
-          OR g.official_number = ${refgauge})
+          OR g.official_number = ${reference_gauge})
         </dc:statement>
         <dc:if test="dc:has-result()">
           <dc:for-each>
@@ -2068,7 +2127,7 @@
     <dc:macro name="sqrelations">
       <dc:context>
         <dc:statement>
-          SELECT sq.description  AS description,
+          SELECT
             ti.start_time        AS start_time,
             ti.stop_time         AS stop_time,
             ms.name              AS station_name,
@@ -2076,125 +2135,43 @@
             sqv.id               AS sqvid,
             ra.a                 AS station_km
           FROM sq_relation sq
-          JOIN time_intervals ti ON ti.id   = sq.time_interval_id
-          JOIN rivers r ON r.id = sq.river_id
+          JOIN time_intervals ti ON ti.id = sq.time_interval_id
           JOIN sq_relation_value sqv ON sqv.sq_relation_id = sq.id
           JOIN measurement_station ms ON sqv.measurement_station_id = ms.id
           JOIN ranges ra ON ms.range_id = ra.id
+          JOIN rivers r ON r.id = ra.river_id
           WHERE r.id = ${river_id}
-          ORDER BY station_km, start_time, stop_time
+          ORDER BY start_time, stop_time
         </dc:statement>
         <dc:if test="dc:has-result()">
           <sq_relations>
-            <dc:filter expr="$out = concat('sq_relation_', $parameter) or
-                             $out = 'sq_overview'">
-              <dc:group expr="concat('Parameter ', dc:uppercase($parameter))">
-                <parameter description="{dc:group-key()}">
-                  <dc:for-each>
-                    <dc:group expr="$station_km" type="number">
-                      <dc:group expr="concat('km ', $station_km, ': ',
-                                      $station_name)">
-                        <station description="{dc:group-key()}">
-                          <dc:for-each>
-                            <dc:variable name="combined_desc"
-                                         expr="concat(dc:date-format('yyyy',
-                                               $start_time), ' bis ',
-                                               dc:date-format('yyyy',
-                                               $stop_time))"/>
-                            <sqvalue factory="staticsqrelation"
-                                     target_out="{$out}"
-                                     ids="{$sqvid};{dc:uppercase($parameter)} - {$station_name}: {$combined_desc}"
-                                     description="{$combined_desc}"/>
-                          </dc:for-each>
-                        </station>
-                      </dc:group>
-                    </dc:group>
-                  </dc:for-each>
-                </parameter>
-              </dc:group>
-            </dc:filter>
+            <dc:group expr="concat('Parameter ', dc:uppercase($parameter))">
+              <parameter description="{dc:group-key()}">
+                <dc:group expr="$station_km" type="number">
+                  <dc:group expr="concat('km ', $station_km, ': ',
+                                  $station_name)">
+                    <station description="{dc:group-key()}">
+                      <dc:for-each>
+                        <dc:variable name="combined_desc"
+                                     expr="concat(dc:date-format('yyyy',
+                                           $start_time), ' bis ',
+                                           dc:date-format('yyyy',
+                                           $stop_time))"/>
+                        <sqvalue factory="staticsqrelation"
+                                 target_out="{$out}"
+                                 ids="{$sqvid};{dc:uppercase($parameter)} - {$station_name}: {$combined_desc}"
+                                 description="{$combined_desc}"/>
+                      </dc:for-each>
+                    </station>
+                  </dc:group>
+                </dc:group>
+              </parameter>
+            </dc:group>
           </sq_relations>
         </dc:if>
       </dc:context>
     </dc:macro>
 
-    <dc:macro name="basedata_0_macro">
-      <dc:filter expr="$kind = 0">
-        <dc:if test="dc:has-result()">
-          <basedata>
-            <dc:group expr="$wst_description">
-              <basedata name="{dc:group-key()}">
-                <dc:for-each>
-                  <dc:macro-body/>
-                </dc:for-each>
-              </basedata>
-            </dc:group>
-          </basedata>
-        </dc:if>
-      </dc:filter>
-    </dc:macro>
-
-    <dc:macro name="basedata_0">
-      <dc:call-macro name="basedata_0_macro">
-        <column name="{$wst_column_name}"
-                ids="base_data-wstv-{$wst_column_position}-{$wst_id}"
-                factory="staticwqkms" target_out="{$out}"
-                info="{$info} [km {$deffrom} - {$defto}]"/>
-      </dc:call-macro>
-    </dc:macro>
-
-    <dc:macro name="basedata_0_wq">
-      <dc:call-macro name="basedata_0_macro">
-        <column name="{$wst_column_name}"
-                ids="base_data-wstv-{$wst_column_position}-{$wst_id}"
-                factory="wqinterpol" target_out="{$out}"
-                info="{$info} [km {$deffrom} - {$defto}]"/>
-      </dc:call-macro>
-    </dc:macro>
-
-    <dc:macro name="basedata_1_additionals_macro">
-      <dc:filter expr="$kind=1">
-        <dc:if test="dc:has-result()">
-          <additionals>
-            <dc:group expr="dc:replace($wst_description, 'Zus.Längsschnitte/', '')">
-              <additional name="{dc:group-key()}">
-                <dc:for-each>
-                  <dc:macro-body/>
-                </dc:for-each>
-              </additional>
-            </dc:group>
-          </additionals>
-        </dc:if>
-      </dc:filter>
-    </dc:macro>
-
-    <dc:macro name="basedata_1_additionals">
-      <dc:call-macro name="basedata_1_additionals_macro">
-        <column name="{$wst_column_name}"
-                ids="additionals-wstv-{$wst_column_position}-{$wst_id}"
-                factory="staticwqkms" target_out="{$out}"
-                info="{$info} [km {$deffrom} - {$defto}]"/>
-      </dc:call-macro>
-    </dc:macro>
-
-    <dc:macro name="basedata_1_additionals_marks">
-      <dc:call-macro name="basedata_1_additionals_macro">
-        <column name="{$wst_column_name}"
-                ids="additionalsmarks-wstv-{$wst_column_position}-{$wst_id}"
-                factory="staticwkms" target_out="{$out}"
-                info="{$info} [km {$deffrom} - {$defto}]"/>
-      </dc:call-macro>
-    </dc:macro>
-
-    <dc:macro name="basedata_1_additionals_wq">
-      <dc:call-macro name="basedata_1_additionals_macro">
-        <column name="{$wst_column_name}"
-                ids="base_data-wstv-{$wst_column_position}-{$wst_id}"
-                factory="wqinterpol" target_out="{$out}"
-                info="{$info} [km {$deffrom} - {$defto}]"/>
-      </dc:call-macro>
-    </dc:macro>
-
     <!-- Floodmap part -->
     <dc:macro name="flood-map-complete">
       <dc:call-macro name="flood-map-buildings"/>

http://dive4elements.wald.intevation.org