[PATCH] Add SQ time interval to selection tree in datacage for sediment loads

Wald Commits scm-commit at wald.intevation.org
Fri Aug 22 17:43:40 CEST 2014


# HG changeset patch
# User "Tom Gottfried <tom at intevation.de>"
# Date 1408722216 -7200
# Node ID 82af749d5ab320f186354fdf75f40e6d78d02c72
# Parent  b57f4bcd0f6f1bf07cb8c850276784c5cea692eb
Add SQ time interval to selection tree in datacage for sediment loads.

diff -r b57f4bcd0f6f -r 82af749d5ab3 artifacts/doc/conf/meta-data.xml
--- 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')) > 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')) > 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">


More information about the Dive4Elements-commits mailing list