diff artifacts/doc/conf/meta-data.xml @ 8121:82af749d5ab3

Add SQ time interval to selection tree in datacage for sediment loads.
author "Tom Gottfried <tom@intevation.de>"
date Fri, 22 Aug 2014 17:43:36 +0200
parents b57f4bcd0f6f
children aca5d1c87755
line wrap: on
line diff
--- a/artifacts/doc/conf/meta-data.xml	Fri Aug 22 13:19:02 2014 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Fri Aug 22 17:43:36 2014 +0200
@@ -1450,16 +1450,21 @@
     </dc:macro>
 
     <dc:macro name="sedimentloads-filter">
-      <years>
-        <dc:filter expr="string-length(dc:get('endyear')) = 0" >
-          <dc:macro-body/>
-        </dc:filter>
-      </years>
-      <epochs>
-        <dc:filter expr="string-length(dc:get('endyear')) &gt; 0" >
-          <dc:macro-body/>
-        </dc:filter>
-      </epochs>
+      <dc:group expr="concat('SQ ', dc:date-format('yyyy', $sqstart), '-',
+                      dc:date-format('yyyy', $sqstop))">
+        <sq_time description="{dc:group-key()}">
+          <years>
+            <dc:filter expr="string-length(dc:get('endyear')) = 0" >
+              <dc:macro-body/>
+            </dc:filter>
+          </years>
+          <epochs>
+            <dc:filter expr="string-length(dc:get('endyear')) &gt; 0" >
+              <dc:macro-body/>
+            </dc:filter>
+          </epochs>
+        </sq_time>
+      </dc:group>
     </dc:macro>
 
     <dc:macro name="sedimentloads">
@@ -1477,6 +1482,8 @@
                   sy.description AS description,
                   ti.start_time  AS startyear,
                   ti.stop_time   AS endyear,
+                  sq.start_time  AS sqstart,
+                  sq.stop_time   AS sqstop,
                   gf.name        AS fraction
               FROM     sediment_load sy
                   JOIN sediment_load_values syv
@@ -1485,10 +1492,12 @@
                       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 time_intervals sq ON sy.sq_time_interval_id = sq.id
                   JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id
               WHERE   r.id = ${river_id}
                   AND ms.station BETWEEN ${fromkm} AND ${tokm}
-              ORDER BY fraction, startyear DESC, endyear DESC
+              ORDER BY sqstart DESC, sqstop DESC,
+                  fraction, startyear DESC, endyear DESC
             </dc:statement>
             <dc:call-macro name="sedimentloads-filter">
               <dc:call-macro name="loads">
@@ -1505,16 +1514,20 @@
                   sy.description AS description,
                   ti.start_time  AS startyear,
                   ti.stop_time   AS endyear,
+                  sq.start_time  AS sqstart,
+                  sq.stop_time   AS sqstop,
                   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 time_intervals sq ON sy.sq_time_interval_id = sq.id
                   JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id
               WHERE   r.id = ${river_id}
                   AND syv.station BETWEEN ${fromkm} AND ${tokm}
-              ORDER BY fraction, startyear DESC, endyear DESC
+              ORDER BY sqstart DESC, sqstop DESC,
+                  fraction, startyear DESC, endyear DESC
             </dc:statement>
             <dc:call-macro name="sedimentloads-filter">
               <dc:call-macro name="loads">

http://dive4elements.wald.intevation.org