diff artifacts/doc/conf/meta-data.xml @ 8961:8a1c6e2ad48b

Implemented datacage for min/max bedheights. Allow to add min/max bed heights as themes to charts.
author gernotbelger
date Wed, 28 Mar 2018 14:35:01 +0200
parents 3c95b89da5ea
children b98fbd91f64a
line wrap: on
line diff
--- a/artifacts/doc/conf/meta-data.xml	Wed Mar 28 14:34:55 2018 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Wed Mar 28 14:35:01 2018 +0200
@@ -261,6 +261,9 @@
 
                   <dc:comment> S-INFO </dc:comment>
                   <dc:when test="$out = 'sinfo_flowdepth_minfo_heights'">
+                    <dc:variable name="bed_height_type" expr="''"/>
+                    <dc:variable name="bed_height_descr_prefix" expr="''"/>
+                    <dc:variable name="bedheight_count" expr="'bedh_height_count'"/>
                     <dc:call-macro name="bed-heights-single"/>
                   </dc:when>
                   <dc:when test="$out = 'sinfo_flowdepth_waterlevels'">
@@ -427,7 +430,7 @@
                     <dc:when test="$out = 'map'">
                       <dc:call-macro name="flood-map"/>
                     </dc:when>
-                    
+
                     <dc:when test="$out = 'sinfo_flowdepth_waterlevels'">
                       <dc:call-macro name="longitudinal-section-fix-vollmer_q"/>
                       <!-- TODO: 'Frühere Berechnungen//Bezugswasserstände' -->
@@ -592,35 +595,35 @@
           ($facet_name = 'longitudinal_section.w' or
            $facet_name = 'longitudinal_section.q')
         ">
-          <dc:call-macro name="longitudinal-section-fix-vollmer_macro"/>
+        <dc:call-macro name="longitudinal-section-fix-vollmer_macro"/>
       </dc:filter>
     </dc:macro>
 
     <dc:macro name="longitudinal-section-fix-vollmer_q">
       <dc:filter expr="$a_state = 'state.fix.vollmer.compute' and $facet_name = 'longitudinal_section.q'">
-          <dc:call-macro name="longitudinal-section-fix-vollmer_macro"/>
+        <dc:call-macro name="longitudinal-section-fix-vollmer_macro"/>
       </dc:filter>
     </dc:macro>
 
     <dc:macro name="longitudinal-section-fix-vollmer_macro">
-        <dc:if test="dc:has-result()">
-          <waterlevels_fix_vollmer>
-            <dc:call-macro name="collection-group">
-              <waterlevels description="{dc:group-key()}">
-                <dc:for-each>
-                  <dc:element name="${facet_name}">
-                    <dc:attribute name="description" value="${facet_description}"/>
-                    <dc:attribute name="ids" value="${facet_num}"/>
-                    <dc:attribute name="factory" value="fixanalysis"/>
-                    <dc:attribute name="target_out" value="${out}"/>
-                    <dc:attribute name="artifact-id" value="${a_gid}"/>
-                    <dc:attribute name="out" value="longitudinal_section"/>
-                  </dc:element>
-                </dc:for-each>
-              </waterlevels>
-            </dc:call-macro>
-          </waterlevels_fix_vollmer>
-        </dc:if>
+      <dc:if test="dc:has-result()">
+        <waterlevels_fix_vollmer>
+          <dc:call-macro name="collection-group">
+            <waterlevels description="{dc:group-key()}">
+              <dc:for-each>
+                <dc:element name="${facet_name}">
+                  <dc:attribute name="description" value="${facet_description}"/>
+                  <dc:attribute name="ids" value="${facet_num}"/>
+                  <dc:attribute name="factory" value="fixanalysis"/>
+                  <dc:attribute name="target_out" value="${out}"/>
+                  <dc:attribute name="artifact-id" value="${a_gid}"/>
+                  <dc:attribute name="out" value="longitudinal_section"/>
+                </dc:element>
+              </dc:for-each>
+            </waterlevels>
+          </dc:call-macro>
+        </waterlevels_fix_vollmer>
+      </dc:if>
     </dc:macro>
 
     <dc:macro name="longitudinal-section-fix">
@@ -1601,6 +1604,13 @@
           <dc:call-macro name="flow_velocity_models"/>
         </flow_velocities>
       </minfo>
+
+      <sinfo>
+        <bed_heights_minmax>
+          <dc:call-macro name="minfo-heights-max"/>
+          <dc:call-macro name="minfo-heights-min"/>
+        </bed_heights_minmax>
+      </sinfo>
     </dc:macro>
 
     <dc:macro name="longitudinal-section-user-prototype">
@@ -1953,11 +1963,11 @@
           <dc:for-each>
             <dc:choose>
               <dc:when test="dc:group-key() = $b1year">
