Mercurial > dive4elements > river
comparison artifacts/doc/conf/meta-data.xml @ 8416:6399ebc6fce9
Reduce code duplication and repair filter for sediment load-recommendations.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 16 Oct 2014 11:15:09 +0200 |
parents | 17db08570637 |
children | d7d74392cc46 |
comparison
equal
deleted
inserted
replaced
8415:ffbeffe2d266 | 8416:6399ebc6fce9 |
---|---|
1652 </dc:filter> | 1652 </dc:filter> |
1653 </off_epochs> | 1653 </off_epochs> |
1654 </dc:macro> | 1654 </dc:macro> |
1655 | 1655 |
1656 <dc:macro name="sedimentloads"> | 1656 <dc:macro name="sedimentloads"> |
1657 <dc:comment> | |
1658 This is the macro for static datacage "Sedimentloads". | |
1659 Or "Frachten". | |
1660 </dc:comment> | |
1661 <sedimentloads> | 1657 <sedimentloads> |
1662 <dc:call-macro name="annotations_sediment_load_ls"/> | 1658 <dc:call-macro name="annotations_sediment_load_ls"/> |
1663 <measurement_stations> | 1659 <measurement_stations> |
1664 <dc:context> | 1660 <dc:context> |
1665 <dc:statement> | 1661 <dc:call-macro name="sedimentload_stations_statement"/> |
1666 SELECT DISTINCT | |
1667 sl.id AS slid, | |
1668 slk.kind AS kind, | |
1669 ti.start_time AS startyear, | |
1670 ti.stop_time AS endyear, | |
1671 sq.start_time AS sqstart, | |
1672 sq.stop_time AS sqstop, | |
1673 gf.name AS fraction, | |
1674 sl.description || '<BR>' || | |
1675 'Fraktion: ' || gf.lower || ' bis ' || gf.upper || | |
1676 ' mm<BR>Einheit: t/a' AS info | |
1677 FROM sediment_load sl | |
1678 JOIN sediment_load_kinds slk ON slk.id = sl.kind | |
1679 JOIN sediment_load_values slv | |
1680 ON sl.id = slv.sediment_load_id | |
1681 JOIN measurement_station ms | |
1682 ON ms.id = slv.measurement_station_id | |
1683 JOIN ranges ra ON ms.range_id = ra.id | |
1684 JOIN rivers r ON ra.river_id = r.id | |
1685 JOIN time_intervals ti ON sl.time_interval_id = ti.id | |
1686 LEFT JOIN time_intervals sq ON sl.sq_time_interval_id = sq.id | |
1687 JOIN grain_fraction gf ON gf.id = sl.grain_fraction_id | |
1688 WHERE r.id = ${river_id} | |
1689 AND CASE WHEN r.km_up = 1 AND ra.b IS NOT NULL | |
1690 THEN ra.b ELSE ra.a END BETWEEN ${fromkm} AND ${tokm} | |
1691 ORDER BY sqstart DESC, sqstop DESC, | |
1692 fraction, startyear DESC, endyear DESC | |
1693 </dc:statement> | |
1694 <dc:call-macro name="sedimentloads-filter"> | 1662 <dc:call-macro name="sedimentloads-filter"> |
1695 <dc:call-macro name="loads"> | 1663 <dc:call-macro name="loads"> |
1696 <dc:call-macro name="load"/> | 1664 <dc:call-macro name="load"/> |
1697 </dc:call-macro> | 1665 </dc:call-macro> |
1698 </dc:call-macro> | 1666 </dc:call-macro> |
1699 </dc:context> | 1667 </dc:context> |
1700 </measurement_stations> | 1668 </measurement_stations> |
1701 <sediment_load_ls> | 1669 <sediment_load_ls> |
1702 <dc:context> | 1670 <dc:context> |
1703 <dc:statement> | 1671 <dc:call-macro name="sedimentload_ls_statement"/> |
1704 SELECT DISTINCT | |
1705 sl.id AS slid, | |
1706 slk.kind AS kind, | |
1707 ti.start_time AS startyear, | |
1708 ti.stop_time AS endyear, | |
1709 sq.start_time AS sqstart, | |
1710 sq.stop_time AS sqstop, | |
1711 gf.name AS fraction, | |
1712 sl.description || '<BR>' || | |
1713 'Fraktion: ' || gf.lower || ' bis ' || gf.upper || | |
1714 ' mm<BR>Einheit: ' || u.name AS info | |
1715 FROM sediment_load_ls sl | |
1716 JOIN sediment_load_kinds slk ON slk.id = sl.kind | |
1717 JOIN rivers r ON sl.river_id = r.id | |
1718 JOIN sediment_load_ls_values slv | |
1719 ON sl.id = slv.sediment_load_ls_id | |
1720 JOIN time_intervals ti ON sl.time_interval_id = ti.id | |
1721 LEFT JOIN time_intervals sq ON sl.sq_time_interval_id = sq.id | |
1722 JOIN grain_fraction gf ON gf.id = sl.grain_fraction_id | |
1723 JOIN units u ON sl.unit_id = u.id | |
1724 WHERE r.id = ${river_id} | |
1725 AND slv.station BETWEEN ${fromkm} AND ${tokm} | |
1726 ORDER BY sqstart DESC, sqstop DESC, | |
1727 fraction, startyear DESC, endyear DESC | |
1728 </dc:statement> | |
1729 <dc:call-macro name="sedimentloads-filter"> | 1672 <dc:call-macro name="sedimentloads-filter"> |
1730 <dc:call-macro name="loads"> | 1673 <dc:call-macro name="loads"> |
1731 <dc:call-macro name="load_ls"/> | 1674 <dc:call-macro name="load_ls"/> |
1732 </dc:call-macro> | 1675 </dc:call-macro> |
1733 </dc:call-macro> | 1676 </dc:call-macro> |
1734 </dc:context> | 1677 </dc:context> |
1735 </sediment_load_ls> | 1678 </sediment_load_ls> |
1736 </sedimentloads> | 1679 </sedimentloads> |
1680 </dc:macro> | |
1681 | |
1682 <dc:macro name="sedimentload_stations_statement"> | |
1683 <dc:statement> | |
1684 SELECT DISTINCT | |
1685 sl.id AS slid, | |
1686 slk.kind AS kind, | |
1687 ti.start_time AS startyear, | |
1688 ti.stop_time AS endyear, | |
1689 sq.start_time AS sqstart, | |
1690 sq.stop_time AS sqstop, | |
1691 sq.id AS sqid, | |
1692 gf.name AS fraction, | |
1693 sl.description || '<BR>' || | |
1694 'Fraktion: ' || gf.lower || ' bis ' || gf.upper || | |
1695 ' mm<BR>Einheit: t/a' AS info | |
1696 FROM sediment_load sl | |
1697 JOIN sediment_load_kinds slk ON slk.id = sl.kind | |
1698 JOIN sediment_load_values slv | |
1699 ON sl.id = slv.sediment_load_id | |
1700 JOIN measurement_station ms | |
1701 ON ms.id = slv.measurement_station_id | |
1702 JOIN ranges ra ON ms.range_id = ra.id | |
1703 JOIN rivers r ON ra.river_id = r.id | |
1704 JOIN time_intervals ti ON sl.time_interval_id = ti.id | |
1705 LEFT JOIN time_intervals sq ON sl.sq_time_interval_id = sq.id | |
1706 JOIN grain_fraction gf ON gf.id = sl.grain_fraction_id | |
1707 WHERE r.id = ${river_id} | |
1708 AND CASE WHEN r.km_up = 1 AND ra.b IS NOT NULL | |
1709 THEN ra.b ELSE ra.a END BETWEEN ${fromkm} AND ${tokm} | |
1710 ORDER BY sqstart DESC, sqstop DESC, | |
1711 fraction, startyear DESC, endyear DESC | |
1712 </dc:statement> | |
1713 </dc:macro> | |
1714 | |
1715 <dc:macro name="sedimentload_ls_statement"> | |
1716 <dc:statement> | |
1717 SELECT DISTINCT | |
1718 sl.id AS slid, | |
1719 slk.kind AS kind, | |
1720 ti.start_time AS startyear, | |
1721 ti.stop_time AS endyear, | |
1722 sq.start_time AS sqstart, | |
1723 sq.stop_time AS sqstop, | |
1724 sq.id AS sqid, | |
1725 gf.name AS fraction, | |
1726 sl.description || '<BR>' || | |
1727 'Fraktion: ' || gf.lower || ' bis ' || gf.upper || | |
1728 ' mm<BR>Einheit: ' || u.name AS info | |
1729 FROM sediment_load_ls sl | |
1730 JOIN sediment_load_kinds slk ON slk.id = sl.kind | |
1731 JOIN rivers r ON sl.river_id = r.id | |
1732 JOIN sediment_load_ls_values slv | |
1733 ON sl.id = slv.sediment_load_ls_id | |
1734 JOIN time_intervals ti ON sl.time_interval_id = ti.id | |
1735 LEFT JOIN time_intervals sq ON sl.sq_time_interval_id = sq.id | |
1736 JOIN grain_fraction gf ON gf.id = sl.grain_fraction_id | |
1737 JOIN units u ON sl.unit_id = u.id | |
1738 WHERE r.id = ${river_id} | |
1739 AND slv.station BETWEEN ${fromkm} AND ${tokm} | |
1740 ORDER BY sqstart DESC, sqstop DESC, | |
1741 fraction, startyear DESC, endyear DESC | |
1742 </dc:statement> | |
1737 </dc:macro> | 1743 </dc:macro> |
1738 | 1744 |
1739 <!-- annotations --> | 1745 <!-- annotations --> |
1740 <dc:macro name="annotations"> | 1746 <dc:macro name="annotations"> |
1741 <annotation factory="annotations" ids="{$river_id}" target_out="{$out}"/> | 1747 <annotation factory="annotations" ids="{$river_id}" target_out="{$out}"/> |
3035 </dc:if> | 3041 </dc:if> |
3036 </dc:container-context> | 3042 </dc:container-context> |
3037 </dc:if> | 3043 </dc:if> |
3038 </dc:macro> | 3044 </dc:macro> |
3039 | 3045 |
3040 | 3046 <!-- sediment loads --> |
3041 <dc:macro name="sedimentload_off_epoch_filter"> | 3047 <dc:macro name="sedimentload_off_epoch_filter"> |
3042 <dc:if test="dc:has-result()"> | 3048 <dc:if test="dc:has-result()"> |
3043 <dc:if test="string-length(dc:get('epochs')) > 0"> | 3049 <dc:variable name="sq_time_id" type="number" |
3044 <dc:variable name="start" type="number" | 3050 expr="number($sq_ti_id)"/> |
3045 expr="dc:min-number(dc:find-all('\d{4}', $epochs))"/> | 3051 <dc:if test="string-length(dc:get('epochs')) > 0"> |
3046 <dc:variable name="end" type="number" | 3052 <dc:variable name="start" type="number" |
3047 expr="dc:max-number(dc:find-all('\d{4}', $epochs))"/> | 3053 expr="dc:min-number(dc:find-all('\d{4}', $epochs))"/> |
3048 </dc:if> | 3054 <dc:variable name="end" type="number" |
3049 <dc:filter expr="not(number($end) < | 3055 expr="dc:max-number(dc:find-all('\d{4}', $epochs))"/> |
3050 number(dc:date-format('yyyy', $startyear)) | 3056 </dc:if> |
3051 or number($start) > | 3057 <dc:filter expr="$kind = 'official' and |
3052 number(dc:date-format('yyyy', $endyear)))"> | 3058 $sqid = $sq_time_id and |
3053 <dc:macro-body/> | 3059 not(number($end) < |
3054 </dc:filter> | 3060 number(dc:date-format('yyyy', $startyear)) |
3055 </dc:if> | 3061 or number($start) > |
3062 number(dc:date-format('yyyy', $endyear)))"> | |
3063 <dc:macro-body/> | |
3064 </dc:filter> | |
3065 </dc:if> | |
3056 </dc:macro> | 3066 </dc:macro> |
3057 | 3067 |
3058 <dc:macro name="sedimentload_off_epochs"> | 3068 <dc:macro name="sedimentload_off_epochs"> |
3059 <dc:variable name="sq_time_id" type="number" expr="number($sq_ti_id)"/> | |
3060 <dc:context> | 3069 <dc:context> |
3061 <dc:comment> data at measurement stations </dc:comment> | 3070 <dc:call-macro name="sedimentload_stations_statement"/> |
3062 <dc:statement> | |
3063 SELECT DISTINCT | |
3064 sl.id AS slid, | |
3065 slk.kind AS kind, | |
3066 ti.start_time AS startyear, | |
3067 ti.stop_time AS endyear, | |
3068 gf.name AS fraction | |
3069 FROM sediment_load sl | |
3070 JOIN sediment_load_kinds slk ON slk.id = sl.kind | |
3071 JOIN sediment_load_values slv | |
3072 ON sl.id = slv.sediment_load_id | |
3073 JOIN measurement_station ms | |
3074 ON ms.id = slv.measurement_station_id | |
3075 JOIN ranges ra ON ms.range_id = ra.id | |
3076 JOIN rivers r ON ra.river_id = r.id | |
3077 JOIN time_intervals ti ON sl.time_interval_id = ti.id | |
3078 JOIN grain_fraction gf ON gf.id = sl.grain_fraction_id | |
3079 WHERE r.id = ${river_id} | |
3080 AND sq_time_interval_id = ${sq_time_id} | |
3081 AND CASE WHEN r.km_up = 1 AND ra.b IS NOT NULL | |
3082 THEN ra.b ELSE ra.a END BETWEEN ${fromkm} AND ${tokm} | |
3083 AND slk.kind = 'official' | |
3084 </dc:statement> | |
3085 <dc:call-macro name="sedimentload_off_epoch_filter"> | 3071 <dc:call-macro name="sedimentload_off_epoch_filter"> |
3086 <dc:call-macro name="loads"> | 3072 <dc:call-macro name="loads"> |
3087 <dc:call-macro name="load"/> | 3073 <dc:call-macro name="load"/> |
3088 </dc:call-macro> | 3074 </dc:call-macro> |
3089 </dc:call-macro> | 3075 </dc:call-macro> |
3090 </dc:context> | 3076 </dc:context> |
3091 <dc:context> | 3077 <dc:context> |
3092 <dc:comment> longitudinal sections </dc:comment> | 3078 <dc:call-macro name="sedimentload_ls_statement"/> |
3093 <dc:statement> | |
3094 SELECT DISTINCT | |
3095 sl.id AS slid, | |
3096 slk.kind AS kind, | |
3097 ti.start_time AS startyear, | |
3098 ti.stop_time AS endyear, | |
3099 sq_time_interval_id AS sqid, | |
3100 gf.name AS fraction | |
3101 FROM sediment_load_ls sl | |
3102 JOIN sediment_load_kinds slk ON slk.id = sl.kind | |
3103 JOIN rivers r ON sl.river_id = r.id | |
3104 JOIN sediment_load_ls_values slv | |
3105 ON sl.id = slv.sediment_load_ls_id | |
3106 JOIN time_intervals ti ON sl.time_interval_id = ti.id | |
3107 JOIN grain_fraction gf ON gf.id = sl.grain_fraction_id | |
3108 WHERE r.id = ${river_id} | |
3109 AND sq_time_interval_id = ${sq_time_id} | |
3110 AND slv.station BETWEEN ${fromkm} AND ${tokm} | |
3111 AND slk.kind = 'official' | |
3112 </dc:statement> | |
3113 <dc:call-macro name="sedimentload_off_epoch_filter"> | 3079 <dc:call-macro name="sedimentload_off_epoch_filter"> |
3114 <dc:call-macro name="loads"> | 3080 <dc:call-macro name="loads"> |
3115 <dc:call-macro name="load_ls"/> | 3081 <dc:call-macro name="load_ls"/> |
3116 </dc:call-macro> | 3082 </dc:call-macro> |
3117 </dc:call-macro> | 3083 </dc:call-macro> |
3118 </dc:context> | 3084 </dc:context> |
3119 </dc:macro> | 3085 </dc:macro> |
3086 | |
3120 | 3087 |
3121 <!-- Common stuff --> | 3088 <!-- Common stuff --> |
3122 | 3089 |
3123 <dc:macro name="km-filtered-wsts"> | 3090 <dc:macro name="km-filtered-wsts"> |
3124 <dc:context connection="system"> | 3091 <dc:context connection="system"> |