comparison artifacts/doc/conf/meta-data.xml @ 8431:f1bc081210ea

Load sounding width via recommendations for bed height differences and cleanup and fix related bed height macros.
author Tom Gottfried <tom@intevation.de>
date Fri, 17 Oct 2014 18:20:33 +0200
parents d7d74392cc46
children 48ed9019d8a1
comparison
equal deleted inserted replaced
8430:64e527208942 8431:f1bc081210ea
56 <dc:call-macro name="annotations"/> 56 <dc:call-macro name="annotations"/>
57 </dc:when> 57 </dc:when>
58 <dc:when test="$out = 'bed_difference_year'"> 58 <dc:when test="$out = 'bed_difference_year'">
59 <dc:call-macro name="annotations"/> 59 <dc:call-macro name="annotations"/>
60 <dc:call-macro name="basedata_6_delta_w"/> 60 <dc:call-macro name="basedata_6_delta_w"/>
61 <dc:call-macro name="sounding-width-recommendations"/>
61 </dc:when> 62 </dc:when>
62 <dc:when test="$out = 'bed_difference_height_year'"> 63 <dc:when test="$out = 'bed_difference_height_year'">
63 <dc:call-macro name="annotations"/> 64 <dc:call-macro name="annotations"/>
64 <dc:call-macro name="basedata_6_delta_w"/> 65 <dc:call-macro name="basedata_6_delta_w"/>
65 </dc:when> 66 </dc:when>
1796 </rastermap> 1797 </rastermap>
1797 </dc:macro> 1798 </dc:macro>
1798 1799
1799 <!-- bed heights --> 1800 <!-- bed heights -->
1800 <dc:macro name="minfo-heights-diff"> 1801 <dc:macro name="minfo-heights-diff">
1801 <dc:call-macro name="minfo-heights-years"> 1802 <dc:context>
1802 <dc:context> 1803 <dc:statement>
1803 <dc:statement>
1804 WITH sta 1804 WITH sta
1805 AS (SELECT bhs.id, 1805 AS (SELECT bhs.id,
1806 bhs.description, 1806 bhs.description,
1807 bhsv.station, 1807 bhsv.station,
1808 bhs.year 1808 bhs.year
1823 AND b1.id &lt;&gt; b2.id) 1823 AND b1.id &lt;&gt; b2.id)
1824 SELECT DISTINCT b1id, b1desc, b1year, 1824 SELECT DISTINCT b1id, b1desc, b1year,
1825 b2id, b2desc, b2year 1825 b2id, b2desc, b2year
1826 FROM csta 1826 FROM csta
1827 ORDER BY b1desc, b2desc 1827 ORDER BY b1desc, b2desc
1828 </dc:statement> 1828 </dc:statement>
1829 <dc:if test="dc:has-result()"> 1829 <dc:if test="dc:has-result()">
1830 <bedheights> 1830 <bedheights>
1831 <dc:call-macro name="bed-heights-single-diff"/> 1831 <dc:call-macro name="bed-heights-single-diff"/>
1832 <dc:call-macro name="bed-heights-epoch-diff"/> 1832 <dc:call-macro name="bed-heights-epoch-diff"/>
1833 </bedheights> 1833 </bedheights>
1834 </dc:if> 1834 </dc:if>
1835 </dc:context> 1835 </dc:context>
1836 </dc:call-macro>
1837 </dc:macro> 1836 </dc:macro>
1838 1837
1839 <dc:macro name="bed-heights-single-diff"> 1838 <dc:macro name="bed-heights-single-diff">
1840 <dc:filter expr="not(contains(dc:lowercase($b1desc), 'epoche'))"> 1839 <dc:filter expr="not(contains(dc:lowercase($b1desc), 'epoche'))">
1841 <years> 1840 <years>
1880 </dc:for-each> 1879 </dc:for-each>
1881 </minfo-diff> 1880 </minfo-diff>
1882 </dc:group> 1881 </dc:group>
1883 </dc:macro> 1882 </dc:macro>
1884 1883
1885 <dc:macro name="minfo-heights-years">
1886 <dc:comment>
1887 The input here is a list differenc ids noted in the
1888 form:
1889 [2726deb8-e71f-4acc-bc57-c7ae6062df2e;bedheight;0;FP-Mai2006vHW]#
1890 [df79ba16-7e2a-43d6-b15b-34dca1fd9bff;bedheight;0;FP-2007_0-286]#
1891 [027ba0ac-5453-4e63-a99b-1feeb82a4e06;bedheight;0;QP-2002nHW]#
1892 [26b9b6eb-1ce5-4011-83c7-b88e15e99870;bedheight;0;FP-Nov2008]
1893
1894 (Linebreaks inserted for readability)
1895
1896 We take this string and look for all 4 digit numbers (\d{4}) after
1897 we have removed the uuids from the input string (dc:replace all).
1898 On this list of numbers we use the dc:min/max-number functions to
1899 get the extreme values and interpret the result as a number.
1900 </dc:comment>
1901 <dc:choose>
1902 <dc:when test="dc:contains($parameters, 'diffids')">
1903 <dc:variable name="year_from" expr="
1904 dc:min-number(
1905 dc:find-all(
1906 '\d{4}',
1907 dc:replace-all(
1908 $diffids,
1909 '[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}', '')))"
1910 type="number"/>
1911 <dc:if test="$year_from = dc:min-number('x')">
1912 <dc:variable name="year_from" expr="0" type="number"/>
1913 </dc:if>
1914 <dc:variable name="year_to" expr="
1915 dc:max-number(
1916 dc:find-all(
1917 '\d{4}',
1918 dc:replace-all(
1919 $diffids,
1920 '[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}', '')))"
1921 type="number"/>
1922 <dc:if test="$year_to = dc:max-number('x')">
1923 <dc:variable name="year_to" expr="9999" type="number"/>
1924 </dc:if>
1925 </dc:when>
1926 <dc:otherwise>
1927 <dc:comment>Just show everything</dc:comment>
1928 <dc:variable name="year_to" expr="9999" type="number"/>
1929 <dc:variable name="year_from" expr="0" type="number"/>
1930 </dc:otherwise>
1931 </dc:choose>
1932 <dc:macro-body/>
1933 </dc:macro>
1934
1935 <dc:macro name="minfo-heights"> 1884 <dc:macro name="minfo-heights">
1936 <bedheights> 1885 <bedheights>
1937 <dc:call-macro name="bed-heights-single"/> 1886 <dc:call-macro name="bed-heights-single"/>
1938 <dc:call-macro name="bed-heights-epoch"/> 1887 <dc:call-macro name="bed-heights-epoch"/>
1939 </bedheights> 1888 </bedheights>
1975 </dc:filter> 1924 </dc:filter>
1976 </dc:context> 1925 </dc:context>
1977 </epoch> 1926 </epoch>
1978 </dc:macro> 1927 </dc:macro>
1979 1928
1929 <dc:macro name="sounding-width-factory">
1930 <dc:for-each>
1931 <height factory="bedheight"
1932 target_out="{$out}"
1933 ids="bedheight-soundings-{$bedh_id}-{$bedh_year}"
1934 info="{$info}"
1935 description="{$bedh_descr}"/>
1936 </dc:for-each>
1937 </dc:macro>
1938
1939 <dc:macro name="sounding-width">
1940 <dc:context>
1941 <dc:call-macro name="bed-heights-statement"/>
1942 <dc:if test="dc:has-result()">
1943 <soundings_width>
1944 <dc:call-macro name="sounding-width-factory"/>
1945 </soundings_width>
1946 </dc:if>
1947 </dc:context>
1948 </dc:macro>
1949
1950 <dc:macro name="sounding-width-recommendations">
1951 <dc:context>
1952 <dc:call-macro name="bed-heights-statement"/>
1953 <dc:filter expr="dc:contains($diffids, concat(';', $bedh_descr, ']'))">
1954 <dc:call-macro name="sounding-width-factory"/>
1955 </dc:filter>
1956 </dc:context>
1957 </dc:macro>
1958
1980 <dc:macro name="bed-heights-statement"> 1959 <dc:macro name="bed-heights-statement">
1981 <dc:statement> 1960 <dc:statement>
1982 SELECT bhs.id AS bedh_id, 1961 SELECT bhs.id AS bedh_id,
1983 bhs.year AS bedh_year, 1962 bhs.year AS bedh_year,
1984 bhs.description AS bedh_descr, 1963 bhs.description AS bedh_descr,
1988 '&lt;BR&gt;Höhensystem: ' || cur_em.name || 1967 '&lt;BR&gt;Höhensystem: ' || cur_em.name ||
1989 '&lt;BR&gt;ursprüngliches Höhensystem: ' || old_em.name || 1968 '&lt;BR&gt;ursprüngliches Höhensystem: ' || old_em.name ||
1990 '&lt;BR&gt;Strecke: ' || round(r.a, 1) || '-' || round(r.b, 1) || 1969 '&lt;BR&gt;Strecke: ' || round(r.a, 1) || '-' || round(r.b, 1) ||
1991 '&lt;BR&gt;Auswerter: ' || bhs.evaluation_by AS info 1970 '&lt;BR&gt;Auswerter: ' || bhs.evaluation_by AS info
1992 FROM bed_height_single bhs 1971 FROM bed_height_single bhs
1993 JOIN bed_height_type bht ON bht.id = bhs.type_id 1972 JOIN bed_height_type bht ON bht.id = bhs.type_id
1994 JOIN location_system ls ON ls.id = location_system_id 1973 JOIN location_system ls ON ls.id = location_system_id
1995 JOIN elevation_model cur_em ON cur_em.id = cur_elevation_model_id 1974 JOIN elevation_model cur_em ON cur_em.id = cur_elevation_model_id
1996 JOIN elevation_model old_em ON old_em.id = old_elevation_model_id 1975 LEFT JOIN elevation_model old_em
1997 JOIN ranges r ON r.id = range_id 1976 ON old_em.id = old_elevation_model_id
1977 LEFT JOIN ranges r ON r.id = range_id
1998 WHERE bhs.river_id = ${river_id} 1978 WHERE bhs.river_id = ${river_id}
1999 </dc:statement> 1979 </dc:statement>
2000 </dc:macro> 1980 </dc:macro>
2001 1981
2002 <!-- flow velocity --> 1982 <!-- flow velocity -->
2085 factory="morph-width" target_out="{$out}" /> 2065 factory="morph-width" target_out="{$out}" />
2086 </dc:for-each> 2066 </dc:for-each>
2087 </dc:context> 2067 </dc:context>
2088 </dc:for-each> 2068 </dc:for-each>
2089 </morph_width> 2069 </morph_width>
2090 </dc:if>
2091 </dc:context>
2092 </dc:macro>
2093
2094 <dc:macro name="sounding-width">
2095 <dc:context>
2096 <dc:call-macro name="bed-heights-statement"/>
2097 <dc:if test="dc:has-result()">
2098 <soundings_width>
2099 <dc:for-each>
2100 <height factory="bedheight"
2101 target_out="{$out}"
2102 ids="bedheight-soundings-{$bedh_id}-{$bedh_year}"
2103 info="{$info}"
2104 description="{$bedh_descr}"/>
2105 </dc:for-each>
2106 </soundings_width>
2107 </dc:if> 2070 </dc:if>
2108 </dc:context> 2071 </dc:context>
2109 </dc:macro> 2072 </dc:macro>
2110 2073
2111 <dc:macro name="sqrelations"> 2074 <dc:macro name="sqrelations">

http://dive4elements.wald.intevation.org