-                <height factory="bedheight" target_out="{$out}" ids="bedheight-single-{$b1id}#bedheight-single-{$b2id}" info="{$b1desc}#{$b2desc}" description="{$b1desc} - {$b2desc}"/>
+                <height factory="bedheight" target_out="{$out}" ids="bedheight-single-{$b1id}-{$b1desc}#bedheight-single-{$b2id}-{$b2desc}" info="{$b1desc}#{$b2desc}" description="{$b1desc} - {$b2desc}"/>
               </dc:when>
               <dc:when test="dc:group-key() = 'sonstige'">
-                <height factory="bedheight" target_out="{$out}" ids="bedheight-single-{$b1id}#bedheight-single-{$b2id}" info="{$b1desc}#{$b2desc}" description="{$b1desc} - {$b2desc}"/>
-                <height factory="bedheight" target_out="{$out}" ids="bedheight-single-{$b2id}#bedheight-single-{$b1id}" info="{$b2desc}#{$b1desc}" description="{$b2desc} - {$b1desc}"/>
+                <height factory="bedheight" target_out="{$out}" ids="bedheight-single-{$b1id}-{$b1desc}#bedheight-single-{$b2id}-{$b2desc}" info="{$b1desc}#{$b2desc}" description="{$b1desc} - {$b2desc}"/>
+                <height factory="bedheight" target_out="{$out}" ids="bedheight-single-{$b2id}-{$b1desc}#bedheight-single-{$b1id}-{$b2desc}" info="{$b2desc}#{$b1desc}" description="{$b2desc} - {$b1desc}"/>
               </dc:when>
             </dc:choose>
           </dc:for-each>
@@ -1967,14 +1977,39 @@
 
     <dc:macro name="minfo-heights">
       <bedheights>
+        <dc:variable name="bed_height_type" expr="''">
+          <!-- REMARK: empty type for the former, 'normal' bed height -->
+        </dc:variable>
+        <dc:variable name="bed_height_descr_prefix" expr="''"/>
+        <dc:variable name="bedheight_count" expr="'bedh_height_count'"/>
         <dc:call-macro name="bed-heights-single"/>
         <dc:call-macro name="bed-heights-epoch"/>
       </bedheights>
     </dc:macro>
 
+    <dc:macro name="minfo-heights-max">
+      <bedheights_max>
+        <dc:variable name="bed_height_type" expr="'Max'"/>
+        <dc:variable name="bed_height_descr_prefix" expr="'KL-'"/>
+        <dc:variable name="bedheight_count" expr="'bedh_max_count'"/>
+        <dc:call-macro name="bed-heights-single"/>
+        <dc:call-macro name="bed-heights-epoch"/>
+      </bedheights_max>
+    </dc:macro>
+
+    <dc:macro name="minfo-heights-min">
+      <bedheights_min>
+        <dc:variable name="bed_height_type" expr="'Min'"/>
+        <dc:variable name="bed_height_descr_prefix" expr="'TW-'"/>
+        <dc:variable name="bedheight_count" expr="'bedh_min_count'"/>
+        <dc:call-macro name="bed-heights-single"/>
+        <dc:call-macro name="bed-heights-epoch"/>
+      </bedheights_min>
+    </dc:macro>
+
     <dc:macro name="bed-heights-factory">
       <dc:for-each>
-        <height factory="bedheight" target_out="{$out}" ids="bedheight-single-{$bedh_id}-{$bedh_year}" info="{$info}" description="{$bedh_descr}"/>
+        <height factory="bedheight" target_out="{$out}" ids="bedheight-single{$bed_height_type}-{$bedh_id}-{$bedh_year}-{$bed_height_descr_prefix}{$bedh_descr}" info="{$info}" description="{$bed_height_descr_prefix}{$bedh_descr}"/>
       </dc:for-each>
     </dc:macro>
 
@@ -1983,13 +2018,15 @@
         <dc:context>
           <dc:call-macro name="bed-heights-statement"/>
           <dc:filter expr="not(contains($bedh_descr, 'Epoche'))">
-            <dc:if test="dc:has-result()">
-              <dc:group expr="dc:coalesce($bedh_year, 'sonstige')">
-                <heights name="{dc:group-key()}">
-                  <dc:call-macro name="bed-heights-factory"/>
-                </heights>
-              </dc:group>
-            </dc:if>
+            <dc:filter expr="dc:column($bedheight_count) > 0">
+              <dc:if test="dc:has-result()">
+                <dc:group expr="dc:coalesce($bedh_year, 'sonstige')">
+                  <heights name="{dc:group-key()}">
+                    <dc:call-macro name="bed-heights-factory"/>
+                  </heights>
+                </dc:group>
+              </dc:if>
+            </dc:filter>
           </dc:filter>
         </dc:context>
       </single>
