Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java @ 4838:ac9a3d9576b4
merged.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 23 Jan 2013 11:15:35 +0100 |
parents | bcf25d8c183e |
children | 5f70c73b11ed |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java Wed Jan 23 11:14:41 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java Wed Jan 23 11:15:35 2013 +0100 @@ -209,5 +209,31 @@ } return max; } + + public static void removeNaNs(TDoubleArrayList [] arrays) { + + int dest = 0; + + int A = arrays.length; + int N = arrays[0].size(); + + OUTER: for (int i = 0; i < N; ++i) { + for (int j = 0; j < A; ++j) { + TDoubleArrayList a = arrays[j]; + double v = a.getQuick(i); + if (Double.isNaN(v)) { + continue OUTER; + } + a.setQuick(dest, v); + } + ++dest; + } + + if (dest < N) { + for (int i = 0; i < A; ++i) { + arrays[i].remove(dest, N-dest); + } + } + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :