Mercurial > dive4elements > river
changeset 8241:a65afd85d516
Suggestion: Load official epochs via recommendations instead of a pseudo-calculation.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 09 Sep 2014 10:53:50 +0200 |
parents | 61fd22f65bd4 |
children | f8ea1a7ecde6 |
files | artifacts/doc/conf/meta-data.xml artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/YearEpochSelect.java |
diffstat | 2 files changed, 85 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/doc/conf/meta-data.xml Mon Sep 08 19:48:17 2014 +0200 +++ b/artifacts/doc/conf/meta-data.xml Tue Sep 09 10:53:50 2014 +0200 @@ -115,6 +115,7 @@ </dc:when> <dc:when test="$out = 'sedimentload_ls'"> <dc:call-macro name="annotations"/> + <dc:call-macro name="sedimentload_off_epochs"/> </dc:when> <dc:when test="$out = 'bed_longitudinal_section'"> <dc:call-macro name="annotations"/> @@ -1441,7 +1442,7 @@ </dc:choose> <dc:if test="$kind = 'official'"> <dc:variable name="info" type="string" - expr="concat('Amtliche Epoche<BR>', $info)"/> + expr="concat('Amtliche Epoche<BR>', dc:get('info'))"/> </dc:if> <dc:macro-body/> </dc:for-each> @@ -3073,6 +3074,85 @@ </dc:if> </dc:macro> + + <dc:macro name="sedimentload_off_epoch_filter"> + <dc:if test="dc:has-result()"> + <dc:if test="string-length(dc:get('epochs')) > 0"> + <dc:variable name="start" type="number" + expr="dc:min-number(dc:find-all('\d{4}', $epochs))"/> + <dc:variable name="end" type="number" + expr="dc:max-number(dc:find-all('\d{4}', $epochs))"/> + </dc:if> + <dc:filter expr="not(number($end) < + number(dc:date-format('yyyy', $startyear)) + or number($start) > + number(dc:date-format('yyyy', $endyear)))"> + <dc:macro-body/> + </dc:filter> + </dc:if> + </dc:macro> + + <dc:macro name="sedimentload_off_epochs"> + <dc:variable name="sq_time_id" type="number" expr="number($sq_ti_id)"/> + <dc:context> + <dc:comment> data at measurement stations </dc:comment> + <dc:statement> + SELECT DISTINCT + sl.id AS slid, + slk.kind AS kind, + ti.start_time AS startyear, + ti.stop_time AS endyear, + gf.name AS fraction + FROM sediment_load sl + JOIN sediment_load_kinds slk ON slk.id = sl.kind + JOIN sediment_load_values slv + ON sl.id = slv.sediment_load_id + JOIN measurement_station ms + ON ms.id = slv.measurement_station_id + JOIN rivers r ON ms.river_id = r.id + JOIN time_intervals ti ON sl.time_interval_id = ti.id + JOIN grain_fraction gf ON gf.id = sl.grain_fraction_id + WHERE r.id = ${river_id} + AND sq_time_interval_id = ${sq_time_id} + AND ms.station BETWEEN ${fromkm} AND ${tokm} + AND slk.kind = 'official' + </dc:statement> + <dc:call-macro name="sedimentload_off_epoch_filter"> + <dc:call-macro name="loads"> + <dc:call-macro name="load"/> + </dc:call-macro> + </dc:call-macro> + </dc:context> + <dc:context> + <dc:comment> longitudinal sections </dc:comment> + <dc:statement> + SELECT DISTINCT + sl.id AS slid, + slk.kind AS kind, + ti.start_time AS startyear, + ti.stop_time AS endyear, + sq_time_interval_id AS sqid, + gf.name AS fraction + FROM sediment_load_ls sl + JOIN sediment_load_kinds slk ON slk.id = sl.kind + JOIN rivers r ON sl.river_id = r.id + JOIN sediment_load_ls_values slv + ON sl.id = slv.sediment_load_ls_id + JOIN time_intervals ti ON sl.time_interval_id = ti.id + JOIN grain_fraction gf ON gf.id = sl.grain_fraction_id + WHERE r.id = ${river_id} + AND sq_time_interval_id = ${sq_time_id} + AND slv.station BETWEEN ${fromkm} AND ${tokm} + AND slk.kind = 'official' + </dc:statement> + <dc:call-macro name="sedimentload_off_epoch_filter"> + <dc:call-macro name="loads"> + <dc:call-macro name="load_ls"/> + </dc:call-macro> + </dc:call-macro> + </dc:context> + </dc:macro> + <!-- Common stuff --> <dc:macro name="km-filtered-wsts">
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/YearEpochSelect.java Mon Sep 08 19:48:17 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/YearEpochSelect.java Tue Sep 09 10:53:50 2014 +0200 @@ -43,6 +43,8 @@ { CallMeta meta = context.getMeta(); Element[] elements; + + /* Disable calculation of official epochs if (((D4EArtifact)artifact).getCurrentStateId() .equals("state.minfo.sediment.load.year_epoch") ) { @@ -57,7 +59,8 @@ } else { elements = new Element[2]; - } + } */ + elements = new Element[2]; elements[0] = createItem( ec, new String[] {