diff artifacts/doc/conf/meta-data.xml @ 8079:1c57c9dc1661

Datacage config for new sediment load structures. Missing: some facets and everything down from the innermost macros for sediment load at measurement stations.
author Tom Gottfried <tom@intevation.de>
date Fri, 08 Aug 2014 13:24:11 +0200
parents 5f28aa1be795
children 1d2a9c5ee97b
line wrap: on
line diff
--- a/artifacts/doc/conf/meta-data.xml	Thu Aug 07 20:03:44 2014 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Fri Aug 08 13:24:11 2014 +0200
@@ -1407,133 +1407,145 @@
       </densities>
     </dc:macro>
 
-    <dc:macro name="one-load">
-      <dc:for-each>
-          <dc:variable name="syear" type="string" expr="dc:date-format('yyyy', $year)"/>
-          <year description="{$syear}"
-                 factory="sedimentyield"
-                 target_out="{$out}"
-                 info="{$description}"
-                ids="{$syid}" />
-      </dc:for-each>
+    <dc:macro name="one-load_ls">
+      <dc:variable name="syear" type="string" expr="dc:date-format('yyyy', $year)"/>
+      <year description="{$syear}"
+            factory="sedimentyield"
+            target_out="{$out}"
+            info="{$description}"
+            ids="{$syid}" />
     </dc:macro>
 
-    <dc:macro name="epoch-load">
-      <dc:for-each>
-          <dc:variable name="syear" type="string" expr="dc:date-format('yyyy', $startyear)"/>
-          <dc:variable name="eyear" type="string" expr="dc:date-format('yyyy', $endyear)"/>
-          <year description="{$syear}-{$eyear}"
-                 factory="sedimentyield"
-                 target_out="{$out}"
-                 info="{$description}"
-                ids="{$syid}" />
-      </dc:for-each>
+    <dc:macro name="epoch-load_ls">
+      <dc:variable name="syear" type="string" expr="dc:date-format('yyyy', $startyear)"/>
+      <dc:variable name="eyear" type="string" expr="dc:date-format('yyyy', $endyear)"/>
+      <year description="{$syear}-{$eyear}"
+            factory="sedimentyield"
+            target_out="{$out}"
+            info="{$description}"
+            ids="{$syid}" />
     </dc:macro>
 
     <dc:macro name="loads">
      <dc:if test="dc:has-result()">
-       <dc:filter expr="$fraction='sand'">
-         <dc:if test="dc:has-result()">
-           <sand>
-             <dc:macro-body/>
-           </sand>
-         </dc:if>
-       </dc:filter>
-       <dc:filter expr="$fraction='fine_middle'">
-         <dc:if test="dc:has-result()">
-           <fine_middle>
-             <dc:macro-body/>
-           </fine_middle>
-         </dc:if>
-       </dc:filter>
-       <dc:filter expr="$fraction='coarse'">
-         <dc:if test="dc:has-result()">
-           <coarse>
-             <dc:macro-body/>
-           </coarse>
-         </dc:if>
-       </dc:filter>
-       <dc:filter expr="$fraction='suspended_sediment'">
-         <dc:if test="dc:has-result()">
-           <susp_sediment>
-             <dc:macro-body/>
-           </susp_sediment>
-         </dc:if>
-       </dc:filter>
-       <dc:filter expr="$fraction='susp_sand'">
-         <dc:if test="dc:has-result()">
-           <susp_sand>
-             <dc:macro-body/>
-           </susp_sand>
-         </dc:if>
-       </dc:filter>
-       <dc:filter expr="$fraction='susp_sand_bed'">
-         <dc:if test="dc:has-result()">
-           <susp_sand_bed>
-             <dc:macro-body/>
-           </susp_sand_bed>
-         </dc:if>
-       </dc:filter>
-       <dc:filter expr="$fraction='total'">
-         <dc:if test="dc:has-result()">
-           <total_load>
-             <dc:macro-body/>
-           </total_load>
-         </dc:if>
-       </dc:filter>
+       <dc:group expr="$fraction">
+         <dc:variable name="fraction_name" expr="concat('\${', dc:group-key(), '}')"/>
+         <fraction description="{$fraction_name}">
+           <dc:for-each>
+               <dc:macro-body/>
+           </dc:for-each>
+         </fraction>
+       </dc:group>
      </dc:if>
     </dc:macro>
-      
+
     <dc:macro name="yields">
       <yields>
