Issue #2262 port scaleless_analysis to java
Change-Id: If59be97230f243859c02d7de6117bc9ed6c6b4af Former-commit-id: 68a70c091203c74f33dc17ff31c3707c2c4c2a5a
This commit is contained in:
parent
7c493b5562
commit
0e227df511
7 changed files with 1718 additions and 19 deletions
|
@ -15,7 +15,6 @@ Require-Bundle: org.eclipse.ui,
|
|||
com.raytheon.uf.common.geospatial;bundle-version="1.11.17",
|
||||
com.raytheon.viz.pointdata;bundle-version="1.11.17",
|
||||
com.raytheon.uf.common.pointdata;bundle-version="1.11.17",
|
||||
com.raytheon.edex.meteolib;bundle-version="1.11.17",
|
||||
com.raytheon.viz.core;bundle-version="1.11.17",
|
||||
javax.measure;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.colormap;bundle-version="1.11.17",
|
||||
|
@ -30,6 +29,7 @@ Export-Package: com.raytheon.uf.viz.objectiveanalysis.rsc
|
|||
Import-Package: com.raytheon.uf.common.comm,
|
||||
com.raytheon.uf.common.dataplugin.radar,
|
||||
com.raytheon.uf.common.gridcoverage,
|
||||
com.raytheon.uf.common.wxmath,
|
||||
com.raytheon.uf.viz.derivparam.library,
|
||||
com.raytheon.uf.viz.derivparam.tree,
|
||||
com.raytheon.viz.ui,
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.opengis.referencing.datum.PixelInCell;
|
|||
import org.opengis.referencing.operation.MathTransform;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.edex.meteoLib.Controller;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
|
@ -40,18 +39,22 @@ import com.raytheon.uf.common.pointdata.ParameterDescription;
|
|||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.pointdata.PointDataView;
|
||||
import com.raytheon.uf.common.util.GridUtil;
|
||||
import com.raytheon.uf.common.wxmath.DistFilter;
|
||||
import com.raytheon.uf.common.wxmath.ScalelessAnalysis;
|
||||
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Requests point data and performs objective analysis to map then data onto a
|
||||
* grid geometry.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 20, 2010 bsteffen Initial creation
|
||||
* May 20, 2010 bsteffen Initial creation
|
||||
* Aug 20, 2013 2262 njensen Use wxmath instead of meteolib
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -165,10 +168,10 @@ public class OAGridTransformer {
|
|||
if (!hasData) {
|
||||
return null;
|
||||
}
|
||||
float[] grid = new float[nx * ny];
|
||||
Controller.scaleless_analysis(xind, yind, values, size, nx, ny, grid);
|
||||
|
||||
grid = Controller.dist_filter(grid, smoothPts, nx, 0, 0, nx, ny);
|
||||
float[] grid = ScalelessAnalysis.scaleless_analysis(xind, yind, values,
|
||||
size, nx, ny);
|
||||
grid = DistFilter.filter(grid, smoothPts, nx, ny, 1);
|
||||
|
||||
for (int i = 0; i < grid.length; i++) {
|
||||
if (grid[i] > 1e36f) {
|
||||
|
|
|
@ -28,12 +28,13 @@ import org.geotools.coverage.grid.GeneralGridGeometry;
|
|||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.edex.meteoLib.Controller;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.pointdata.PointDataView;
|
||||
import com.raytheon.uf.common.util.GridUtil;
|
||||
import com.raytheon.uf.common.wxmath.DistFilter;
|
||||
import com.raytheon.uf.common.wxmath.ScalelessAnalysis;
|
||||
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.derivparam.library.DerivedParameterGenerator;
|
||||
|
@ -57,6 +58,7 @@ import com.raytheon.viz.grid.util.TiltUtils;
|
|||
* May 20, 2010 bsteffen Initial creation
|
||||
* Jun 04, 2013 2041 bsteffen Switch derived parameters to use
|
||||
* concurrent python for threading.
|
||||
* Aug 20, 2013 2262 njensen Use wxmath instead of meteolib
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -122,10 +124,10 @@ public class OATiltGridTransformer extends OAGridTransformer {
|
|||
if (!hasData) {
|
||||
return null;
|
||||
}
|
||||
float[] grid = new float[nx * ny];
|
||||
Controller.scaleless_analysis(xind, yind, values, size, nx, ny, grid);
|
||||
|
||||
grid = Controller.dist_filter(grid, smoothPts, nx, 0, 0, nx, ny);
|
||||
float[] grid = ScalelessAnalysis.scaleless_analysis(xind, yind, values,
|
||||
size, nx, ny);
|
||||
grid = DistFilter.filter(grid, smoothPts, nx, ny, 1);
|
||||
|
||||
for (int i = 0; i < grid.length; i++) {
|
||||
if (grid[i] > 1e36f) {
|
||||
|
|
|
@ -14,7 +14,6 @@ Require-Bundle: org.eclipse.ui,
|
|||
com.raytheon.viz.ui,
|
||||
com.raytheon.viz.pointdata,
|
||||
javax.measure,
|
||||
com.raytheon.edex.meteolib,
|
||||
org.jep;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.python;bundle-version="1.11.17",
|
||||
com.raytheon.uf.common.colormap;bundle-version="1.12.1174"
|
||||
|
@ -25,3 +24,4 @@ Export-Package: com.raytheon.viz.core.graphing,
|
|||
com.raytheon.viz.core.graphing.util,
|
||||
com.raytheon.viz.core.graphing.xy
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Import-Package: com.raytheon.uf.common.wxmath
|
||||
|
|
|
@ -23,7 +23,8 @@ import org.geotools.coverage.grid.GeneralGridEnvelope;
|
|||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.geotools.geometry.GeneralEnvelope;
|
||||
|
||||
import com.raytheon.edex.meteoLib.Controller;
|
||||
import com.raytheon.uf.common.wxmath.DistFilter;
|
||||
import com.raytheon.uf.common.wxmath.ScalelessAnalysis;
|
||||
import com.raytheon.uf.viz.core.interp.IInterpolation;
|
||||
import com.raytheon.uf.viz.core.interp.InterpolationRequest;
|
||||
import com.raytheon.uf.viz.core.interp.InterpolationResult;
|
||||
|
@ -31,14 +32,16 @@ import com.raytheon.viz.core.slice.request.HeightScale.ScaleType;
|
|||
|
||||
/**
|
||||
*
|
||||
* TODO Add Description
|
||||
* Interpolation which uses functionality from A1 meteolib to map scattered
|
||||
* points onto a grid.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 12, 2010 bsteffen Initial creation
|
||||
* May 12, 2010 bsteffen Initial creation
|
||||
* Aug 20, 2013 2262 njensen Use wxmath instead of meteolib
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -89,12 +92,11 @@ public class MeteolibInterpolation implements IInterpolation {
|
|||
z[i] = 1e37f;
|
||||
}
|
||||
}
|
||||
float[] grid = new float[(int) (gridX * gridY)];
|
||||
Controller.scaleless_analysis(x, y, z, x.length, (int) gridX,
|
||||
(int) gridY, grid);
|
||||
|
||||
float[] newgrid = Controller.dist_filter(grid, 5.0f, (int) gridX, 0, 0,
|
||||
float[] grid = ScalelessAnalysis.scaleless_analysis(x, y, z, x.length,
|
||||
(int) gridX, (int) gridY);
|
||||
float[] newgrid = DistFilter.filter(grid, 5.0f, (int) gridX,
|
||||
(int) gridY, 1);
|
||||
|
||||
for (int i = 0; i < grid.length; i++) {
|
||||
if (newgrid[i] < -999999 || newgrid[i] > 999999) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
86
tests/unit/com/raytheon/uf/common/wxmath/TestScaleless.java
Normal file
86
tests/unit/com/raytheon/uf/common/wxmath/TestScaleless.java
Normal file
|
@ -0,0 +1,86 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.wxmath;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Tests the Scaleless Analysis function.
|
||||
*
|
||||
* Note that the inputs were generated using a random number generator and then
|
||||
* thrown against the original compiled C to get the expected outputs. No idea
|
||||
* if the inputs would be considered valid values that are normally passed into
|
||||
* scaleless_analysis.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 16, 2013 njensen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class TestScaleless {
|
||||
|
||||
private static float[] randomXind = { 23, 34, 8, 48, 33, 40, 32, 24, 41,
|
||||
12, 9, 4, 2, 36, 30, 45, 5, 18, 1, 27, 13, 15, 25, 11, 0, 39, 37,
|
||||
17, 43, 49, 26, 6, 31, 22, 14, 7, 16, 3, 29, 20, 44, 46, 19, 10,
|
||||
21, 38, 35, 47, 28, 42 };
|
||||
|
||||
private static float[] randomYind = { 45, 38, 24, 48, 32, 46, 8, 9, 4, 27,
|
||||
47, 41, 17, 1, 13, 28, 31, 34, 14, 29, 42, 21, 6, 19, 20, 40, 44,
|
||||
49, 15, 16, 11, 23, 7, 39, 2, 0, 25, 26, 43, 12, 36, 30, 33, 37,
|
||||
22, 5, 18, 3, 10, 35 };
|
||||
|
||||
private static float[] randomValues = { 73, 70, 99, 28, 48, 52, 58, 98, 72,
|
||||
14, 34, 38, 12, 21, 66, 82, 86, 41, 62, 40, 0, 11, 56, 57, 95, 15,
|
||||
78, 9, 39, 27, 71, 61, 63, 8, 7, 84, 50, 44, 54, 91, 67, 37, 30,
|
||||
59, 2, 96, 53, 26, 32, 5 };
|
||||
|
||||
private static float[] randomExpected = { 59.24f, 58.61f, 57.02f, 56.65f,
|
||||
56.23f, 60.07f, 59.44f, 58.24f, 56.93f, 54.91f, 61.86f, 60.63f,
|
||||
59.08f, 57.93f, 55.30f, 63.19f, 62.30f, 60.40f, 59.55f, 55.34f,
|
||||
65.30f, 64.34f, 63.38f, 63.61f, 63.54f, 67.14f, 66.15f, 65.96f,
|
||||
67.74f, 72.88f, 67.91f, 67.48f, 68.24f, 69.68f, 71.17f, 72.22f,
|
||||
70.04f, 69.74f, 68.91f, 69.15f, 79.85f, 73.60f, 70.69f, 69.57f,
|
||||
67.02f, 77.09f, 74.62f, 72.06f, 71.51f, 69.78f };
|
||||
|
||||
@Test
|
||||
public void testRandomlyGeneratedData() {
|
||||
int nx = 5;
|
||||
int ny = 10;
|
||||
int nv = nx * ny;
|
||||
|
||||
float[] grid = ScalelessAnalysis.scaleless_analysis(randomXind,
|
||||
randomYind, randomValues, nv, nx, ny);
|
||||
for (int k = 0; k < nv; k++) {
|
||||
assertEquals(randomExpected[k], grid[k], 0.01f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue