Mercurial > dive4elements > river
changeset 4098:9215253ad0be
Do the FLYS/AFT description pairing of discharge tables in case a gauge needs updates.
flys-aft/trunk@3619 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 06 Jan 2012 18:54:00 +0000 |
parents | 83c72bc07591 |
children | 006e99437fb9 |
files | flys-aft/ChangeLog flys-aft/src/main/java/de/intevation/aft/River.java |
diffstat | 2 files changed, 44 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-aft/ChangeLog Fri Jan 06 18:32:08 2012 +0000 +++ b/flys-aft/ChangeLog Fri Jan 06 18:54:00 2012 +0000 @@ -1,3 +1,10 @@ +2012-01-06 Sascha L. Teichmann <sascha.teichmann@inteavtion.de> + + * src/main/java/de/intevation/aft/River.java: Do the pairing + of discharge table of a gauge that needs updates. TODO: + Build the W/Q difference of found FLYS/AFT matches and + create the discharge tables in FLYS that are found in AFT. + 2012-01-06 Sascha L. Teichmann <sascha.teichmann@inteavtion.de> * src/main/resources/sql/flys-common.properties: Added statement
--- a/flys-aft/src/main/java/de/intevation/aft/River.java Fri Jan 06 18:32:08 2012 +0000 +++ b/flys-aft/src/main/java/de/intevation/aft/River.java Fri Jan 06 18:54:00 2012 +0000 @@ -152,7 +152,43 @@ DischargeTable.loadAftDischargeTables( context, gauge.getOfficialNumber()); - // TODO: Do pairing + Map<String, DischargeTable> desc2FlysDT = + new HashMap<String, DischargeTable>(); + + for (DischargeTable dt: flysDTs) { + String description = dt.getDescription(); + if (description == null) { + log.warn("FLYS: discharge table " + dt.getId() + + " has no description. Ignored."); + continue; + } + desc2FlysDT.put(description, dt); + } + + List<DischargeTable> createDTs = new ArrayList<DischargeTable>(); + + for (DischargeTable dt: aftDTs) { + String description = dt.getDescription(); + DischargeTable flysDT = desc2FlysDT.remove(description); + if (flysDT != null) { + // Found in AFT and FLYS. + log.info("FLYS: Discharge table '" + description + + "' found in AFT and FLYS. -> update"); + // TODO: Create the W/Q diff. + } + else { + log.info("FLYS: Discharge table '" + description + + "' not found in FLYS. -> create"); + createDTs.add(dt); + } + } + + for (String description: desc2FlysDT.keySet()) { + log.info("FLYS: Discharge table '" + description + + "' found in FLYS but not in AFT. -> ignore"); + } + + // TODO: Create the new discharge tables. return modified; }