-      <dc:call-macro name="annotations_sediment_load_ls"/>
-      <years>
-      <dc:context>
-        <dc:statement>
-            SELECT DISTINCT
-                sy.id          AS syid,
-                sy.description AS description,
-                ti.start_time  AS year,
-                gf.name        AS fraction
-            FROM     sediment_load_ls sy
-                JOIN rivers r ON sy.river_id = r.id
-                JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id
-                JOIN time_intervals ti ON sy.time_interval_id = ti.id
-                JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id
-            WHERE   r.id = ${river_id}
-                AND ti.stop_time IS NULL
-                AND syv.station BETWEEN ${fromkm} AND ${tokm}
-            ORDER BY fraction, year DESC
-        </dc:statement>
-        <dc:call-macro name="loads">
-          <dc:call-macro name="one-load"/>
-        </dc:call-macro>
-      </dc:context>
-      </years>
-      <epochs>
-      <dc:context>
-        <dc:statement>
-            SELECT DISTINCT
-                sy.id          AS syid,
-                sy.description AS description,
-                ti.start_time  AS startyear,
-                ti.stop_time   AS endyear,
-                gf.name        AS fraction
-            FROM     sediment_load_ls sy
-                JOIN rivers r ON sy.river_id = r.id
-                JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id
-                JOIN time_intervals ti ON sy.time_interval_id = ti.id
-                JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id
-            WHERE   r.id = ${river_id}
-                AND ti.stop_time IS NOT NULL
-                AND syv.station BETWEEN ${fromkm} AND ${tokm}
-            ORDER BY fraction, startyear DESC, endyear DESC
-        </dc:statement>
-        <dc:call-macro name="loads">
-          <dc:call-macro name="epoch-load"/>
-        </dc:call-macro>
-      </dc:context>
-      </epochs>
+        <dc:call-macro name="annotations_sediment_load_ls"/>
+        <measurement_stations>
+          <years>
+            <dc:context>
+              <dc:statement>
+                SELECT DISTINCT
+                    sy.id          AS syid,
+                    sy.description AS description,
+                    ti.start_time  AS year,
+                    gf.name        AS fraction
+                FROM     sediment_load sy
+                    JOIN sediment_load_values syv
+                        ON sy.id = syv.sediment_load_id
+                    JOIN measurement_station ms
+                        ON ms.id = syv.measurement_station_id
+                    JOIN rivers r ON ms.river_id = r.id
+                    JOIN time_intervals ti ON sy.time_interval_id = ti.id
+                    JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id
+                WHERE   r.id = ${river_id}
+                    AND ti.stop_time IS NULL
+                    AND ms.station BETWEEN ${fromkm} AND ${tokm}
+                ORDER BY fraction, year DESC
+              </dc:statement>
+              <dc:call-macro name="loads">
+                <dc:call-macro name="one-load"/>
+              </dc:call-macro>
+            </dc:context>
+          </years>
+          <epochs>
+            <dc:context>
+              <dc:statement>
+                SELECT DISTINCT
+                    sy.id          AS syid,
+                    sy.description AS description,
+                    ti.start_time  AS startyear,
+                    ti.stop_time   AS endyear,
+                    gf.name        AS fraction
+                FROM     sediment_load sy
+                    JOIN sediment_load_values syv
+                        ON sy.id = syv.sediment_load_id
+                    JOIN measurement_station ms
+                        ON ms.id = syv.measurement_station_id
+                    JOIN rivers r ON ms.river_id = r.id
+                    JOIN time_intervals ti ON sy.time_interval_id = ti.id
+                    JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id
+                WHERE   r.id = ${river_id}
+                    AND ti.stop_time IS NOT NULL
+                    AND ms.station BETWEEN ${fromkm} AND ${tokm}
+                ORDER BY fraction, startyear DESC, endyear DESC
+              </dc:statement>
+              <dc:call-macro name="loads">
+                <dc:call-macro name="epoch-load"/>
+              </dc:call-macro>
+            </dc:context>
+          </epochs>
+        </measurement_stations>
+        <sediment_load_ls>
+          <years>
+            <dc:context>
+              <dc:statement>
+                SELECT DISTINCT
+                    sy.id          AS syid,
+                    sy.description AS description,
+                    ti.start_time  AS year,
+                    gf.name        AS fraction
+                FROM     sediment_load_ls sy
+                    JOIN rivers r ON sy.river_id = r.id
+                    JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id
+                    JOIN time_intervals ti ON sy.time_interval_id = ti.id
+                    JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id
+                WHERE   r.id = ${river_id}
+                    AND ti.stop_time IS NULL
+                    AND syv.station BETWEEN ${fromkm} AND ${tokm}
+                ORDER BY fraction, year DESC
+              </dc:statement>
+              <dc:call-macro name="loads">
+                <dc:call-macro name="one-load_ls"/>
+              </dc:call-macro>
+            </dc:context>
+          </years>
+          <epochs>
+            <dc:context>
+              <dc:statement>
+                SELECT DISTINCT
+                    sy.id          AS syid,
+                    sy.description AS description,
+                    ti.start_time  AS startyear,
+                    ti.stop_time   AS endyear,
+                    gf.name        AS fraction
+                FROM     sediment_load_ls sy
+                    JOIN rivers r ON sy.river_id = r.id
+                    JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id
+                    JOIN time_intervals ti ON sy.time_interval_id = ti.id
+                    JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id
+                WHERE   r.id = ${river_id}
+                    AND ti.stop_time IS NOT NULL
+                    AND syv.station BETWEEN ${fromkm} AND ${tokm}
+                ORDER BY fraction, startyear DESC, endyear DESC
+              </dc:statement>
+              <dc:call-macro name="loads">
+                <dc:call-macro name="epoch-load_ls"/>
+              </dc:call-macro>
+            </dc:context>
+          </epochs>
+        </sediment_load_ls>
       </yields>
     </dc:macro>
 

http://dive4elements.wald.intevation.org