@@ -2000,7 +2037,9 @@
         <dc:context>
           <dc:call-macro name="bed-heights-statement"/>
           <dc:filter expr="contains($bedh_descr, 'Epoche')">
-            <dc:call-macro name="bed-heights-factory"/>
+            <dc:filter expr="dc:column($bedheight_count) > 0">
+              <dc:call-macro name="bed-heights-factory"/>
+            </dc:filter>
           </dc:filter>
         </dc:context>
       </epoch>
@@ -2008,7 +2047,7 @@
 
     <dc:macro name="sounding-width-factory">
       <dc:for-each>
-        <height factory="bedheight" target_out="{$out}" ids="bedheight-soundings-{$bedh_id}-{$bedh_year}" info="{$info}" description="{$bedh_descr}"/>
+        <height factory="bedheight" target_out="{$out}" ids="bedheight-soundings-{$bedh_id}-{$bedh_year}-{$bedh_descr}" info="{$info}" description="{$bedh_descr}"/>
       </dc:for-each>
     </dc:macro>
 
@@ -2034,25 +2073,30 @@
 
     <dc:macro name="bed-heights-statement">
       <dc:statement>
-        SELECT bhs.id AS bedh_id,
-        bhs.year AS bedh_year,
-        bhs.description AS bedh_descr,
-        bhs.description || '&lt;BR&gt;Jahr: ' || bhs.year ||
-        '&lt;BR&gt;Aufnahmeart: ' || bht.name ||
-        '&lt;BR&gt;Lagesystem: ' || ls.name ||
-        '&lt;BR&gt;Höhensystem: ' || cur_em.name ||
-        '&lt;BR&gt;ursprüngliches Höhensystem: ' || old_em.name ||
-        '&lt;BR&gt;Strecke: ' || round(r.a, 1) || '-' || round(r.b, 1) ||
-        '&lt;BR&gt;Auswerter: ' || bhs.evaluation_by AS info
-        FROM bed_height bhs
-        JOIN bed_height_type bht ON bht.id =
-        bhs.type_id
-        JOIN location_system ls ON ls.id = location_system_id
-        JOIN elevation_model cur_em ON cur_em.id = cur_elevation_model_id
-        LEFT JOIN elevation_model old_em
-        ON old_em.id = old_elevation_model_id
-        LEFT JOIN ranges r ON r.id = range_id
-        WHERE bhs.river_id = ${river_id}
+         SELECT bhs.id AS bedh_id,
+         bhs.year AS bedh_year,
+         bhs.description AS bedh_descr,
+         bhs.description || '&lt;BR&gt;Jahr: ' || bhs.year ||
+         '&lt;BR&gt;Aufnahmeart: ' || bht.name ||
+         '&lt;BR&gt;Lagesystem: ' || ls.name ||
+         '&lt;BR&gt;Höhensystem: ' || cur_em.name ||
+         '&lt;BR&gt;ursprüngliches Höhensystem: ' || old_em.name ||
+         '&lt;BR&gt;Strecke: ' || round(r.a, 1) || '-' || round(r.b, 1) ||
+         '&lt;BR&gt;Auswerter: ' || bhs.evaluation_by AS info,
+         bhv.height_count AS bedh_height_count,
+         bhv.min_count AS bedh_min_count,
+         bhv.max_count AS bedh_max_count
+         FROM bed_height bhs
+         JOIN bed_height_type bht ON bht.id = bhs.type_id
+         JOIN location_system ls ON ls.id = location_system_id
+         JOIN elevation_model cur_em ON cur_em.id = cur_elevation_model_id
+         LEFT JOIN elevation_model old_em
+         ON old_em.id = old_elevation_model_id
+         LEFT JOIN ranges r ON r.id = range_id
+         LEFT JOIN (SELECT bed_height_id, COUNT(height) AS height_count, COUNT(min_height) AS min_count, COUNT(max_height) AS max_count
+           FROM bed_height_values GROUP BY bed_height_id
+         ) bhv ON bhs.id = bhv.bed_height_id
+         WHERE bhs.river_id = ${river_id}
       </dc:statement>
     </dc:macro>
 
@@ -3080,8 +3124,8 @@
           w.description AS wst_description,
           COALESCE(wc.name, '') AS wst_column_name,
           wr.a AS deffrom,
-          wr.b AS defto,
-          w.sinfo_selection
+          wr.b AS defto,
+          w.sinfo_selection
           FROM wst_columns wc
           JOIN wsts w ON wc.wst_id = w.id
           JOIN wst_ranges wr ON wc.id = wr.wst_column_id

http://dive4elements.wald.intevation.org