From bf5b777b0dca4df0fd6788f2afeaaa3ac782cf99 Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Fri, 7 Mar 2014 15:47:22 -0600 Subject: [PATCH] Issue #2791 Move DataSource/DataDestination to its own project, add DataFilter. Former-commit-id: 094086b5c2d0491f0fa7062398d535ec6fe04544 [formerly c0b478eb97419922d660c1085b6549e43bbbd00b] [formerly 9122b6da9985f5efc08e268efede13e1c924f4b1] [formerly 8650074737687a2514ae7a57c76e543386deca97 [formerly 9122b6da9985f5efc08e268efede13e1c924f4b1 [formerly ba5ff870337c7ac66d633077d84de867e5df967c]]] Former-commit-id: 8650074737687a2514ae7a57c76e543386deca97 Former-commit-id: b86eb15482eef7c6ed811b7be5a9d782dbcfa838 [formerly d3043fda5a90df2166cc6373fb44c7b62455955a] Former-commit-id: 5e4c35e93fe4802bb91a3a3a3ab517a4e79f523e --- .../META-INF/MANIFEST.MF | 3 +- .../core/tile/DataSourceTileImageCreator.java | 16 +- .../META-INF/MANIFEST.MF | 61 ++--- .../META-INF/MANIFEST.MF | 3 +- .../graphics/ext/KmlColormappedImage.java | 58 +++-- .../ext/KmlColormappedImageExtension.java | 2 +- .../ext/KmlGroundOverlayGenerator.java | 6 +- .../graphics/ext/KmlMosaicImageExtension.java | 14 +- .../META-INF/MANIFEST.MF | 7 +- .../npp/viirs/data/VIIRSRequestableData.java | 68 +++--- .../META-INF/MANIFEST.MF | 3 +- .../META-INF/MANIFEST.MF | 7 +- .../com/raytheon/uf/viz/qpf/Activator.java | 87 ------- .../META-INF/MANIFEST.MF | 7 +- .../rsc/CrossSectionImageResource.java | 22 +- .../META-INF/MANIFEST.MF | 18 +- .../rsc/TimeHeightImageResource.java | 22 +- .../META-INF/MANIFEST.MF | 7 +- .../core/contours/ContourCreateRequest.java | 2 +- .../viz/core/contours/ContourRenderable.java | 28 ++- .../viz/core/contours/ContourSupport.java | 16 +- .../rsc/displays/GriddedContourDisplay.java | 7 +- .../displays/GriddedStreamlineDisplay.java | 6 +- .../rsc/displays/GriddedVectorDisplay.java | 8 +- .../viz/core/contours/util/FortConBuf.java | 10 +- .../viz/core/contours/util/StrmPak.java | 6 +- .../META-INF/MANIFEST.MF | 18 +- ...f.common.serialization.ISerializableObject | 2 - .../raytheon/viz/dataaccess/Activator.java | 50 ---- .../rsc/grid/GenericGridResource.java | 15 +- .../com.raytheon.viz.gfe/META-INF/MANIFEST.MF | 3 +- .../META-INF/MANIFEST.MF | 62 +++-- .../src/com/raytheon/viz/grid/Activator.java | 75 ------ .../viz/grid/rsc/GriddedIconDisplay.java | 2 +- .../raytheon/viz/grid/rsc/RcmResource.java | 2 +- .../rsc/general/AbstractGridResource.java | 6 +- .../viz/grid/rsc/general/D2DGridResource.java | 6 +- .../rsc/general/DifferenceGridResource.java | 2 +- .../viz/grid/rsc/general/GeneralGridData.java | 67 +++--- .../grid/rsc/general/GridMemoryManager.java | 10 +- .../META-INF/MANIFEST.MF | 5 +- .../META-INF/MANIFEST.MF | 7 +- .../plugin/satellite/dao/SatelliteDao.java | 40 ++-- .../feature.xml | 6 + .../META-INF/MANIFEST.MF | 7 +- .../uf/common/dataaccess/grid/IGridData.java | 8 +- .../impl/AbstractGridDataPluginFactory.java | 2 +- .../dataaccess/impl/DefaultGridData.java | 4 +- .../dataaccess/response/GridResponseData.java | 14 +- .../dataaccess/util/DataWrapperUtil.java | 74 ++---- .../META-INF/MANIFEST.MF | 7 +- .../uf/common/dataplugin/gfe/RemapGrid.java | 50 ++-- .../gfe/dataaccess/GFEGridFactory.java | 14 +- .../META-INF/MANIFEST.MF | 9 +- .../dataaccess/GridDataAccessFactory.java | 2 +- .../META-INF/MANIFEST.MF | 7 +- .../radar/dataaccess/RadarGridFactory.java | 17 +- .../META-INF/MANIFEST.MF | 6 +- .../dataaccess/SatelliteGridFactory.java | 2 +- .../META-INF/MANIFEST.MF | 17 +- .../geospatial/data/GeographicDataSource.java | 158 +++++++++++++ .../data/UnitConvertingDataFilter.java | 71 ++++++ .../interpolation/BicubicInterpolation.java | 2 +- .../interpolation/BilinearInterpolation.java | 2 +- .../interpolation/GridDownscaler.java | 4 +- .../interpolation/GridReprojection.java | 4 +- .../GridReprojectionDataSource.java | 2 +- .../geospatial/interpolation/GridSampler.java | 2 +- .../interpolation/Interpolation.java | 2 +- .../interpolation/LatLonGridSampler.java | 2 +- .../NearestNeighborInterpolation.java | 2 +- .../data/AbstractDataWrapper.java | 142 ----------- .../interpolation/data/ByteArrayWrapper.java | 117 --------- .../interpolation/data/DataWrapper1D.java | 73 ------ .../interpolation/data/FloatArrayWrapper.java | 80 ------- .../interpolation/data/IntArrayWrapper.java | 80 ------- .../interpolation/data/ShortArrayWrapper.java | 80 ------- .../data/UnitConvertingDataDestination.java | 71 ------ .../data/UnsignedByteArrayWrapper.java | 66 ------ .../data/UnsignedByteBufferWrapper.java | 85 ------- .../data/UnsignedShortArrayWrapper.java | 65 ----- .../data/UnsignedShortBufferWrapper.java | 84 ------- .../com.raytheon.uf.common.numeric/.classpath | 7 + .../com.raytheon.uf.common.numeric/.project | 28 +++ .../.settings/org.eclipse.jdt.core.prefs | 7 + .../.settings/org.eclipse.pde.core.prefs | 4 + .../META-INF/MANIFEST.MF | 13 + .../build.properties | 4 + .../uf/common/numeric}/DataUtilities.java | 38 ++- .../numeric/array}/FloatArray2DWrapper.java | 42 ++-- .../common/numeric/buffer/BufferWrapper.java | 222 ++++++++++++++++++ .../numeric/buffer}/ByteBufferWrapper.java | 49 ++-- .../numeric/buffer}/DoubleBufferWrapper.java | 49 ++-- .../numeric/buffer}/FloatBufferWrapper.java | 49 ++-- .../numeric/buffer}/IntBufferWrapper.java | 49 ++-- .../numeric/buffer/LongBufferWrapper.java | 98 ++++++++ .../numeric/buffer}/ShortBufferWrapper.java | 51 ++-- .../common/numeric/dest}/DataDestination.java | 9 +- .../numeric/dest/FilteredDataDestination.java | 88 +++++++ .../uf/common/numeric/filter/DataFilter.java} | 40 +--- .../numeric/filter/FillValueFilter.java | 70 ++++++ .../numeric/filter/InvalidRangeFilter.java} | 38 +-- .../filter/InverseFillValueFilter.java | 73 ++++++ .../common/numeric/filter/UnsignedFilter.java | 68 ++++++ .../numeric/filter/ValidRangeFilter.java | 73 ++++++ .../source}/AbstractTiledDataSource.java | 3 +- .../numeric/source}/AxisSwapDataSource.java | 2 +- .../uf/common/numeric/source}/DataSource.java | 20 +- .../numeric/source/FilteredDataSource.java | 88 +++++++ .../numeric/source}/OffsetDataSource.java | 2 +- .../META-INF/MANIFEST.MF | 12 +- .../uf/common/topo/CachedTopoQuery.java | 5 +- .../uf/common/topo/TiledTopoSource.java | 43 ++-- .../META-INF/MANIFEST.MF | 3 +- .../database/plugin/DataRecordWrapUtil.java | 121 ---------- .../database/plugin/DownscaleStoreUtil.java | 55 +++-- .../META-INF/MANIFEST.MF | 27 ++- .../grid/staticdata/topo/StaticTopoData.java | 7 +- .../META-INF/MANIFEST.MF | 3 +- .../edex/plugin/npp/viirs/dao/VIIRSDao.java | 40 +++- .../npp/viirs/dao/VIIRSDataSourceWrapper.java | 2 +- .../npp/viirs/scaling/VIIRSDataScaler.java | 156 ------------ .../META-INF/MANIFEST.MF | 3 +- .../dataplugin/mcidas/dao/McidasDao.java | 16 +- .../META-INF/MANIFEST.MF | 3 +- .../viz/cloudHeight/CloudHeightProcesser.java | 10 +- .../META-INF/MANIFEST.MF | 3 +- 127 files changed, 1930 insertions(+), 2169 deletions(-) delete mode 100644 cave/com.raytheon.uf.viz.qpf/src/com/raytheon/uf/viz/qpf/Activator.java delete mode 100644 cave/com.raytheon.viz.dataaccess/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject delete mode 100644 cave/com.raytheon.viz.dataaccess/src/com/raytheon/viz/dataaccess/Activator.java delete mode 100644 cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/Activator.java create mode 100644 edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/data/GeographicDataSource.java create mode 100644 edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/data/UnitConvertingDataFilter.java delete mode 100644 edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/AbstractDataWrapper.java delete mode 100644 edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/ByteArrayWrapper.java delete mode 100644 edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DataWrapper1D.java delete mode 100644 edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/FloatArrayWrapper.java delete mode 100644 edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/IntArrayWrapper.java delete mode 100644 edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/ShortArrayWrapper.java delete mode 100644 edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnitConvertingDataDestination.java delete mode 100644 edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedByteArrayWrapper.java delete mode 100644 edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedByteBufferWrapper.java delete mode 100644 edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedShortArrayWrapper.java delete mode 100644 edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedShortBufferWrapper.java create mode 100644 edexOsgi/com.raytheon.uf.common.numeric/.classpath create mode 100644 edexOsgi/com.raytheon.uf.common.numeric/.project create mode 100644 edexOsgi/com.raytheon.uf.common.numeric/.settings/org.eclipse.jdt.core.prefs create mode 100644 edexOsgi/com.raytheon.uf.common.numeric/.settings/org.eclipse.pde.core.prefs create mode 100644 edexOsgi/com.raytheon.uf.common.numeric/META-INF/MANIFEST.MF create mode 100644 edexOsgi/com.raytheon.uf.common.numeric/build.properties rename edexOsgi/{com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data => com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric}/DataUtilities.java (68%) rename edexOsgi/{com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data => com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/array}/FloatArray2DWrapper.java (62%) create mode 100644 edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/BufferWrapper.java rename edexOsgi/{com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data => com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer}/ByteBufferWrapper.java (67%) rename edexOsgi/{com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data => com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer}/DoubleBufferWrapper.java (67%) rename edexOsgi/{com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data => com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer}/FloatBufferWrapper.java (67%) rename edexOsgi/{com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data => com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer}/IntBufferWrapper.java (67%) create mode 100644 edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/LongBufferWrapper.java rename edexOsgi/{com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data => com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer}/ShortBufferWrapper.java (64%) rename edexOsgi/{com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data => com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/dest}/DataDestination.java (79%) create mode 100644 edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/dest/FilteredDataDestination.java rename edexOsgi/{com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnitConvertingDataSource.java => com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/DataFilter.java} (51%) create mode 100644 edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/FillValueFilter.java rename edexOsgi/{com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/InvalidRangeDataSource.java => com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/InvalidRangeFilter.java} (55%) create mode 100644 edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/InverseFillValueFilter.java create mode 100644 edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/UnsignedFilter.java create mode 100644 edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/ValidRangeFilter.java rename edexOsgi/{com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data => com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source}/AbstractTiledDataSource.java (97%) rename edexOsgi/{com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data => com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source}/AxisSwapDataSource.java (95%) rename edexOsgi/{com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data => com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source}/DataSource.java (62%) create mode 100644 edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/FilteredDataSource.java rename edexOsgi/{com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data => com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source}/OffsetDataSource.java (96%) delete mode 100644 edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/DataRecordWrapUtil.java delete mode 100644 edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/src/com/raytheon/uf/edex/plugin/npp/viirs/scaling/VIIRSDataScaler.java diff --git a/cave/com.raytheon.uf.viz.core/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.core/META-INF/MANIFEST.MF index ad13b27526..43d029ca97 100644 --- a/cave/com.raytheon.uf.viz.core/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.core/META-INF/MANIFEST.MF @@ -37,7 +37,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.velocity;bundle-version="1.0.0", ch.qos.logback;bundle-version="1.0.13", com.raytheon.uf.common.style;bundle-version="1.0.0", - org.reflections;bundle-version="0.9.9" + org.reflections;bundle-version="0.9.9", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Bundle-ActivationPolicy: lazy Eclipse-BuddyPolicy: ext, registered, global Eclipse-RegisterBuddy: org.apache.velocity, com.raytheon.uf.common.serialization, com.raytheon.uf.common.serialization.comm, com.raytheon.uf.common.status, com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.comm, ch.qos.logback diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/tile/DataSourceTileImageCreator.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/tile/DataSourceTileImageCreator.java index 6ea2c24117..b5ab8bff12 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/tile/DataSourceTileImageCreator.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/tile/DataSourceTileImageCreator.java @@ -13,14 +13,14 @@ import org.geotools.coverage.grid.GeneralGridGeometry; import com.raytheon.uf.common.colormap.image.ColorMapData; import com.raytheon.uf.common.colormap.image.ColorMapData.ColorMapDataType; -import com.raytheon.uf.common.geospatial.interpolation.data.ByteBufferWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.DataDestination; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.DataUtilities; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatBufferWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.IntBufferWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.OffsetDataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.ShortBufferWrapper; +import com.raytheon.uf.common.numeric.DataUtilities; +import com.raytheon.uf.common.numeric.buffer.ByteBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.IntBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.ShortBufferWrapper; +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.source.DataSource; +import com.raytheon.uf.common.numeric.source.OffsetDataSource; import com.raytheon.uf.viz.core.DrawableImage; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget.RasterMode; diff --git a/cave/com.raytheon.uf.viz.d2d.gfe/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.d2d.gfe/META-INF/MANIFEST.MF index c79534fb82..eab6ba7575 100644 --- a/cave/com.raytheon.uf.viz.d2d.gfe/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.d2d.gfe/META-INF/MANIFEST.MF @@ -2,57 +2,32 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GFE in D2D Bundle-SymbolicName: com.raytheon.uf.viz.d2d.gfe;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Activator: com.raytheon.uf.viz.d2d.gfe.Activator Bundle-Vendor: RAYTHEON -Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.uf.viz.core -Require-Bundle: org.eclipse.core.runtime, - com.raytheon.uf.common.serialization;bundle-version="1.12.1174", - com.raytheon.uf.common.dataplugin.gfe;bundle-version="1.12.1174", - com.raytheon.uf.common.colormap;bundle-version="1.12.1174" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy -Import-Package: com.raytheon.uf.common.dataplugin, - com.raytheon.uf.common.dataquery.requests, - com.raytheon.uf.common.dataquery.responses, - com.raytheon.uf.common.datastorage.records, - com.raytheon.uf.common.geospatial, - com.raytheon.uf.common.geospatial.interpolation, - com.raytheon.uf.common.localization, - com.raytheon.uf.common.message, +Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0", + org.eclipse.ui;bundle-version="3.8.0", + com.raytheon.uf.viz.core;bundle-version="1.14.2", + com.raytheon.uf.common.serialization, com.raytheon.uf.common.serialization.comm, + com.raytheon.uf.common.dataplugin.gfe, + com.raytheon.viz.grid;bundle-version="1.14.0", + com.raytheon.uf.common.colormap, + com.raytheon.uf.common.dataplugin, + com.raytheon.uf.common.dataquery, + com.raytheon.uf.common.numeric;bundle-version="1.14.0", + com.raytheon.uf.common.geospatial;bundle-version="1.14.0", + com.raytheon.uf.common.localization;bundle-version="1.14.0", + com.raytheon.viz.core.graphing, com.raytheon.uf.common.status, + com.raytheon.uf.viz.xy.timeseries;bundle-version="1.13.0", com.raytheon.uf.common.style, - com.raytheon.uf.common.style.level, - com.raytheon.uf.common.time, - com.raytheon.uf.viz.core, - com.raytheon.uf.viz.core.catalog, - com.raytheon.uf.viz.core.datastructure, - com.raytheon.uf.viz.core.drawables, - com.raytheon.uf.viz.core.exception, - com.raytheon.uf.viz.core.requests, - com.raytheon.uf.viz.core.rsc, - com.raytheon.uf.viz.core.rsc.capabilities, - com.raytheon.uf.viz.core.status, com.raytheon.uf.viz.productbrowser, - com.raytheon.uf.viz.xy.timeseries, - com.raytheon.uf.viz.xy.timeseries.adapter, - com.raytheon.uf.viz.xy.timeseries.rsc, - com.raytheon.viz.core.contours, - com.raytheon.viz.core.graphing.xy, - com.raytheon.viz.grid.rsc, - com.raytheon.viz.grid.rsc.general, - com.raytheon.viz.volumebrowser.datacatalog, - com.raytheon.viz.volumebrowser.vbui, - com.vividsolutions.jts.geom, - javax.measure.unit, - jep, - org.eclipse.swt.graphics, - org.geotools.coverage.grid, - org.geotools.geometry, - org.opengis.geometry, - org.opengis.metadata.spatial, - org.opengis.referencing.operation + com.raytheon.viz.volumebrowser;bundle-version="1.13.0", + javax.measure, + org.jep Export-Package: com.raytheon.uf.viz.d2d.gfe, com.raytheon.uf.viz.d2d.gfe.browser, com.raytheon.uf.viz.d2d.gfe.rsc, diff --git a/cave/com.raytheon.uf.viz.kml.export/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.kml.export/META-INF/MANIFEST.MF index b2b52de7ab..0b1db5f9a9 100644 --- a/cave/com.raytheon.uf.viz.kml.export/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.kml.export/META-INF/MANIFEST.MF @@ -10,11 +10,12 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0", com.raytheon.uf.viz.core;bundle-version="1.14.1", com.raytheon.viz.ui;bundle-version="1.14.0", de.micromata.opengis.kml, - com.raytheon.uf.common.geospatial, + com.raytheon.uf.common.geospatial;bundle-version="1.14.0", com.raytheon.uf.common.colormap, com.raytheon.uf.common.time, com.raytheon.uf.viz.core.maps, com.raytheon.viz.pointdata, com.raytheon.viz.radar, + com.raytheon.uf.common.numeric;bundle-version="1.14.0", javax.measure Export-Package: com.raytheon.uf.viz.kml.export diff --git a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlColormappedImage.java b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlColormappedImage.java index 97ad19fbb4..a13bb2346d 100644 --- a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlColormappedImage.java +++ b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlColormappedImage.java @@ -19,6 +19,7 @@ **/ package com.raytheon.uf.viz.kml.export.graphics.ext; +import java.awt.Rectangle; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; @@ -30,13 +31,13 @@ import org.geotools.coverage.grid.GridGeometry2D; import com.raytheon.uf.common.colormap.image.ColorMapData; import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; -import com.raytheon.uf.common.geospatial.interpolation.data.ByteBufferWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatBufferWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.IntBufferWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.ShortBufferWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.UnsignedByteBufferWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.UnsignedShortBufferWrapper; +import com.raytheon.uf.common.geospatial.data.GeographicDataSource; +import com.raytheon.uf.common.numeric.buffer.ByteBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.IntBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.ShortBufferWrapper; +import com.raytheon.uf.common.numeric.filter.UnsignedFilter; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback; import com.raytheon.uf.viz.core.drawables.IColormappedImage; import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension; @@ -55,6 +56,8 @@ import com.raytheon.uf.viz.core.exception.VizException; * ------------- -------- ----------- -------------------------- * Jun 01, 2012 bsteffen Initial creation * Jan 23, 2014 2703 bsteffen Use data to get width and height. + * Mar 07, 2014 2791 bsteffen Move Data Source/Destination to numeric + * plugin. * * * @@ -90,33 +93,45 @@ public class KmlColormappedImage extends KmlImage implements IColormappedImage { public DataSource getData(GridGeometry2D geometry) throws VizException { loadData(); + Rectangle gridRange = geometry.getGridRange2D(); + DataSource source = null; switch (data.getDataType()) { case FLOAT: - return new FloatBufferWrapper(((FloatBuffer) data.getBuffer()), - geometry); + source = new FloatBufferWrapper(((FloatBuffer) data.getBuffer()), + gridRange); + break; case BYTE: { - return new UnsignedByteBufferWrapper( - ((ByteBuffer) data.getBuffer()), geometry); + source = UnsignedFilter.apply(new ByteBufferWrapper( + ((ByteBuffer) data.getBuffer()), gridRange)); + break; } case SIGNED_BYTE: { - return new ByteBufferWrapper(((ByteBuffer) data.getBuffer()), - geometry); + source = new ByteBufferWrapper(((ByteBuffer) data.getBuffer()), + gridRange); + break; } case INT: { - return new IntBufferWrapper(((IntBuffer) data.getBuffer()), - geometry); + source = new IntBufferWrapper(((IntBuffer) data.getBuffer()), + gridRange); + break; } case SHORT: { - return new ShortBufferWrapper(((ShortBuffer) data.getBuffer()), - geometry); + source = new ShortBufferWrapper(((ShortBuffer) data.getBuffer()), + gridRange); + break; } case UNSIGNED_SHORT: { - return new UnsignedShortBufferWrapper( - ((ShortBuffer) data.getBuffer()), geometry); + source = UnsignedFilter.apply(new ShortBufferWrapper( + ((ShortBuffer) data.getBuffer()), gridRange)); + break; + } + default: { + throw new UnsupportedOperationException( + "Kml Export does not supprt image type: " + + data.getDataType()); } } - throw new UnsupportedOperationException( - "Kml Export does not supprt image type: " + data.getDataType()); + return new GeographicDataSource(source, geometry); } @@ -168,5 +183,4 @@ public class KmlColormappedImage extends KmlImage implements IColormappedImage { } } - } diff --git a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlColormappedImageExtension.java b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlColormappedImageExtension.java index 08fb27593f..9fa1e7acf1 100644 --- a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlColormappedImageExtension.java +++ b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlColormappedImageExtension.java @@ -41,7 +41,7 @@ import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; import com.raytheon.uf.common.geospatial.MapUtil; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; diff --git a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlGroundOverlayGenerator.java b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlGroundOverlayGenerator.java index b7b3a580d7..93316311c4 100644 --- a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlGroundOverlayGenerator.java +++ b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlGroundOverlayGenerator.java @@ -37,8 +37,8 @@ import com.raytheon.uf.common.geospatial.interpolation.GridReprojection; import com.raytheon.uf.common.geospatial.interpolation.Interpolation; import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation; import com.raytheon.uf.common.geospatial.interpolation.PrecomputedGridReprojection; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.viz.core.DrawableImage; import com.raytheon.uf.viz.core.PixelCoverage; import com.raytheon.uf.viz.kml.export.KmlFeatureGenerator; @@ -123,7 +123,7 @@ public abstract class KmlGroundOverlayGenerator extends KmlFeatureGenerator { } else { interp = new NearestNeighborInterpolation(); } - FloatArrayWrapper dst = new FloatArrayWrapper(dest); + FloatBufferWrapper dst = new FloatBufferWrapper(dest.getGridRange2D()); return reproj.reprojectedGrid(interp, data, dst).getArray(); } diff --git a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlMosaicImageExtension.java b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlMosaicImageExtension.java index 957b014e97..35b98891eb 100644 --- a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlMosaicImageExtension.java +++ b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlMosaicImageExtension.java @@ -33,10 +33,10 @@ import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; import com.raytheon.uf.common.geospatial.interpolation.Interpolation; import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation; -import com.raytheon.uf.common.geospatial.interpolation.data.AbstractDataWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.DataDestination; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; +import com.raytheon.uf.common.numeric.buffer.BufferWrapper; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; @@ -161,7 +161,7 @@ public class KmlMosaicImageExtension extends } GridGeometry2D geom = new GridGeometry2D(range, bigenv); // fullDest is the end location of reprojected data values - FloatArrayWrapper fullDest = new FloatArrayWrapper(geom); + FloatBufferWrapper fullDest = new FloatBufferWrapper(range); Arrays.fill(fullDest.getArray(), Float.NaN); Interpolation interp = new NearestNeighborInterpolation(); for (DrawableImage image : images) { @@ -223,12 +223,12 @@ public class KmlMosaicImageExtension extends private final Comparator mosaicComparator; - private final AbstractDataWrapper fullDest; + private final BufferWrapper fullDest; private final GridEnvelope2D envelope; public MosaicDataDestination(Comparator mosaicComparator, - AbstractDataWrapper fullDest, GridEnvelope2D envelope) { + BufferWrapper fullDest, GridEnvelope2D envelope) { this.mosaicComparator = mosaicComparator; this.fullDest = fullDest; this.envelope = envelope; diff --git a/cave/com.raytheon.uf.viz.npp.viirs/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.npp.viirs/META-INF/MANIFEST.MF index 37e903ce5e..9a5c0d3a2f 100644 --- a/cave/com.raytheon.uf.viz.npp.viirs/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.npp.viirs/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: VIIRS Satellite Bundle-SymbolicName: com.raytheon.uf.viz.npp.viirs;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Activator: com.raytheon.uf.viz.npp.viirs.Activator Bundle-Vendor: RAYTHEON Eclipse-RegisterBuddy: com.raytheon.uf.viz.core @@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, com.raytheon.uf.viz.core;bundle-version="1.12.1174", com.raytheon.uf.common.time;bundle-version="1.12.1174", - com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", + com.raytheon.uf.common.geospatial;bundle-version="1.14.0", com.raytheon.uf.common.colormap;bundle-version="1.12.1174", org.geotools;bundle-version="2.6.4", com.raytheon.uf.common.datastorage;bundle-version="1.12.1174", @@ -26,7 +26,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.comm;bundle-version="1.12.1174", com.raytheon.viz.alerts;bundle-version="1.12.1174", com.raytheon.uf.viz.npp;bundle-version="1.0.0", - com.raytheon.uf.common.style;bundle-version="1.0.0" + com.raytheon.uf.common.style;bundle-version="1.0.0", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.uf.viz.npp.viirs.rsc diff --git a/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/data/VIIRSRequestableData.java b/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/data/VIIRSRequestableData.java index 2ba431e40a..999cb7a774 100644 --- a/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/data/VIIRSRequestableData.java +++ b/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/data/VIIRSRequestableData.java @@ -26,7 +26,6 @@ import java.util.Map; import javax.measure.converter.UnitConverter; import javax.measure.unit.Unit; -import org.geotools.coverage.grid.GeneralGridGeometry; import org.geotools.coverage.grid.GridEnvelope2D; import org.geotools.coverage.grid.GridGeometry2D; import org.opengis.geometry.Envelope; @@ -40,12 +39,18 @@ import com.raytheon.uf.common.datastorage.Request; import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.datastorage.records.ShortDataRecord; +import com.raytheon.uf.common.geospatial.data.UnitConvertingDataFilter; import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation; import com.raytheon.uf.common.geospatial.interpolation.GridDownscaler; import com.raytheon.uf.common.geospatial.interpolation.GridReprojection; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.ShortArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.UnsignedShortArrayWrapper; +import com.raytheon.uf.common.numeric.DataUtilities; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.ShortBufferWrapper; +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.filter.FillValueFilter; +import com.raytheon.uf.common.numeric.filter.InverseFillValueFilter; +import com.raytheon.uf.common.numeric.filter.UnsignedFilter; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.viz.core.HDF5Util; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData; @@ -58,9 +63,11 @@ import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData; * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Jan 19, 2012 mschenke Initial creation + * Date Ticket# Engineer Description + * ------------- -------- ----------- -------------------------- + * Jan 19, 2012 mschenke Initial creation + * Mar 07, 2014 2791 bsteffen Move Data Source/Destination to numeric + * plugin. * * * @@ -152,8 +159,8 @@ public class VIIRSRequestableData extends AbstractRequestableData { double diffRatioY = recordLevelRect.getHeight() / requestLevelRect.getHeight(); - GeneralGridGeometry requestSliceGeometry = null; - GeneralGridGeometry recordSliceGeometry = null; + GridGeometry2D requestSliceGeometry = null; + GridGeometry2D recordSliceGeometry = null; Request req = request.request; Request recordRequest = req; @@ -212,19 +219,22 @@ public class VIIRSRequestableData extends AbstractRequestableData { GridReprojection reprojection = new GridReprojection( recordSliceGeometry, requestSliceGeometry); - UnsignedShortArrayWrapper dest = new UnsignedShortArrayWrapper( - requestSliceGeometry); - dest.setFillValue(noData); - UnsignedShortArrayWrapper source = new UnsignedShortArrayWrapper( + ShortBufferWrapper rawDest = new ShortBufferWrapper( + requestSliceGeometry.getGridRange2D()); + DataDestination dest = InverseFillValueFilter.apply( + (DataDestination) rawDest, noData); + ShortBufferWrapper rawSource = new ShortBufferWrapper( ((ShortDataRecord) record).getShortData(), - recordSliceGeometry); - source.setFillValue(noData); + recordSliceGeometry.getGridRange2D()); + DataSource source = UnsignedFilter.apply(rawSource); + + source = FillValueFilter.apply(source, noData); reprojection.reprojectedGrid(new BilinearInterpolation(), source, dest); ShortDataRecord scaled = new ShortDataRecord( record.getName(), record.getGroup(), - dest.getArray()); + rawDest.getArray()); copyRecord(scaled, record); // set correct sizes after copying attributes scaled.setIntSizes(new int[] { @@ -286,26 +296,16 @@ public class VIIRSRequestableData extends AbstractRequestableData { } float[] floatData = new float[width * height]; final UnitConverter converter = dataUnit.getConverterTo(Unit.ONE); - FloatArrayWrapper destination = new FloatArrayWrapper(floatData, - width, height) { - @Override - public void setDataValueInternal(double dataValue, int index) { - // Apply unit converter for each value - super.setDataValueInternal(converter.convert(dataValue), - index); - } - }; - destination.setFillValue(Float.NaN); - UnsignedShortArrayWrapper source = new UnsignedShortArrayWrapper( + DataDestination destination = new FloatBufferWrapper(floatData, + width, height); + destination = UnitConvertingDataFilter + .apply(destination, converter); + ShortBufferWrapper shortData = new ShortBufferWrapper( ((ShortDataRecord) record).getShortData(), width, height); - source.setFillValue(noDataValue); + DataSource source = UnsignedFilter.apply(shortData); + source = FillValueFilter.apply(source, noDataValue); - // For each point, set in destination - for (int y = 0; y < height; ++y) { - for (int x = 0; x < width; ++x) { - destination.setDataValue(source.getDataValue(x, y), x, y); - } - } + DataUtilities.copy(source, destination, width, height); // Create float data record from converted data FloatDataRecord fdr = new FloatDataRecord(record.getName(), diff --git a/cave/com.raytheon.uf.viz.objectiveanalysis/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.objectiveanalysis/META-INF/MANIFEST.MF index f6cff94a29..c9585bddbd 100644 --- a/cave/com.raytheon.uf.viz.objectiveanalysis/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.objectiveanalysis/META-INF/MANIFEST.MF @@ -23,7 +23,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.viz.sounding;bundle-version="1.11.17", com.raytheon.uf.common.dataplugin.bufrua;bundle-version="1.11.17", com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174", - com.raytheon.uf.common.style;bundle-version="1.0.0" + com.raytheon.uf.common.style;bundle-version="1.0.0", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.uf.viz.objectiveanalysis.rsc diff --git a/cave/com.raytheon.uf.viz.qpf/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.qpf/META-INF/MANIFEST.MF index fb190db6d5..c3062e5a25 100644 --- a/cave/com.raytheon.uf.viz.qpf/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.qpf/META-INF/MANIFEST.MF @@ -2,10 +2,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: QPF Plug-in Bundle-SymbolicName: com.raytheon.uf.viz.qpf;singleton:=true -Bundle-Version: 1.12.1174.qualifier -Bundle-Activator: com.raytheon.uf.viz.qpf.Activator +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON -Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, com.raytheon.uf.viz.core, @@ -19,7 +17,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.viz.pointdata;bundle-version="1.11.1", com.raytheon.uf.common.dataplugin.qpf;bundle-version="1.0.0", com.raytheon.uf.viz.productbrowser;bundle-version="1.12.1153", - com.raytheon.uf.common.style;bundle-version="1.0.0" + com.raytheon.uf.common.style;bundle-version="1.0.0", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.uf.viz.qpf diff --git a/cave/com.raytheon.uf.viz.qpf/src/com/raytheon/uf/viz/qpf/Activator.java b/cave/com.raytheon.uf.viz.qpf/src/com/raytheon/uf/viz/qpf/Activator.java deleted file mode 100644 index 5ab16c34ec..0000000000 --- a/cave/com.raytheon.uf.viz.qpf/src/com/raytheon/uf/viz/qpf/Activator.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 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.viz.qpf; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "com.raytheon.uf.viz.qpf"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given plug-in - * relative path - * - * @param path - * the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) { - return imageDescriptorFromPlugin(PLUGIN_ID, path); - } -} diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.xy.crosssection/META-INF/MANIFEST.MF index 933fb198d7..b8f68d7dc0 100644 --- a/cave/com.raytheon.uf.viz.xy.crosssection/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.xy.crosssection/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Require-Bundle: com.raytheon.uf.common.colormap, com.raytheon.uf.common.dataplugin, - com.raytheon.uf.common.geospatial, + com.raytheon.uf.common.geospatial;bundle-version="1.14.0", com.raytheon.uf.common.style, com.raytheon.uf.common.topo, com.raytheon.uf.common.wxmath, @@ -16,11 +16,12 @@ Require-Bundle: com.raytheon.uf.common.colormap, com.raytheon.uf.viz.d2d.core, com.raytheon.uf.viz.d2d.ui, com.raytheon.uf.viz.xy, - com.raytheon.viz.core.contours, + com.raytheon.viz.core.contours;bundle-version="1.14.0", com.raytheon.viz.core.graphing, javax.measure, org.eclipse.core.runtime;bundle-version="3.8.0", - org.eclipse.ui;bundle-version="3.8.0" + org.eclipse.ui;bundle-version="3.8.0", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Import-Package: com.raytheon.viz.core.imagery, com.raytheon.viz.core.map, com.raytheon.viz.core.rsc.jts diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionImageResource.java b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionImageResource.java index 29f23a5cd4..beeb039a15 100644 --- a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionImageResource.java +++ b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionImageResource.java @@ -35,7 +35,9 @@ import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation; import com.raytheon.uf.common.geospatial.interpolation.GridReprojection; import com.raytheon.uf.common.geospatial.interpolation.GridSampler; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.filter.ValidRangeFilter; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; @@ -67,11 +69,13 @@ import com.vividsolutions.jts.geom.Coordinate; * *
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Nov 29, 2007            njensen     Initial creation
- * 02/17/09                njensen     Refactored to new rsc architecture
- * Dec 11, 2013 DR 16795   D. Friedman Transform pixel coordinate in inspect
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Nov 29, 2007           njensen     Initial creation
+ * Feb 17, 2009           njensen     Refactored to new rsc architecture
+ * Dec 11, 2013  16795    D. Friedman Transform pixel coordinate in inspect
+ * Mar 07, 2014  2791     bsteffen    Move Data Source/Destination to numeric
+ *                                    plugin.
  * 
  * 
* @@ -285,8 +289,10 @@ public class CrossSectionImageResource extends AbstractCrossSectionResource return null; } - FloatArrayWrapper source = new FloatArrayWrapper(sliceData, geometry); - source.setValidRange(-9998, Double.POSITIVE_INFINITY); + DataSource source = new FloatBufferWrapper(sliceData, + geometry.getGridRange2D()); + source = ValidRangeFilter + .apply(source, -9998, Double.POSITIVE_INFINITY); GridSampler sampler = new GridSampler(source, new BilinearInterpolation()); GridReprojection reproj = new GridReprojection(geometry, diff --git a/cave/com.raytheon.uf.viz.xy.timeheight/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.xy.timeheight/META-INF/MANIFEST.MF index 5b10bfd827..ed4f00b80f 100644 --- a/cave/com.raytheon.uf.viz.xy.timeheight/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.xy.timeheight/META-INF/MANIFEST.MF @@ -2,25 +2,27 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Timeheight Bundle-SymbolicName: com.raytheon.uf.viz.xy.timeheight;singleton:=true -Bundle-Version: 1.0.1.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Require-Bundle: com.raytheon.uf.common.colormap, com.raytheon.uf.common.dataplugin, - com.raytheon.uf.common.geospatial, + com.raytheon.uf.common.geospatial;bundle-version="1.14.0", com.raytheon.uf.common.style, - com.raytheon.uf.viz.core, + com.raytheon.uf.viz.core;bundle-version="1.14.2", com.raytheon.uf.viz.d2d.core, com.raytheon.uf.viz.d2d.ui, com.raytheon.uf.viz.xy, - com.raytheon.uf.viz.xy.varheight, - com.raytheon.viz.core.contours, + com.raytheon.uf.viz.xy.varheight;bundle-version="1.13.0", + com.raytheon.viz.core.contours;bundle-version="1.14.0", com.raytheon.viz.core.graphing, - com.raytheon.viz.grid, + com.raytheon.viz.grid;bundle-version="1.14.0", javax.measure, - org.eclipse.core.runtime, - org.eclipse.ui + org.eclipse.core.runtime;bundle-version="3.8.0", + org.eclipse.ui;bundle-version="3.8.0", + com.raytheon.uf.common.dataplugin, + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Import-Package: com.raytheon.viz.core.imagery, com.raytheon.viz.core.map, com.raytheon.viz.core.rsc diff --git a/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightImageResource.java b/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightImageResource.java index abcb65dda9..85641c8cc4 100644 --- a/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightImageResource.java +++ b/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightImageResource.java @@ -30,7 +30,9 @@ import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation; import com.raytheon.uf.common.geospatial.interpolation.GridReprojection; import com.raytheon.uf.common.geospatial.interpolation.GridSampler; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.filter.ValidRangeFilter; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.common.style.ParamLevelMatchCriteria; import com.raytheon.uf.common.style.StyleException; import com.raytheon.uf.common.style.StyleManager; @@ -58,11 +60,13 @@ import com.vividsolutions.jts.geom.Coordinate; * *
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 4, 2007            njensen     Initial creation
- * Feb 20, 2009            njensen     Refactored to new rsc architecture
- * Dec 11, 2013 DR 16795   D. Friedman Transform pixel coordinate in inspect
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Dec 04, 2007           njensen     Initial creation
+ * Feb 20, 2009           njensen     Refactored to new rsc architecture
+ * Dec 11, 2013  16795    D. Friedman Transform pixel coordinate in inspect
+ * Mar 07, 2014  2791     bsteffen    Move Data Source/Destination to numeric
+ *                                    plugin.
  * 
  * 
* @@ -269,8 +273,10 @@ public class TimeHeightImageResource extends AbstractTimeHeightResource if (sliceData == null) { return null; } - FloatArrayWrapper source = new FloatArrayWrapper(sliceData, geometry); - source.setValidRange(-9998, Double.POSITIVE_INFINITY); + DataSource source = new FloatBufferWrapper(sliceData, + geometry.getGridRange2D()); + source = ValidRangeFilter + .apply(source, -9998, Double.POSITIVE_INFINITY); GridSampler sampler = new GridSampler(source, new BilinearInterpolation()); GridReprojection reproj = new GridReprojection(geometry, diff --git a/cave/com.raytheon.viz.core.contours/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.core.contours/META-INF/MANIFEST.MF index 87fb68a9e3..9f4e863fc6 100644 --- a/cave/com.raytheon.viz.core.contours/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.core.contours/META-INF/MANIFEST.MF @@ -7,13 +7,14 @@ Bundle-Vendor: Raytheon Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Require-Bundle: com.raytheon.uf.viz.core;bundle-version="1.14.1", - org.eclipse.core.runtime, - org.eclipse.ui, - com.raytheon.uf.common.geospatial, + org.eclipse.core.runtime;bundle-version="3.8.0", + org.eclipse.ui;bundle-version="3.8.0", + com.raytheon.uf.common.geospatial;bundle-version="1.14.0", com.raytheon.uf.common.util, com.raytheon.uf.common.wxmath, com.raytheon.uf.common.style, com.raytheon.uf.common.status, + com.raytheon.uf.common.numeric;bundle-version="1.14.0", org.apache.commons.collections Import-Package: com.raytheon.viz.core.interval Export-Package: com.raytheon.viz.core.contours, diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourCreateRequest.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourCreateRequest.java index 5f3aa6fb9a..fa420d7d18 100644 --- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourCreateRequest.java +++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourCreateRequest.java @@ -21,7 +21,7 @@ package com.raytheon.viz.core.contours; import org.geotools.coverage.grid.GeneralGridGeometry; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.common.style.contour.ContourPreferences; import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IGraphicsTarget; diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourRenderable.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourRenderable.java index 064bc068b9..100d452c07 100644 --- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourRenderable.java +++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourRenderable.java @@ -32,9 +32,13 @@ import org.opengis.coverage.grid.GridEnvelope; import org.opengis.referencing.operation.MathTransform; import com.raytheon.uf.common.geospatial.MapUtil; -import com.raytheon.uf.common.geospatial.interpolation.data.DataUtilities; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; +import com.raytheon.uf.common.geospatial.data.GeographicDataSource; +import com.raytheon.uf.common.numeric.DataUtilities; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.filter.FillValueFilter; +import com.raytheon.uf.common.numeric.filter.InverseFillValueFilter; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.common.style.contour.ContourPreferences; import com.raytheon.uf.common.wxmath.Constants; import com.raytheon.uf.common.wxmath.DistFilter; @@ -325,8 +329,7 @@ public abstract class ContourRenderable implements IRenderable { int retries = 0; LoopProperties loopProps = paintProps .getLoopProperties(); - if (loopProps != null && loopProps - .isLooping()) { + if (loopProps != null && loopProps.isLooping()) { /** * If the display is looping, wait a few ms to * let contouring finish so that if the @@ -452,14 +455,17 @@ public abstract class ContourRenderable implements IRenderable { // smoothingDistance is in km float npts = (float) (distanceInPoints * contourPrefs.getSmoothingDistance() / (distanceInM / 1000)); - FloatArrayWrapper data = new FloatArrayWrapper(gridGeometry); - data.setFillValue(Constants.LEGACY_NAN); - DataUtilities.copy(dataRecord[0], data, nx, ny); + FloatBufferWrapper data = new FloatBufferWrapper(nx, ny); + DataDestination dest = InverseFillValueFilter.apply( + (DataDestination) data, Constants.LEGACY_NAN); + DataUtilities.copy(dataRecord[0], dest, nx, ny); float[] dataArray = data.getArray(); dataArray = DistFilter.filter(dataArray, npts, nx, ny, 1); - data = new FloatArrayWrapper(dataArray, gridGeometry); - data.setFillValue(Constants.LEGACY_NAN); - return new DataSource[] {data}; + data = new FloatBufferWrapper(dataArray, nx, ny); + DataSource source = FillValueFilter.apply((DataSource) data, + Constants.LEGACY_NAN); + source = new GeographicDataSource(source, gridGeometry); + return new DataSource[] { data }; } else { return dataRecord; } diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourSupport.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourSupport.java index 067bc02e4e..1299ea7c3a 100644 --- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourSupport.java +++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourSupport.java @@ -44,13 +44,13 @@ import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.geospatial.CRSCache; import com.raytheon.uf.common.geospatial.MapUtil; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.DataUtilities; -import com.raytheon.uf.common.geospatial.interpolation.data.DataUtilities.MinMax; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.OffsetDataSource; import com.raytheon.uf.common.geospatial.util.GridGeometryWrapChecker; import com.raytheon.uf.common.geospatial.util.WorldWrapChecker; +import com.raytheon.uf.common.numeric.DataUtilities; +import com.raytheon.uf.common.numeric.DataUtilities.MinMax; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.source.DataSource; +import com.raytheon.uf.common.numeric.source.OffsetDataSource; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; @@ -352,7 +352,7 @@ public class ContourSupport { if (copyData) { subgridSource = DataUtilities.copy(subgridSource, - new FloatArrayWrapper(szX, szY), szX, szY); + new FloatBufferWrapper(szX, szY), szX, szY); } // Use ported legacy code to determine contour interval @@ -1072,9 +1072,9 @@ public class ContourSupport { int maxX = (int) (sz[0] - 1); int maxY = (int) (sz[1] - 1); - DataSource uWSource = new FloatArrayWrapper(uW, (int) sz[0], + DataSource uWSource = new FloatBufferWrapper(uW, (int) sz[0], (int) sz[1]); - DataSource vWSource = new FloatArrayWrapper(vW, (int) sz[0], + DataSource vWSource = new FloatBufferWrapper(vW, (int) sz[0], (int) sz[1]); makeStreamLines(uWSource, vWSource, minX, minY, maxX, maxY, sz, diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedContourDisplay.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedContourDisplay.java index e7f0419a05..c583da3092 100644 --- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedContourDisplay.java +++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedContourDisplay.java @@ -24,8 +24,8 @@ import java.nio.FloatBuffer; import org.geotools.coverage.grid.GeneralGridGeometry; import org.geotools.coverage.grid.GridGeometry2D; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatBufferWrapper; +import com.raytheon.uf.common.geospatial.data.GeographicDataSource; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.common.style.contour.ContourPreferences; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.map.IMapDescriptor; @@ -59,7 +59,8 @@ public class GriddedContourDisplay extends ContourRenderable { public GriddedContourDisplay(IMapDescriptor descriptor, final GridGeometry2D gridGeometry, final FloatBuffer fb) { - this(descriptor, gridGeometry, new FloatBufferWrapper(fb, gridGeometry)); + this(descriptor, gridGeometry, new GeographicDataSource(fb, + gridGeometry)); } public GriddedContourDisplay(IMapDescriptor descriptor, diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedStreamlineDisplay.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedStreamlineDisplay.java index 2a59716c40..87215dfc27 100644 --- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedStreamlineDisplay.java +++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedStreamlineDisplay.java @@ -23,8 +23,8 @@ import java.nio.FloatBuffer; import org.geotools.coverage.grid.GridGeometry2D; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatBufferWrapper; +import com.raytheon.uf.common.geospatial.data.GeographicDataSource; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.map.IMapDescriptor; @@ -58,7 +58,7 @@ public class GriddedStreamlineDisplay extends GriddedContourDisplay { public GriddedStreamlineDisplay(IMapDescriptor descriptor, GridGeometry2D gridGeometry, FloatBuffer ufb, FloatBuffer vfb) { super(descriptor, gridGeometry, ufb); - this.vSource = new FloatBufferWrapper(vfb, gridGeometry); + this.vSource = new GeographicDataSource(vfb, gridGeometry); } public GriddedStreamlineDisplay(IMapDescriptor descriptor, diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedVectorDisplay.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedVectorDisplay.java index 60a5756262..c661742ecb 100644 --- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedVectorDisplay.java +++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedVectorDisplay.java @@ -27,8 +27,8 @@ import org.geotools.referencing.GeodeticCalculator; import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.ReferencedCoordinate; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatBufferWrapper; +import com.raytheon.uf.common.geospatial.data.GeographicDataSource; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle; @@ -143,8 +143,8 @@ public class GriddedVectorDisplay extends AbstractGriddedDisplay { IMapDescriptor descriptor, GeneralGridGeometry gridGeometryOfGrid, double densityFactor, boolean gridRelative, DisplayType displayType, VectorGraphicsConfig config) { - this(new FloatBufferWrapper(magnitude, gridGeometryOfGrid), - new FloatBufferWrapper(direction, gridGeometryOfGrid), + this(new GeographicDataSource(magnitude, gridGeometryOfGrid), + new GeographicDataSource(direction, gridGeometryOfGrid), descriptor, gridGeometryOfGrid, densityFactor, gridRelative, displayType, config); } diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/util/FortConBuf.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/util/FortConBuf.java index d57911f469..7e0c2f085d 100644 --- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/util/FortConBuf.java +++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/util/FortConBuf.java @@ -24,10 +24,10 @@ import java.text.ParseException; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; -import com.raytheon.uf.common.geospatial.interpolation.data.AxisSwapDataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArray2DWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.InvalidRangeDataSource; +import com.raytheon.uf.common.numeric.array.FloatArray2DWrapper; +import com.raytheon.uf.common.numeric.filter.InvalidRangeFilter; +import com.raytheon.uf.common.numeric.source.AxisSwapDataSource; +import com.raytheon.uf.common.numeric.source.DataSource; /** * Port of the fortCon.f routine. Minimal changes made to make it perform better @@ -116,7 +116,7 @@ public class FortConBuf { DataSource source = new FloatArray2DWrapper(data, nx, ny); source = new AxisSwapDataSource(source); if (config.badlo < config.badhi) { - source = new InvalidRangeDataSource(source, config.badlo, + source = InvalidRangeFilter.apply(source, config.badlo, config.badhi); } return contour(source, ny, nx, config); diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/util/StrmPak.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/util/StrmPak.java index 75ad12b3f2..5f57eee227 100644 --- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/util/StrmPak.java +++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/util/StrmPak.java @@ -24,9 +24,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import com.raytheon.uf.common.geospatial.interpolation.data.AxisSwapDataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArray2DWrapper; +import com.raytheon.uf.common.numeric.array.FloatArray2DWrapper; +import com.raytheon.uf.common.numeric.source.AxisSwapDataSource; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.viz.core.contours.util.StreamLineContainer.StreamLinePoint; /** diff --git a/cave/com.raytheon.viz.dataaccess/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.dataaccess/META-INF/MANIFEST.MF index 31c12d9cba..2f1b99e6c0 100644 --- a/cave/com.raytheon.viz.dataaccess/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.dataaccess/META-INF/MANIFEST.MF @@ -2,23 +2,21 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Viz Data Access Bundle-SymbolicName: com.raytheon.viz.dataaccess -Bundle-Version: 1.0.0.qualifier -Bundle-Activator: com.raytheon.viz.dataaccess.Activator +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON -Eclipse-RegisterBuddy: com.raytheon.uf.viz.core -Eclipse-BuddyPolicy: ext, global -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - com.raytheon.uf.viz.core;bundle-version="1.12.1174", +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Require-Bundle: org.eclipse.ui;bundle-version="3.8.0", + org.eclipse.core.runtime;bundle-version="3.8.0", + com.raytheon.uf.viz.core;bundle-version="1.14.0", com.raytheon.uf.common.time;bundle-version="1.12.1174", com.raytheon.uf.common.dataaccess;bundle-version="1.0.0", com.raytheon.viz.core;bundle-version="1.12.1174", com.raytheon.uf.common.colormap;bundle-version="1.12.1174", javax.measure;bundle-version="1.0.0", org.apache.commons.lang;bundle-version="2.3.0", - com.raytheon.uf.common.style;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Bundle-ActivationPolicy: lazy + com.raytheon.uf.common.style;bundle-version="1.0.0", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Export-Package: com.raytheon.viz.dataaccess.rsc, com.raytheon.viz.dataaccess.rsc.geometry, com.raytheon.viz.dataaccess.rsc.grid diff --git a/cave/com.raytheon.viz.dataaccess/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/cave/com.raytheon.viz.dataaccess/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject deleted file mode 100644 index 7fbc55668e..0000000000 --- a/cave/com.raytheon.viz.dataaccess/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ /dev/null @@ -1,2 +0,0 @@ -com.raytheon.viz.dataaccess.rsc.grid.GenericGridResourceData -com.raytheon.viz.dataaccess.rsc.geometry.GenericGeometryResourceData \ No newline at end of file diff --git a/cave/com.raytheon.viz.dataaccess/src/com/raytheon/viz/dataaccess/Activator.java b/cave/com.raytheon.viz.dataaccess/src/com/raytheon/viz/dataaccess/Activator.java deleted file mode 100644 index 7dc1a868e4..0000000000 --- a/cave/com.raytheon.viz.dataaccess/src/com/raytheon/viz/dataaccess/Activator.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.raytheon.viz.dataaccess; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "com.raytheon.viz.dataaccess"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - -} diff --git a/cave/com.raytheon.viz.dataaccess/src/com/raytheon/viz/dataaccess/rsc/grid/GenericGridResource.java b/cave/com.raytheon.viz.dataaccess/src/com/raytheon/viz/dataaccess/rsc/grid/GenericGridResource.java index fd42d01795..faa6003285 100644 --- a/cave/com.raytheon.viz.dataaccess/src/com/raytheon/viz/dataaccess/rsc/grid/GenericGridResource.java +++ b/cave/com.raytheon.viz.dataaccess/src/com/raytheon/viz/dataaccess/rsc/grid/GenericGridResource.java @@ -33,7 +33,7 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem; import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; import com.raytheon.uf.common.dataaccess.grid.IGridData; import com.raytheon.uf.common.geospatial.ReferencedCoordinate; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; import com.raytheon.uf.common.style.StyleException; import com.raytheon.uf.common.style.image.ColorMapParameterFactory; import com.raytheon.uf.common.style.level.Level.LevelType; @@ -56,10 +56,12 @@ import com.raytheon.viz.dataaccess.rsc.AbstractDataAccessResource; * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Jan 8, 2013 bkowal Initial creation - * Jan 31, 2013 #1555 bkowal Refactor + * Date Ticket# Engineer Description + * ------------- -------- ----------- -------------------------- + * Jan 8, 2013 bkowal Initial creation + * Jan 31, 2013 1555 bkowal Refactor + * Mar 07, 2014 2791 bsteffen Move Data Source/Destination to numeric + * plugin. * * * @@ -96,7 +98,8 @@ public class GenericGridResource extends GridGeometry2D gridGeometry = gridData.getGridGeometry(); // Extract the raw data - FloatBufferWrapper bufferWrapper = new FloatBufferWrapper(gridGeometry); + FloatBufferWrapper bufferWrapper = new FloatBufferWrapper( + gridGeometry.getGridRange2D()); bufferWrapper = gridData.populateData(bufferWrapper); Buffer buffer = bufferWrapper.getBuffer(); diff --git a/cave/com.raytheon.viz.gfe/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.gfe/META-INF/MANIFEST.MF index 3df2b911cc..7032d00ac0 100644 --- a/cave/com.raytheon.viz.gfe/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.gfe/META-INF/MANIFEST.MF @@ -34,7 +34,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.style;bundle-version="1.0.0", com.raytheon.uf.common.activetable, com.raytheon.uf.viz.image.export;bundle-version="1.14.0", - com.raytheon.uf.viz.kml.export + com.raytheon.uf.viz.kml.export;bundle-version="1.14.1", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.viz.gfe, com.raytheon.viz.gfe.constants, diff --git a/cave/com.raytheon.viz.grid/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.grid/META-INF/MANIFEST.MF index 5aa017a0ea..1fc48c67d8 100644 --- a/cave/com.raytheon.viz.grid/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.grid/META-INF/MANIFEST.MF @@ -1,54 +1,48 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: Grid Plug-in +Bundle-Name: Grid Display Plug-in Bundle-SymbolicName: com.raytheon.viz.grid;singleton:=true -Bundle-Version: 1.12.1174.qualifier -Bundle-Activator: com.raytheon.viz.grid.Activator +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: Raytheon +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.uf.viz.core, com.raytheon.uf.common.dataplugin.grid.coverage Eclipse-BuddyPolicy: ext, global -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - javax.measure, - org.geotools, - com.raytheon.viz.core.contours, - com.raytheon.viz.pointdata, - com.raytheon.uf.viz.core, +Require-Bundle: org.eclipse.ui;bundle-version="3.8.0", + org.eclipse.core.runtime;bundle-version="3.8.0", + com.raytheon.uf.common.dataplugin.grid;bundle-version="1.13.0";visibility:=reexport, + com.raytheon.uf.viz.core;bundle-version="1.14.2", com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.datastorage, - com.raytheon.uf.common.geospatial, + com.raytheon.uf.common.geospatial;bundle-version="1.14.0", + com.raytheon.viz.core.contours;bundle-version="1.14.0", + com.raytheon.viz.pointdata, com.raytheon.viz.radar, com.raytheon.uf.viz.productbrowser, - com.raytheon.uf.common.dataplugin.radar, + com.raytheon.uf.common.dataplugin.radar;bundle-version="1.14.0", com.raytheon.uf.viz.points, - com.raytheon.uf.common.gridcoverage, - com.raytheon.uf.common.dataplugin.grid, - com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.colormap, - com.raytheon.uf.viz.derivparam -Bundle-ActivationPolicy: lazy + com.raytheon.uf.viz.derivparam;bundle-version="1.14.0", + com.raytheon.uf.common.style, + com.raytheon.uf.common.localization;bundle-version="1.14.0", + com.raytheon.uf.common.status, + com.raytheon.uf.common.serialization, + com.raytheon.uf.common.serialization.comm, + com.raytheon.uf.common.dataquery, + com.raytheon.uf.common.comm, + com.raytheon.uf.common.derivparam, + com.raytheon.uf.common.pointdata;bundle-version="1.13.0", + com.raytheon.uf.viz.d2d.core, + com.raytheon.uf.common.topo;bundle-version="1.14.0", + com.raytheon.uf.common.numeric;bundle-version="1.14.0", + javax.measure Export-Package: com.raytheon.viz.grid, com.raytheon.viz.grid.inv, com.raytheon.viz.grid.rsc, com.raytheon.viz.grid.rsc.general, com.raytheon.viz.grid.util, com.raytheon.viz.grid.xml -Import-Package: com.raytheon.uf.common.comm, - com.raytheon.uf.common.derivparam.tree, - com.raytheon.uf.common.localization, - com.raytheon.uf.common.parameter, - com.raytheon.uf.common.pointdata, - com.raytheon.uf.common.serialization, - com.raytheon.uf.common.style, - com.raytheon.uf.common.style.arrow, - com.raytheon.uf.common.style.contour, - com.raytheon.uf.common.style.image, - com.raytheon.uf.common.style.level, - com.raytheon.uf.common.time, - com.raytheon.uf.common.topo, - com.raytheon.uf.viz.d2d.core.map, - com.raytheon.viz.alerts, +Import-Package: com.raytheon.viz.alerts, com.raytheon.viz.alerts.observers, com.raytheon.viz.core.rsc, - com.raytheon.viz.core.rsc.displays -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 + com.raytheon.viz.core.units diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/Activator.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/Activator.java deleted file mode 100644 index b90d13076b..0000000000 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/Activator.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * 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.viz.grid; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "com.raytheon.viz.grid"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - plugin = this; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - -} diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GriddedIconDisplay.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GriddedIconDisplay.java index 05f9a7f0aa..7baf9e7c6e 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GriddedIconDisplay.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GriddedIconDisplay.java @@ -29,7 +29,7 @@ import java.util.Map; import org.eclipse.swt.graphics.RGB; import org.geotools.coverage.grid.GeneralGridGeometry; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.viz.core.data.IRenderedImageCallback; import com.raytheon.uf.viz.core.drawables.IImage; import com.raytheon.uf.viz.core.drawables.PaintProperties; diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/RcmResource.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/RcmResource.java index 6fcf73861d..1d1b3433b8 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/RcmResource.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/RcmResource.java @@ -27,7 +27,7 @@ import javax.measure.unit.UnitFormat; import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.geospatial.ReferencedCoordinate; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.viz.grid.rsc.general.D2DGridResource; diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/AbstractGridResource.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/AbstractGridResource.java index 4fc15187db..9e4a976abc 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/AbstractGridResource.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/AbstractGridResource.java @@ -46,9 +46,9 @@ import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation; import com.raytheon.uf.common.geospatial.interpolation.GridSampler; import com.raytheon.uf.common.geospatial.interpolation.Interpolation; import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.DataUtilities; -import com.raytheon.uf.common.geospatial.interpolation.data.DataUtilities.MinMax; +import com.raytheon.uf.common.numeric.DataUtilities; +import com.raytheon.uf.common.numeric.DataUtilities.MinMax; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/D2DGridResource.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/D2DGridResource.java index e9dd6f8c5d..94dea2351f 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/D2DGridResource.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/D2DGridResource.java @@ -45,12 +45,12 @@ import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation; import com.raytheon.uf.common.geospatial.interpolation.Interpolation; import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatBufferWrapper; import com.raytheon.uf.common.geospatial.util.GridGeometryWrapChecker; import com.raytheon.uf.common.geospatial.util.SubGridGeometryCalculator; import com.raytheon.uf.common.gridcoverage.GridCoverage; import com.raytheon.uf.common.gridcoverage.LatLonGridCoverage; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; @@ -233,7 +233,7 @@ public class D2DGridResource extends GridResource implements .getCoordinateReferenceSystem()); DataSource oldScalar = data.getScalarData(); FloatBufferWrapper newScalar = new FloatBufferWrapper( - gridGeometry); + gridGeometry.getGridRange2D()); for (int i = 0; i < gridRange.width; i++) { for (int j = 0; j < gridRange.height; j++) { double dir = oldScalar.getDataValue(i, j); diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/DifferenceGridResource.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/DifferenceGridResource.java index e5803ff30f..d6cf816266 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/DifferenceGridResource.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/DifferenceGridResource.java @@ -36,7 +36,7 @@ import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.common.style.ParamLevelMatchCriteria; import com.raytheon.uf.common.time.CombinedDataTime; import com.raytheon.uf.common.time.DataTime; diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GeneralGridData.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GeneralGridData.java index c039be8e2b..9637013e4d 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GeneralGridData.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GeneralGridData.java @@ -38,16 +38,16 @@ import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.geospatial.MapUtil; +import com.raytheon.uf.common.geospatial.data.GeographicDataSource; +import com.raytheon.uf.common.geospatial.data.UnitConvertingDataFilter; import com.raytheon.uf.common.geospatial.interpolation.GridReprojection; import com.raytheon.uf.common.geospatial.interpolation.GridReprojectionDataSource; import com.raytheon.uf.common.geospatial.interpolation.GridSampler; import com.raytheon.uf.common.geospatial.interpolation.Interpolation; import com.raytheon.uf.common.geospatial.interpolation.PrecomputedGridReprojection; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatBufferWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.OffsetDataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.UnitConvertingDataSource; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.source.DataSource; +import com.raytheon.uf.common.numeric.source.OffsetDataSource; import com.vividsolutions.jts.geom.Coordinate; /** @@ -85,11 +85,11 @@ public class GeneralGridData { private GridGeometry2D gridGeometry; - private DataSource scalarData; + private GeographicDataSource scalarData; - private DataSource uComponent = null; + private GeographicDataSource uComponent = null; - private DataSource vComponent = null; + private GeographicDataSource vComponent = null; private Unit dataUnit; @@ -103,7 +103,7 @@ public class GeneralGridData { public static GeneralGridData createScalarData( GeneralGridGeometry gridGeometry, FloatBuffer scalarData, Unit dataUnit) { - DataSource scalarSource = new FloatBufferWrapper(scalarData, + DataSource scalarSource = new GeographicDataSource(scalarData, gridGeometry); return createScalarData(gridGeometry, scalarSource, dataUnit); } @@ -159,8 +159,8 @@ public class GeneralGridData { public static GeneralGridData createVectorDataUV( GeneralGridGeometry gridGeometry, FloatBuffer uComponent, FloatBuffer vComponent, Unit dataUnit) { - DataSource uSource = new FloatBufferWrapper(uComponent, gridGeometry); - DataSource vSource = new FloatBufferWrapper(vComponent, gridGeometry); + DataSource uSource = new GeographicDataSource(uComponent, gridGeometry); + DataSource vSource = new GeographicDataSource(vComponent, gridGeometry); return createVectorDataUV(gridGeometry, uSource, vSource, dataUnit); } @@ -183,15 +183,18 @@ public class GeneralGridData { private GeneralGridData(GeneralGridGeometry gridGeometry, DataSource scalarData, Unit dataUnit) { this.gridGeometry = GridGeometry2D.wrap(gridGeometry); - this.scalarData = scalarData; + this.scalarData = GeographicDataSource.wrap(scalarData, + this.gridGeometry); this.dataUnit = dataUnit; } private GeneralGridData(GeneralGridGeometry gridGeometry, DataSource uComponent, DataSource vComponent, Unit dataUnit) { this.gridGeometry = GridGeometry2D.wrap(gridGeometry); - this.uComponent = uComponent; - this.vComponent = vComponent; + this.uComponent = GeographicDataSource.wrap(uComponent, + this.gridGeometry); + this.vComponent = GeographicDataSource.wrap(vComponent, + this.gridGeometry); this.dataUnit = dataUnit; } @@ -216,15 +219,17 @@ public class GeneralGridData { // no need to actually convert if they are the same. return true; } + UnitConvertingDataFilter filter = new UnitConvertingDataFilter( + converter); if (scalarData != null) { - scalarData = new UnitConvertingDataSource(converter, scalarData); + scalarData = scalarData.applyFilters(filter); } if (uComponent != null) { - uComponent = new UnitConvertingDataSource(converter, uComponent); + uComponent = uComponent.applyFilters(filter); } if (vComponent != null) { - vComponent = new UnitConvertingDataSource(converter, vComponent); + vComponent = vComponent.applyFilters(filter); } dataUnit = unit; return true; @@ -249,10 +254,12 @@ public class GeneralGridData { if (isVector()) { sampler.setSource(getUComponent()); float[] udata = reproj.reprojectedGrid(sampler, - new FloatArrayWrapper(newGeom)).getArray(); + new FloatBufferWrapper(newGeom.getGridRange2D())) + .getArray(); sampler.setSource(getVComponent()); float[] vdata = reproj.reprojectedGrid(sampler, - new FloatArrayWrapper(newGeom)).getArray(); + new FloatBufferWrapper(newGeom.getGridRange2D())) + .getArray(); // When reprojecting it is necessary to recalculate the // direction of vectors based off the change in the "up" // direction @@ -299,11 +306,12 @@ public class GeneralGridData { return (uComponent != null && vComponent != null); } - public DataSource getMagnitude() { - return new MagnitudeDataSource(uComponent, vComponent); + public GeographicDataSource getMagnitude() { + DataSource rawSource = new MagnitudeDataSource(uComponent, vComponent); + return new GeographicDataSource(rawSource, this.gridGeometry); } - public DataSource getScalarData() { + public GeographicDataSource getScalarData() { if (isVector()) { return getMagnitude(); } else { @@ -318,8 +326,10 @@ public class GeneralGridData { * wind is coming from the north and moving to the south. * @see #getDirectionTo() */ - public DataSource getDirectionFrom() { - return new DirectionFromDataSource(uComponent, vComponent); + public GeographicDataSource getDirectionFrom() { + DataSource rawSource = new DirectionFromDataSource(uComponent, + vComponent); + return new GeographicDataSource(rawSource, this.gridGeometry); } /** @@ -327,15 +337,16 @@ public class GeneralGridData { * mathematical deffinition of a vector. * @see #getDirectionFrom() */ - public DataSource getDirectionTo() { - return new DirectionToDataSource(uComponent, vComponent); + public GeographicDataSource getDirectionTo() { + DataSource rawSource = new DirectionToDataSource(uComponent, vComponent); + return new GeographicDataSource(rawSource, this.gridGeometry); } - public DataSource getUComponent() { + public GeographicDataSource getUComponent() { return uComponent; } - public DataSource getVComponent() { + public GeographicDataSource getVComponent() { return vComponent; } diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GridMemoryManager.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GridMemoryManager.java index 473526f4b9..cae1f8af61 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GridMemoryManager.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GridMemoryManager.java @@ -34,8 +34,8 @@ import java.util.regex.Pattern; import org.geotools.coverage.grid.GridEnvelope2D; import org.geotools.coverage.grid.GridGeometry2D; -import com.raytheon.uf.common.geospatial.interpolation.data.DataUtilities; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.DataUtilities; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; @@ -166,11 +166,11 @@ public class GridMemoryManager { dataBuffer.position(0); dataBuffer.limit(numGridPoints); FloatBufferWrapper uWrapper = new FloatBufferWrapper( - dataBuffer.slice(), gridGeometry); + dataBuffer.slice(), gridRange); dataBuffer.position(numGridPoints); dataBuffer.limit(numGridPoints * 2); FloatBufferWrapper vWrapper = new FloatBufferWrapper( - dataBuffer.slice(), gridGeometry); + dataBuffer.slice(), gridRange); DataUtilities.copy(data.getUComponent(), uWrapper, gridRange.width, gridRange.height); DataUtilities.copy(data.getVComponent(), vWrapper, @@ -179,7 +179,7 @@ public class GridMemoryManager { uWrapper, vWrapper, data.getDataUnit()); } else { FloatBufferWrapper wrapper = new FloatBufferWrapper(dataBuffer, - gridGeometry); + gridRange); DataUtilities.copy(data.getScalarData(), wrapper, gridRange.width, gridRange.height); data = GeneralGridData.createScalarData(gridGeometry, wrapper, diff --git a/cave/com.raytheon.viz.mpe.ui/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.mpe.ui/META-INF/MANIFEST.MF index 80b37e7107..fd7659e1a2 100644 --- a/cave/com.raytheon.viz.mpe.ui/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.mpe.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: MPE Ui Plug-in Bundle-SymbolicName: com.raytheon.viz.mpe.ui;singleton:=true -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Activator: com.raytheon.viz.mpe.ui.Activator Bundle-Vendor: Raytheon Require-Bundle: org.eclipse.ui, @@ -23,7 +23,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.viz.application, com.raytheon.viz.ui.personalities.awips;bundle-version="1.12.1174", com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0", - com.raytheon.uf.common.style;bundle-version="1.0.0" + com.raytheon.uf.common.style;bundle-version="1.0.0", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.viz.mpe.ui.dialogs.gagetable.xml, com.raytheon.viz.mpe.ui.displays, diff --git a/edexOsgi/com.raytheon.edex.plugin.satellite/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.edex.plugin.satellite/META-INF/MANIFEST.MF index 06a44b3aed..cdaf6fc763 100644 --- a/edexOsgi/com.raytheon.edex.plugin.satellite/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.edex.plugin.satellite/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Satellite Plug-in Bundle-SymbolicName: com.raytheon.edex.plugin.satellite -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0.qualifier Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Bundle-Vendor: RAYTHEON Export-Package: com.raytheon.edex.plugin.satellite, @@ -13,7 +13,7 @@ Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", com.raytheon.uf.common.dataplugin.satellite;bundle-version="1.0.0", com.raytheon.uf.common.serialization;bundle-version="1.12.1174", com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174", - com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", + com.raytheon.uf.common.geospatial;bundle-version="1.14.0", com.raytheon.uf.common.dataquery;bundle-version="1.0.0", com.raytheon.uf.common.datastorage;bundle-version="1.12.1174", com.raytheon.uf.common.localization;bundle-version="1.12.1174", @@ -22,6 +22,7 @@ Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", com.raytheon.uf.common.awipstools;bundle-version="1.12.1174", com.raytheon.uf.edex.core;bundle-version="1.12.1174", com.raytheon.uf.edex.database;bundle-version="1.0.0", - com.raytheon.uf.edex.menus;bundle-version="1.0.0" + com.raytheon.uf.edex.menus;bundle-version="1.0.0", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Import-Package: com.raytheon.edex.exception, org.apache.commons.logging diff --git a/edexOsgi/com.raytheon.edex.plugin.satellite/src/com/raytheon/edex/plugin/satellite/dao/SatelliteDao.java b/edexOsgi/com.raytheon.edex.plugin.satellite/src/com/raytheon/edex/plugin/satellite/dao/SatelliteDao.java index d54cae295d..87abd55170 100644 --- a/edexOsgi/com.raytheon.edex.plugin.satellite/src/com/raytheon/edex/plugin/satellite/dao/SatelliteDao.java +++ b/edexOsgi/com.raytheon.edex.plugin.satellite/src/com/raytheon/edex/plugin/satellite/dao/SatelliteDao.java @@ -43,12 +43,11 @@ import com.raytheon.uf.common.datastorage.StorageException; import com.raytheon.uf.common.datastorage.StorageProperties; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.geospatial.interpolation.GridDownscaler; -import com.raytheon.uf.common.geospatial.interpolation.data.DataDestination; -import com.raytheon.uf.common.geospatial.interpolation.data.DataWrapper1D; +import com.raytheon.uf.common.numeric.buffer.BufferWrapper; +import com.raytheon.uf.common.numeric.dest.DataDestination; import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.edex.core.dataplugin.PluginRegistry; import com.raytheon.uf.edex.database.DataAccessLayerException; -import com.raytheon.uf.edex.database.plugin.DataRecordWrapUtil; import com.raytheon.uf.edex.database.plugin.DownscaleStoreUtil; import com.raytheon.uf.edex.database.plugin.DownscaleStoreUtil.IDataRecordCreator; import com.raytheon.uf.edex.database.plugin.PluginDao; @@ -61,17 +60,18 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery; * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Feb 11, 2009 bphillip Initial creation - * - AWIPS2 Baseline Repository -------- - * 07/09/2012 798 jkorman Modified datastore population. - * 03/25/2013 1823 dgilling Modified getSatelliteData() and - * getSatelliteInventory() to allow optional - * input arguments. - * 06/24/2013 2044 randerso Added methods to get data by TimeRange and - * getInventory with maxRecord limit - * Nov 14, 2013 2393 bclement moved interpolation code to parent class + * Date Ticket# Engineer Description + * ------------- -------- ----------- -------------------------- + * Feb 11, 2009 bphillip Initial creation + * Jul 09, 2012 798 jkorman Modified datastore population. + * Mar 25, 2013 1823 dgilling Modified getSatelliteData() and + * getSatelliteInventory() to allow optional + * input arguments. + * Jun 24, 2013 2044 randerso Added methods to get data by TimeRange and + * getInventory with maxRecord limit + * Nov 14, 2013 2393 bclement moved interpolation code to parent class + * Mar 07, 2014 2791 bsteffen Move Data Source/Destination to numeric + * plugin. * * * @author bphillip @@ -148,8 +148,8 @@ public class SatelliteDao extends PluginDao { coverage.getGridGeometry()); Rectangle fullScale = downScaler.getDownscaleSize(0); - DataWrapper1D dataSource = DataRecordWrapUtil.wrap( - storageRecord, fullScale.width, fullScale.height, true); + BufferWrapper dataSource = BufferWrapper.wrapArray( + storageRecord.getDataObject(), fullScale.width, fullScale.height); int levels = DownscaleStoreUtil.storeInterpolated(dataStore, downScaler, dataSource, @@ -173,6 +173,12 @@ public class SatelliteDao extends PluginDao { // always the same fill value return fillValue; } + + @Override + public boolean isSigned() { + return false; + } + }); // set the number of levels in the 'parent' satellite data. satRecord.setInterpolationLevels(levels); @@ -513,7 +519,7 @@ public class SatelliteDao extends PluginDao { * @throws PluginException */ private IDataRecord createDataRecord(SatelliteRecord satRec, Object data, - int downscaleLevel, Rectangle size) throws StorageException { + int downscaleLevel, Rectangle size) { SatelliteMessageData msgData = null; msgData = new SatelliteMessageData(data, size.width, size.height); IDataRecord rec = msgData.getStorageRecord(satRec, diff --git a/edexOsgi/com.raytheon.uf.common.base.feature/feature.xml b/edexOsgi/com.raytheon.uf.common.base.feature/feature.xml index 6178d12af2..cb4de0d767 100644 --- a/edexOsgi/com.raytheon.uf.common.base.feature/feature.xml +++ b/edexOsgi/com.raytheon.uf.common.base.feature/feature.xml @@ -104,6 +104,12 @@ install-size="0" version="0.0.0"/> + + dataUnit = data.getUnit(); - FloatArrayWrapper dataGrid = new FloatArrayWrapper( - data.getGridGeometry()); + FloatBufferWrapper dataGrid = new FloatBufferWrapper(data + .getGridGeometry().getGridRange2D()); DataDestination dataDest = dataGrid; if (data.getUnit() != null) { try { @@ -86,8 +86,8 @@ public class GridResponseData extends AbstractResponseData { Unit stdUnit = dataUnit.getStandardUnit(); try { this.unit = UnitFormat.getUCUMInstance().format(stdUnit); - dataDest = new UnitConvertingDataDestination( - dataUnit.toStandardUnit(), dataDest); + dataDest = UnitConvertingDataFilter.apply(dataDest, + dataUnit.toStandardUnit()); } catch (IllegalArgumentException e2) { /* * The standard unit is also unstringable so treat the data diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/util/DataWrapperUtil.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/util/DataWrapperUtil.java index c1e2d16163..e63a60dbbd 100644 --- a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/util/DataWrapperUtil.java +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/util/DataWrapperUtil.java @@ -19,18 +19,13 @@ **/ package com.raytheon.uf.common.dataaccess.util; -import com.raytheon.uf.common.datastorage.records.ByteDataRecord; -import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; -import com.raytheon.uf.common.datastorage.records.IntegerDataRecord; -import com.raytheon.uf.common.datastorage.records.ShortDataRecord; -import com.raytheon.uf.common.geospatial.interpolation.data.ByteArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.DataWrapper1D; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.IntArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.ShortArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.UnsignedByteArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.UnsignedShortArrayWrapper; +import com.raytheon.uf.common.numeric.buffer.BufferWrapper; +import com.raytheon.uf.common.numeric.buffer.ByteBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.ShortBufferWrapper; +import com.raytheon.uf.common.numeric.filter.FillValueFilter; +import com.raytheon.uf.common.numeric.filter.UnsignedFilter; +import com.raytheon.uf.common.numeric.source.DataSource; /** * This methods in this utility may eventually be added to an abstract class. @@ -46,9 +41,11 @@ import com.raytheon.uf.common.geospatial.interpolation.data.UnsignedShortArrayWr * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Jan 03, 2012 bkowal Initial creation + * Date Ticket# Engineer Description + * ------------- -------- ----------- -------------------------- + * Jan 03, 2012 bkowal Initial creation + * Mar 07, 2014 2791 bsteffen Move Data Source/Destination to numeric + * plugin. * * * @@ -70,58 +67,31 @@ public final class DataWrapperUtil { * @param dataRecord the IDataRecord with raw data * @return the array-wrapped data */ - public static DataWrapper1D constructArrayWrapper(IDataRecord dataRecord) { + public static DataSource constructArrayWrapper(IDataRecord dataRecord) { return constructArrayWrapper(dataRecord, true); } - public static DataWrapper1D constructArrayWrapper(IDataRecord dataRecord, + public static DataSource constructArrayWrapper(IDataRecord dataRecord, boolean signed) { - DataWrapper1D arrayWrapper = null; - long[] dimensions = dataRecord.getSizes(); final int nx = (int) dimensions[0]; final int ny = (int) dimensions[1]; - /* - * determine the type of the data record and construct the appropriate - * array wrapper. - */ - if (dataRecord instanceof ByteDataRecord) { - ByteDataRecord byteDataRecord = (ByteDataRecord) dataRecord; - if (signed) { - arrayWrapper = new ByteArrayWrapper(byteDataRecord.getByteData(), - nx, ny); - } else { - arrayWrapper = new UnsignedByteArrayWrapper( - byteDataRecord.getByteData(), nx, ny); - } - } else if (dataRecord instanceof FloatDataRecord) { - FloatDataRecord floatDataRecord = (FloatDataRecord) dataRecord; - - arrayWrapper = new FloatArrayWrapper( - floatDataRecord.getFloatData(), nx, ny); - } else if (dataRecord instanceof IntegerDataRecord) { - IntegerDataRecord integerDataRecord = (IntegerDataRecord) dataRecord; - - arrayWrapper = new IntArrayWrapper(integerDataRecord.getIntData(), - nx, ny); - } else if (dataRecord instanceof ShortDataRecord) { - ShortDataRecord shortDataRecord = (ShortDataRecord) dataRecord; - - if (signed) { - arrayWrapper = new ShortArrayWrapper( - shortDataRecord.getShortData(), nx, ny); - } else { - arrayWrapper = new UnsignedShortArrayWrapper( - shortDataRecord.getShortData(), nx, ny); + DataSource source = BufferWrapper.wrapArray( + dataRecord.getDataObject(), nx, ny); + if (!signed) { + if (source instanceof ByteBufferWrapper) { + source = UnsignedFilter.apply((ByteBufferWrapper) source); + } else if (source instanceof ShortBufferWrapper) { + source = UnsignedFilter.apply((ShortBufferWrapper) source); } } Number fillValue = dataRecord.getFillValue(); if (fillValue != null) { - arrayWrapper.setFillValue(fillValue.doubleValue()); + source = FillValueFilter.apply(source, fillValue.doubleValue()); } - return arrayWrapper; + return source; } } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/META-INF/MANIFEST.MF index da5076b2a1..718de7c53a 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/META-INF/MANIFEST.MF @@ -17,7 +17,9 @@ Require-Bundle: org.geotools, com.raytheon.uf.common.cache, com.raytheon.uf.common.dataaccess;bundle-version="1.0.0", com.raytheon.uf.common.dataquery;bundle-version="1.0.0", - com.raytheon.uf.common.datastorage;bundle-version="1.12.1174" + com.raytheon.uf.common.datastorage;bundle-version="1.12.1174", + com.raytheon.uf.common.geospatial;bundle-version="1.14.0", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Export-Package: com.raytheon.uf.common.dataplugin.gfe, com.raytheon.uf.common.dataplugin.gfe.config, com.raytheon.uf.common.dataplugin.gfe.dataaccess, @@ -47,9 +49,6 @@ Import-Package: com.raytheon.edex.exception, com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.dataplugin.annotations, com.raytheon.uf.common.dataplugin.persist, - com.raytheon.uf.common.geospatial, - com.raytheon.uf.common.geospatial.interpolation, - com.raytheon.uf.common.geospatial.interpolation.data, com.raytheon.uf.common.gridcoverage, com.raytheon.uf.common.localization, com.raytheon.uf.common.localization.exception, diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/RemapGrid.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/RemapGrid.java index e14788f32c..f77d255350 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/RemapGrid.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/RemapGrid.java @@ -25,6 +25,7 @@ import java.awt.image.Raster; import java.awt.image.RenderedImage; import java.lang.ref.SoftReference; import java.nio.ByteBuffer; +import java.nio.FloatBuffer; import javax.media.jai.BorderExtender; import javax.media.jai.Interpolation; @@ -34,6 +35,7 @@ import javax.media.jai.PlanarImage; import org.geotools.coverage.grid.GridCoverage2D; import org.geotools.coverage.grid.GridCoverageFactory; +import org.geotools.coverage.grid.GridEnvelope2D; import org.geotools.coverage.grid.GridGeometry2D; import org.opengis.geometry.Envelope; import org.opengis.referencing.FactoryException; @@ -44,12 +46,17 @@ import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException; import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DByte; import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DFloat; import com.raytheon.uf.common.geospatial.MapUtil; +import com.raytheon.uf.common.geospatial.data.GeographicDataSource; import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation; import com.raytheon.uf.common.geospatial.interpolation.GridReprojection; import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation; import com.raytheon.uf.common.geospatial.interpolation.PrecomputedGridReprojection; -import com.raytheon.uf.common.geospatial.interpolation.data.ByteBufferWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; +import com.raytheon.uf.common.numeric.buffer.ByteBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.filter.FillValueFilter; +import com.raytheon.uf.common.numeric.filter.InverseFillValueFilter; +import com.raytheon.uf.common.numeric.source.DataSource; import com.vividsolutions.jts.geom.Coordinate; /** @@ -70,6 +77,7 @@ import com.vividsolutions.jts.geom.Coordinate; * in Maputil.rotation * 07/17/13 #2185 bsteffen Cache computed grid reprojections. * 08/13/13 #1571 randerso Passed fill values into interpolator. + * 03/07/14 #2791 bsteffen Move Data Source/Destination to numeric plugin. * * * @@ -490,22 +498,28 @@ public class RemapGrid { float outputFill) throws FactoryException, TransformException { GridGeometry2D sourceGeometry = MapUtil.getGridGeometry(sourceGloc); + GridEnvelope2D sourceRange = sourceGeometry.getGridRange2D(); ByteBuffer data = input.getBuffer(); ByteBuffer resampledData = null; GridGeometry2D destGeometry = MapUtil.getGridGeometry(destinationGloc); + GridEnvelope2D destRange = destGeometry.getGridRange2D(); GridReprojection interp = PrecomputedGridReprojection.getReprojection( sourceGeometry, destGeometry); - ByteBufferWrapper source = new ByteBufferWrapper(data, sourceGeometry); - source.setFillValue(inputFill); + DataSource source = new ByteBufferWrapper(data, sourceRange.width, + sourceRange.height); + source = FillValueFilter.apply(source, inputFill); - ByteBufferWrapper dest = new ByteBufferWrapper(destGeometry); - dest.setFillValue(outputFill); + ByteBufferWrapper bufferDest = new ByteBufferWrapper(destRange.width, + destRange.height); + DataDestination dest = InverseFillValueFilter.apply( + (DataDestination) bufferDest, outputFill); - resampledData = interp.reprojectedGrid( - new NearestNeighborInterpolation(), source, dest).getBuffer(); + interp.reprojectedGrid(new NearestNeighborInterpolation(), source, dest); + + resampledData = bufferDest.getBuffer(); // Remap the the output data into a Grid2DFloat object @@ -582,15 +596,19 @@ public class RemapGrid { GridReprojection interp = PrecomputedGridReprojection .getReprojection(sourceGeometry, destGeometry); - FloatArrayWrapper source = new FloatArrayWrapper(data, - sourceGeometry); - source.setFillValue(inputFill); + DataSource source = new GeographicDataSource( + FloatBuffer.wrap(data), sourceGeometry); + source = FillValueFilter.apply(source, inputFill); + ; - FloatArrayWrapper dest = new FloatArrayWrapper(destGeometry); - dest.setFillValue(outputFill); + FloatBufferWrapper rawDest = new FloatBufferWrapper( + destGeometry.getGridRange2D()); + DataDestination dest = InverseFillValueFilter.apply( + (DataDestination) rawDest, outputFill); - f1 = interp.reprojectedGrid(new BilinearInterpolation(), source, - dest).getArray(); + interp.reprojectedGrid(new BilinearInterpolation(), source, dest); + + f1 = rawDest.getArray(); } // Remap the the output data into a Grid2DFloat object @@ -645,7 +663,7 @@ public class RemapGrid { Coordinate llc = destinationGloc .latLonCenter(new Coordinate(x1, y1)); rotation.set(x1, y1, - (float) (-MapUtil.rotation(llc, sourceGloc))); + (float) (-MapUtil.rotation(llc, sourceGloc))); } } rotationRef = new SoftReference(rotation); diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/dataaccess/GFEGridFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/dataaccess/GFEGridFactory.java index d485e08dc3..1ea678873c 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/dataaccess/GFEGridFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/dataaccess/GFEGridFactory.java @@ -48,11 +48,11 @@ import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.geospatial.MapUtil; -import com.raytheon.uf.common.geospatial.interpolation.data.ByteArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.OffsetDataSource; import com.raytheon.uf.common.geospatial.util.SubGridGeometryCalculator; +import com.raytheon.uf.common.numeric.buffer.ByteBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; +import com.raytheon.uf.common.numeric.source.DataSource; +import com.raytheon.uf.common.numeric.source.OffsetDataSource; import com.raytheon.uf.common.util.StringUtil; /** @@ -221,19 +221,19 @@ public class GFEGridFactory extends AbstractGridDataPluginFactory implements if (slice instanceof ScalarGridSlice) { // This also grabs vector data. Grid2DFloat data = ((ScalarGridSlice) slice).getScalarGrid(); - dataSource = new FloatArrayWrapper(data.getFloats(), loc.getNx(), + dataSource = new FloatBufferWrapper(data.getFloats(), loc.getNx(), loc.getNy()); } else if (slice instanceof DiscreteGridSlice) { DiscreteGridSlice discreteSlice = (DiscreteGridSlice) slice; Grid2DByte data = discreteSlice.getDiscreteGrid(); keys = discreteSlice.getKeys(); - dataSource = new ByteArrayWrapper(data.getBytes(), loc.getNx(), + dataSource = new ByteBufferWrapper(data.getBytes(), loc.getNx(), loc.getNy()); } else if (slice instanceof WeatherGridSlice) { WeatherGridSlice weatherSlice = (WeatherGridSlice) slice; Grid2DByte data = weatherSlice.getWeatherGrid(); keys = weatherSlice.getKeys(); - dataSource = new ByteArrayWrapper(data.getBytes(), loc.getNx(), + dataSource = new ByteBufferWrapper(data.getBytes(), loc.getNx(), loc.getNy()); } else { throw new DataRetrievalException("Unknown slice of type " diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/META-INF/MANIFEST.MF index 9569f9cbee..f557b98f42 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/META-INF/MANIFEST.MF @@ -16,12 +16,12 @@ Export-Package: com.raytheon.uf.common.dataplugin.grid, com.raytheon.uf.common.dataplugin.grid.units, com.raytheon.uf.common.dataplugin.grid.util Require-Bundle: com.raytheon.uf.common.dataplugin, - com.raytheon.uf.common.gridcoverage;visibility:=reexport, + com.raytheon.uf.common.gridcoverage;bundle-version="1.13.0";visibility:=reexport, com.raytheon.uf.common.parameter;visibility:=reexport, - com.raytheon.uf.common.dataplugin.level;visibility:=reexport, + com.raytheon.uf.common.dataplugin.level;bundle-version="1.14.0";visibility:=reexport, com.raytheon.uf.common.serialization, - com.raytheon.uf.common.geospatial, - com.raytheon.uf.common.localization, + com.raytheon.uf.common.geospatial;bundle-version="1.14.0", + com.raytheon.uf.common.localization;bundle-version="1.14.0", com.raytheon.uf.common.datastorage, com.raytheon.uf.common.comm, com.raytheon.uf.common.dataquery, @@ -30,6 +30,7 @@ Require-Bundle: com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.serialization.comm, com.raytheon.uf.common.status, com.raytheon.uf.common.style, + com.raytheon.uf.common.numeric;bundle-version="1.14.0", org.apache.commons.beanutils, javax.measure, javax.persistence, diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/dataaccess/GridDataAccessFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/dataaccess/GridDataAccessFactory.java index 5d3496627e..c6060fb40c 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/dataaccess/GridDataAccessFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/dataaccess/GridDataAccessFactory.java @@ -47,7 +47,7 @@ import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.mapping.LevelMapper; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.common.parameter.mapping.ParameterMapper; import com.raytheon.uf.common.util.mapping.Mapper; diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.radar/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.radar/META-INF/MANIFEST.MF index f1c84d1605..78bcae41cf 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.radar/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.radar/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Radar Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.radar -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 1.14.0.qualifier Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization, com.raytheon.uf.common.geospatial Bundle-Vendor: RAYTHEON Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", @@ -10,14 +10,15 @@ Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174", com.raytheon.uf.common.localization;bundle-version="1.12.1174", com.raytheon.uf.common.status;bundle-version="1.12.1174", - com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", + com.raytheon.uf.common.geospatial;bundle-version="1.14.0", com.raytheon.uf.common.datastorage;bundle-version="1.12.1174", com.raytheon.uf.common.dataquery;bundle-version="1.0.0", com.raytheon.uf.common.dataaccess;bundle-version="1.0.0", com.raytheon.uf.common.units;bundle-version="1.0.0", com.raytheon.uf.common.util;bundle-version="1.12.1174", javax.persistence;bundle-version="1.0.0", - org.hibernate;bundle-version="1.0.0" + org.hibernate;bundle-version="1.0.0", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.uf.common.dataplugin.radar, diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.radar/src/com/raytheon/uf/common/dataplugin/radar/dataaccess/RadarGridFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.radar/src/com/raytheon/uf/common/dataplugin/radar/dataaccess/RadarGridFactory.java index d306f0492c..471a33770d 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.radar/src/com/raytheon/uf/common/dataplugin/radar/dataaccess/RadarGridFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.radar/src/com/raytheon/uf/common/dataplugin/radar/dataaccess/RadarGridFactory.java @@ -50,11 +50,12 @@ import com.raytheon.uf.common.dataplugin.radar.util.RadarInfoDict; import com.raytheon.uf.common.dataplugin.radar.util.RadarUtil; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; -import com.raytheon.uf.common.geospatial.interpolation.data.ByteArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.ShortArrayWrapper; import com.raytheon.uf.common.geospatial.util.SubGridGeometryCalculator; import com.raytheon.uf.common.localization.PathManagerFactory; +import com.raytheon.uf.common.numeric.buffer.ByteBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.ShortBufferWrapper; +import com.raytheon.uf.common.numeric.filter.FillValueFilter; +import com.raytheon.uf.common.numeric.source.DataSource; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Envelope; @@ -282,15 +283,13 @@ public class RadarGridFactory extends AbstractGridDataPluginFactory implements int ny = radarRecord.getNumRadials(); byte[] bytes = radarRecord.getRawData(); if (bytes != null) { - ByteArrayWrapper wrapper = new ByteArrayWrapper(bytes, nx, ny); - wrapper.setFillValue(0); - return wrapper; + ByteBufferWrapper wrapper = new ByteBufferWrapper(bytes, nx, ny); + return FillValueFilter.apply((DataSource) wrapper, 0); } short[] shorts = radarRecord.getRawShortData(); if (shorts != null) { - ShortArrayWrapper wrapper = new ShortArrayWrapper(shorts, nx, ny); - wrapper.setFillValue(0); - return wrapper; + ShortBufferWrapper wrapper = new ShortBufferWrapper(shorts, nx, ny); + return FillValueFilter.apply((DataSource) wrapper, 0); } return null; diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.satellite/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.satellite/META-INF/MANIFEST.MF index b3d08410ce..29d79d1770 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.satellite/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.satellite/META-INF/MANIFEST.MF @@ -2,21 +2,21 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Satellite Common Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.satellite -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", com.raytheon.uf.common.serialization;bundle-version="1.12.1174", javax.persistence;bundle-version="1.0.0", - org.geotools;bundle-version="2.6.4", org.apache.commons.lang;bundle-version="2.3.0", javax.measure;bundle-version="1.0.0", com.raytheon.uf.common.dataaccess;bundle-version="1.0.0", com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174", com.raytheon.uf.common.dataquery;bundle-version="1.0.0", com.raytheon.uf.common.datastorage;bundle-version="1.12.1174", - org.hibernate;bundle-version="1.0.0" + org.hibernate;bundle-version="1.0.0", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Export-Package: com.raytheon.uf.common.dataplugin.satellite, com.raytheon.uf.common.dataplugin.satellite.units, com.raytheon.uf.common.dataplugin.satellite.units.counts, diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.satellite/src/com/raytheon/uf/common/dataplugin/satellite/dataaccess/SatelliteGridFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.satellite/src/com/raytheon/uf/common/dataplugin/satellite/dataaccess/SatelliteGridFactory.java index dd118e6762..a31a571250 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.satellite/src/com/raytheon/uf/common/dataplugin/satellite/dataaccess/SatelliteGridFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.satellite/src/com/raytheon/uf/common/dataplugin/satellite/dataaccess/SatelliteGridFactory.java @@ -39,7 +39,7 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord; import com.raytheon.uf.common.dataplugin.satellite.units.SatelliteUnits; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; /** * A data factory for getting satellite data from the metadata database. There diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.geospatial/META-INF/MANIFEST.MF index e5f0abc347..48fbfcfffe 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.geospatial/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Geospatial Plug-in Bundle-SymbolicName: com.raytheon.uf.common.geospatial -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Eclipse-BuddyPolicy: registered @@ -10,16 +10,17 @@ Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization, org.geotools Require-Bundle: org.geotools;bundle-version="2.5.2";visibility:=reexport, org.apache.commons.collections;bundle-version="3.2.0", org.apache.commons.lang;bundle-version="2.3.0", - javax.measure;bundle-version="1.0.0", + javax.measure, org.apache.commons.beanutils;bundle-version="1.8.3", - com.raytheon.uf.common.serialization;bundle-version="1.12.1174", - com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174", - com.raytheon.uf.common.dataquery;bundle-version="1.0.0", - com.raytheon.uf.common.status;bundle-version="1.12.1174", - com.raytheon.uf.common.util;bundle-version="1.12.1174" + com.raytheon.uf.common.serialization, + com.raytheon.uf.common.serialization.comm, + com.raytheon.uf.common.dataquery, + com.raytheon.uf.common.status, + com.raytheon.uf.common.util, + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Export-Package: com.raytheon.uf.common.geospatial, + com.raytheon.uf.common.geospatial.data, com.raytheon.uf.common.geospatial.interpolation, - com.raytheon.uf.common.geospatial.interpolation.data, com.raytheon.uf.common.geospatial.projection, com.raytheon.uf.common.geospatial.request, com.raytheon.uf.common.geospatial.spi, diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/data/GeographicDataSource.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/data/GeographicDataSource.java new file mode 100644 index 0000000000..7153acc7dc --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/data/GeographicDataSource.java @@ -0,0 +1,158 @@ +/** + * 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.geospatial.data; + +import java.nio.Buffer; + +import org.geotools.coverage.grid.GeneralGridGeometry; +import org.geotools.coverage.grid.GridGeometry2D; +import org.opengis.coverage.grid.GridGeometry; + +import com.raytheon.uf.common.geospatial.util.GridGeometryWrapChecker; +import com.raytheon.uf.common.numeric.buffer.BufferWrapper; +import com.raytheon.uf.common.numeric.filter.DataFilter; +import com.raytheon.uf.common.numeric.source.DataSource; +import com.raytheon.uf.common.numeric.source.FilteredDataSource; + +/** + * A data source with a grid geometry. Grids that "wrap" around the world allow + * indexing outside the normal x range to wrap around the world. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Mar 06, 2014  2791     bsteffen    Initial creation
+ * 
+ * 
+ * + * @author bsteffen + * @version 1.0 + */ +public class GeographicDataSource implements DataSource { + + protected final DataSource wrappedSource; + + protected final GridGeometry2D gridGeometry; + + protected final int nx; + + protected final int wrapX; + + public GeographicDataSource(DataSource wrappedSource, GridGeometry geometry) { + this.wrappedSource = wrappedSource; + this.gridGeometry = GridGeometry2D.wrap(geometry); + this.nx = this.gridGeometry.getGridRange2D().width; + this.wrapX = GridGeometryWrapChecker + .checkForWrapping(this.gridGeometry); + } + + public GeographicDataSource(Buffer buffer, GeneralGridGeometry geometry) { + this.gridGeometry = GridGeometry2D.wrap(geometry); + this.nx = this.gridGeometry.getGridRange2D().width; + this.wrapX = GridGeometryWrapChecker + .checkForWrapping(this.gridGeometry); + int ny = this.gridGeometry.getGridRange2D().height; + this.wrappedSource = BufferWrapper.wrap(buffer, nx, ny); + + } + + public GeographicDataSource(Class primitiveType, + GeneralGridGeometry geometry) { + this.gridGeometry = GridGeometry2D.wrap(geometry); + this.nx = this.gridGeometry.getGridRange2D().width; + this.wrapX = GridGeometryWrapChecker + .checkForWrapping(this.gridGeometry); + int ny = this.gridGeometry.getGridRange2D().height; + this.wrappedSource = BufferWrapper.create(primitiveType, nx, ny); + } + + protected GeographicDataSource(DataSource wrappedSource, + GridGeometry2D gridGeometry, int nx, int wrapX) { + this.wrappedSource = wrappedSource; + this.gridGeometry = gridGeometry; + this.nx = nx; + this.wrapX = wrapX; + } + + protected int fixX(int x) { + if (wrapX > 0 && (x < 0 || x > nx - 1)) { + while (x > nx) { + x -= wrapX; + } + while (x < 0) { + x += wrapX; + } + } + return x; + } + + @Override + public double getDataValue(int x, int y) { + return wrappedSource.getDataValue(fixX(x), y); + } + + public DataSource getWrappedSource() { + return wrappedSource; + } + + public GridGeometry2D getGridGeometry() { + return gridGeometry; + } + + /** + * Create a new GeographicDataSource that is a copy of this source but with + * additional filters. Since a FilteredDataSource is not geographic this is + * the prefered method of adding filters while preserving geographic + * attributes. + * + * @param filters + * @return + */ + public GeographicDataSource applyFilters(DataFilter... filters) { + DataSource newWrappedSource = FilteredDataSource.addFilters( + wrappedSource, filters); + return new GeographicDataSource(newWrappedSource, gridGeometry, nx, + wrapX); + } + + /** + * Create a new GeographicDataSource only if the provided source is not + * already a GeographicDataSource. + * + * @param source + * a DataSource + * @param geometry + * The geometry of the source + * @return Either a new GeographicDataSource or source cast to a + * GeographicDataSource. + */ + public static GeographicDataSource wrap(DataSource source, + GridGeometry geometry) { + if (source instanceof GeographicDataSource) { + return (GeographicDataSource) source; + } else { + return new GeographicDataSource(source, geometry); + } + } + +} diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/data/UnitConvertingDataFilter.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/data/UnitConvertingDataFilter.java new file mode 100644 index 0000000000..d15cc1b859 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/data/UnitConvertingDataFilter.java @@ -0,0 +1,71 @@ +/** + * 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.geospatial.data; + +import javax.measure.converter.UnitConverter; + +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.dest.FilteredDataDestination; +import com.raytheon.uf.common.numeric.filter.DataFilter; +import com.raytheon.uf.common.numeric.source.DataSource; +import com.raytheon.uf.common.numeric.source.FilteredDataSource; + +/** + * + * A filter that converts to a unit with the specified unit converter. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Mar 07, 2014  2791     bsteffen    Initial creation
+ * 
+ * 
+ * + * @author bsteffen + * @version 1.0 + */ +public class UnitConvertingDataFilter implements DataFilter { + + protected UnitConverter unitConverter; + + public UnitConvertingDataFilter(UnitConverter converter) { + this.unitConverter = converter; + } + + @Override + public double filter(double value) { + return unitConverter.convert(value); + } + + public static DataSource apply(DataSource source, UnitConverter converter) { + return FilteredDataSource.addFilters(source, + new UnitConvertingDataFilter(converter)); + } + + public static DataDestination apply(DataDestination destination, + UnitConverter converter) { + return FilteredDataDestination.addFilters(destination, + new UnitConvertingDataFilter(converter)); + } + +} diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/BicubicInterpolation.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/BicubicInterpolation.java index 9a2ccd6df0..29f6eb2147 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/BicubicInterpolation.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/BicubicInterpolation.java @@ -19,7 +19,7 @@ **/ package com.raytheon.uf.common.geospatial.interpolation; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; /** * bicubic convolusion. diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/BilinearInterpolation.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/BilinearInterpolation.java index 07ba49114e..3a61fda683 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/BilinearInterpolation.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/BilinearInterpolation.java @@ -19,7 +19,7 @@ **/ package com.raytheon.uf.common.geospatial.interpolation; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; /** * Bilinear interpolation diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridDownscaler.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridDownscaler.java index 0835e4434f..b1bcf98339 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridDownscaler.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridDownscaler.java @@ -33,8 +33,8 @@ import org.opengis.referencing.FactoryException; import org.opengis.referencing.cs.CoordinateSystem; import org.opengis.referencing.operation.TransformException; -import com.raytheon.uf.common.geospatial.interpolation.data.DataDestination; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.source.DataSource; /** * Class used to create downscaled versions of geospatial data. Downscales to an diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridReprojection.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridReprojection.java index cb4272d2b5..e2da2af7ea 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridReprojection.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridReprojection.java @@ -32,8 +32,8 @@ import org.opengis.referencing.datum.PixelInCell; import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.TransformException; -import com.raytheon.uf.common.geospatial.interpolation.data.DataDestination; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.source.DataSource; /** * Class for mapping data from one grid geometry to another. Uses interfaces for diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridReprojectionDataSource.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridReprojectionDataSource.java index 1f0fd61e7d..d8ceb80505 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridReprojectionDataSource.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridReprojectionDataSource.java @@ -22,7 +22,7 @@ package com.raytheon.uf.common.geospatial.interpolation; import org.opengis.referencing.FactoryException; import org.opengis.referencing.operation.TransformException; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridSampler.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridSampler.java index 079f956172..c71941b691 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridSampler.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/GridSampler.java @@ -19,7 +19,7 @@ **/ package com.raytheon.uf.common.geospatial.interpolation; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; /** * Used for sampling data values from a source using an interpolation. It can be diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/Interpolation.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/Interpolation.java index 5e7e68c2f9..32424d8542 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/Interpolation.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/Interpolation.java @@ -19,7 +19,7 @@ **/ package com.raytheon.uf.common.geospatial.interpolation; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; /** * Provides logic for deriving a value at a single point from a 2D numeric diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/LatLonGridSampler.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/LatLonGridSampler.java index 03fb50eff0..784bf56491 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/LatLonGridSampler.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/LatLonGridSampler.java @@ -28,7 +28,7 @@ import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.geospatial.MapUtil; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; /** * Similar to a regular GridSampler but inputs to sample method are Lat/Lon diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/NearestNeighborInterpolation.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/NearestNeighborInterpolation.java index 32c2bdf34b..784c585d8e 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/NearestNeighborInterpolation.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/NearestNeighborInterpolation.java @@ -19,7 +19,7 @@ **/ package com.raytheon.uf.common.geospatial.interpolation; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; /** * Nearest Neighbor interpolation diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/AbstractDataWrapper.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/AbstractDataWrapper.java deleted file mode 100644 index 98efbd61ea..0000000000 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/AbstractDataWrapper.java +++ /dev/null @@ -1,142 +0,0 @@ -/** - * 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.geospatial.interpolation.data; - -import java.awt.Rectangle; -import java.lang.reflect.Constructor; - -import org.geotools.coverage.grid.GeneralGridGeometry; - -import com.raytheon.uf.common.geospatial.util.GridGeometryWrapChecker; - -/** - * - * Abstract class for any data implementation that can act as both a source and - * destination. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 20, 2012            bsteffen     Initial creation
- * Nov 19, 2013  2393      bclement     added createNew method
- * 
- * 
- * - * @author bsteffen - * @version 1.0 - */ -public abstract class AbstractDataWrapper implements DataSource, - DataDestination { - - protected final int nx; - - protected final int ny; - - protected int wrapX = -1; - - protected double minValid = Double.NEGATIVE_INFINITY; - - protected double maxValid = Double.POSITIVE_INFINITY; - - protected double fillValue = Double.NaN; - - public AbstractDataWrapper(GeneralGridGeometry geometry) { - this.nx = geometry.getGridRange().getSpan(0); - this.ny = geometry.getGridRange().getSpan(1); - this.wrapX = GridGeometryWrapChecker.checkForWrapping(geometry); - } - - public AbstractDataWrapper(int nx, int ny) { - this.nx = nx; - this.ny = ny; - } - - public void setValidRange(double minValid, double maxValid) { - this.minValid = minValid; - this.maxValid = maxValid; - } - - public void setFillValue(double fillValue) { - this.fillValue = fillValue; - } - - @Override - public double getDataValue(int x, int y) { - if (y < 0 || y > ny - 1) { - // outside y range - return Double.NaN; - } else if (x < 0 || x > nx - 1) { - // outside x range - if (wrapX > 0) { - // attempt to wrap if this is a wrapping grid. - x = (x + wrapX) % wrapX; - if (x < 0 || x > nx - 1) { - return Double.NaN; - } - } else { - return Double.NaN; - } - } - double val = getDataValueInternal(x, y); - if (val == fillValue || val < minValid || val > maxValid) { - // skip outside valid range or fill value - val = Double.NaN; - } - return val; - } - - @Override - public void setDataValue(double dataValue, int x, int y) { - if (Double.isNaN(dataValue)) { - dataValue = fillValue; - } - setDataValueInternal(dataValue, x, y); - } - - protected abstract double getDataValueInternal(int x, int y); - - protected abstract void setDataValueInternal(double dataValue, int x, int y); - - /** - * Create a new data wrapper of type c with the provided size - * - * @param c - * desired implementation class - * @param size - * @return - * @throws IllegalArgumentException - */ - public static T createNew( - Class c, Rectangle size) - throws IllegalArgumentException { - try { - Constructor constructor = c.getConstructor(int.class, - int.class); - return constructor.newInstance(size.width, size.height); - } catch (Exception e) { - throw new IllegalArgumentException( - "Unable to instatiate instance of class: " + c, e); - } - } - -} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/ByteArrayWrapper.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/ByteArrayWrapper.java deleted file mode 100644 index b6b418e95e..0000000000 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/ByteArrayWrapper.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * 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.geospatial.interpolation.data; - -import org.geotools.coverage.grid.GeneralGridGeometry; - -/** - * {@link AbstractDataWrapper} implementation for byte array data. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jul 13, 2012            jkorman     Initial creation
- * 
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public class ByteArrayWrapper extends DataWrapper1D { - - // The wrapped byte array data. - protected final byte[] array; - - /** - * Wrap a byte array using a specified geometry. - * @param array Byte array data to be wrapped. - * @param geometry A {@link GeneralGridGeometry} that will be used to discover - * the shape of the input data. - */ - public ByteArrayWrapper(byte[] array, GeneralGridGeometry geometry) { - super(geometry); - this.array = array; - } - - /** - * Wrap a byte array using given x and y axis dimensions. - * @param array Byte array data to be wrapped. - * @param nx Number of elements on the x axis. - * @param ny Number of elements on the y axis. - */ - public ByteArrayWrapper(byte[] array, int nx, int ny) { - super(nx, ny); - this.array = array; - } - - /** - * Create an instance with a byte array using given x and y axis dimensions. - * @param nx Number of elements on the x axis. - * @param ny Number of elements on the y axis. - */ - public ByteArrayWrapper(int nx, int ny) { - this(new byte[nx * ny], nx, ny); - } - - /** - * Create an instance with a byte array using a specified geometry. - * @param geometry A {@link GeneralGridGeometry} that will be used to discover - * the shape of the input data. - */ - public ByteArrayWrapper(GeneralGridGeometry geometry) { - // assume this is going to be a destination and avoid passing - // geometry to super to save time on checking for wrapping. - this(geometry.getGridRange().getSpan(0), geometry.getGridRange() - .getSpan(1)); - } - - /** - * Get a reference to the internal wrapped data. - * @return The internal byte array data. - */ - public byte[] getArray() { - return array; - } - - /** - * Get the value of the internal data at a specified position. - * @param index Position within the internal data to get. - * @return The value of the internal data. - */ - @Override - protected double getDataValueInternal(int index) { - return array[index]; - } - - /** - * Set the value of the internal data at a specified position. - * @param dataValue A value to set at the given index. - * @param index Position within the internal data to set. - */ - @Override - public void setDataValueInternal(double dataValue, int index) { - array[index] = (byte) dataValue; - } - -} diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DataWrapper1D.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DataWrapper1D.java deleted file mode 100644 index 57ec72c57d..0000000000 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DataWrapper1D.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * 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.geospatial.interpolation.data; - -import org.geotools.coverage.grid.GeneralGridGeometry; - -/** - * - * converts a 2D x,y index pair into an index value. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 20, 2012            bsteffen     Initial creation
- * Nov 19, 2013  2393      bclement     added abstract method for primitive array
- * 
- * 
- * - * @author bsteffen - * @version 1.0 - */ -public abstract class DataWrapper1D extends AbstractDataWrapper { - - public DataWrapper1D(GeneralGridGeometry geometry) { - super(geometry); - } - - public DataWrapper1D(int nx, int ny) { - super(nx, ny); - } - - @Override - protected double getDataValueInternal(int x, int y) { - return getDataValueInternal(x + y * nx); - } - - @Override - public void setDataValueInternal(double dataValue, int x, int y) { - setDataValueInternal(dataValue, x + nx * y); - } - - protected abstract double getDataValueInternal(int index); - - protected abstract void setDataValueInternal(double dataValue, int index); - - /** - * Get the backing 1D primitive array - * - * @return null if array isn't available - */ - public abstract Object getArray(); - -} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/FloatArrayWrapper.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/FloatArrayWrapper.java deleted file mode 100644 index 9d9ca8450e..0000000000 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/FloatArrayWrapper.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * 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.geospatial.interpolation.data; - -import org.geotools.coverage.grid.GeneralGridGeometry; - -/** - * - * 1-dimensional float array data - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 20, 2012            bsteffen     Initial creation
- * 
- * 
- * - * @author bsteffen - * @version 1.0 - */ -public class FloatArrayWrapper extends DataWrapper1D { - - protected final float[] array; - - public FloatArrayWrapper(float[] array, GeneralGridGeometry geometry) { - super(geometry); - this.array = array; - } - - public FloatArrayWrapper(float[] array, int nx, int ny) { - super(nx, ny); - this.array = array; - } - - public FloatArrayWrapper(int nx, int ny) { - this(new float[nx * ny], nx, ny); - } - - public FloatArrayWrapper(GeneralGridGeometry geometry) { - // assume this is going to be a destination and avoid passing - // geometry to super to save time on checking for wrapping. - this(geometry.getGridRange().getSpan(0), geometry.getGridRange() - .getSpan(1)); - } - - public float[] getArray() { - return array; - } - - @Override - protected double getDataValueInternal(int index) { - return array[index]; - } - - @Override - public void setDataValueInternal(double dataValue, int index) { - array[index] = (float) dataValue; - } - -} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/IntArrayWrapper.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/IntArrayWrapper.java deleted file mode 100644 index bcf8093239..0000000000 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/IntArrayWrapper.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * 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.geospatial.interpolation.data; - -import org.geotools.coverage.grid.GeneralGridGeometry; - -/** - * Wraps an int array as a {@link DataSource} and {@link DataDestination} - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Nov 5, 2012            njensen     Initial creation
- * 
- * 
- * - * @author njensen - * @version 1.0 - */ - -public class IntArrayWrapper extends DataWrapper1D { - - protected final int[] array; - - public IntArrayWrapper(int[] array, GeneralGridGeometry geometry) { - super(geometry); - this.array = array; - } - - public IntArrayWrapper(int[] array, int nx, int ny) { - super(nx, ny); - this.array = array; - } - - public IntArrayWrapper(int nx, int ny) { - this(new int[nx * ny], nx, ny); - } - - public IntArrayWrapper(GeneralGridGeometry geometry) { - // assume this is going to be a destination and avoid passing - // geometry to super to save time on checking for wrapping. - this(geometry.getGridRange().getSpan(0), geometry.getGridRange() - .getSpan(1)); - } - - public int[] getArray() { - return array; - } - - @Override - protected double getDataValueInternal(int index) { - return array[index]; - } - - @Override - protected void setDataValueInternal(double dataValue, int index) { - array[index] = (int) dataValue; - } - -} diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/ShortArrayWrapper.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/ShortArrayWrapper.java deleted file mode 100644 index 9e027daee0..0000000000 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/ShortArrayWrapper.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * 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.geospatial.interpolation.data; - -import org.geotools.coverage.grid.GeneralGridGeometry; - -/** - * Wraps a short array as a {@link DataSource} and {@link DataDestination} - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jul 3, 2012            mschenke     Initial creation
- * 
- * 
- * - * @author mschenke - * @version 1.0 - */ - -public class ShortArrayWrapper extends DataWrapper1D { - - protected final short[] array; - - public ShortArrayWrapper(short[] array, GeneralGridGeometry geometry) { - super(geometry); - this.array = array; - } - - public ShortArrayWrapper(short[] array, int nx, int ny) { - super(nx, ny); - this.array = array; - } - - public ShortArrayWrapper(int nx, int ny) { - this(new short[nx * ny], nx, ny); - } - - public ShortArrayWrapper(GeneralGridGeometry geometry) { - // assume this is going to be a destination and avoid passing - // geometry to super to save time on checking for wrapping. - this(geometry.getGridRange().getSpan(0), geometry.getGridRange() - .getSpan(1)); - } - - public short[] getArray() { - return array; - } - - @Override - protected double getDataValueInternal(int index) { - return array[index]; - } - - @Override - public void setDataValueInternal(double dataValue, int index) { - array[index] = (short) dataValue; - } - -} diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnitConvertingDataDestination.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnitConvertingDataDestination.java deleted file mode 100644 index d68a1c8573..0000000000 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnitConvertingDataDestination.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * 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.geospatial.interpolation.data; - -import javax.measure.converter.UnitConverter; - -/** - * A data destination that converts to a unit with the specified unit converter; - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Nov 12, 2012            njensen     Initial creation
- * 
- * 
- * - * @author njensen - * @version 1.0 - */ - -public class UnitConvertingDataDestination implements DataDestination { - - protected UnitConverter unitConverter; - - protected DataDestination wrappedDestination; - - /** - * Constructor - * - * @param converter - * the unit converter to apply when setting the values in the - * destination - * @param destination - * the destination to set values on - */ - public UnitConvertingDataDestination(UnitConverter converter, - DataDestination destination) { - this.unitConverter = converter; - this.wrappedDestination = destination; - } - - @Override - public void setDataValue(double dataValue, int x, int y) { - wrappedDestination.setDataValue(unitConverter.convert(dataValue), x, y); - } - - public DataDestination getWrappedDestination() { - return wrappedDestination; - } - -} diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedByteArrayWrapper.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedByteArrayWrapper.java deleted file mode 100644 index 566335dae3..0000000000 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedByteArrayWrapper.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * 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.geospatial.interpolation.data; - -import org.geotools.coverage.grid.GeneralGridGeometry; - -/** - * {@link AbstractDataWrapper} implementation for unsigned byte array data. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Aug 3, 2012            mschenke     Initial creation
- * 
- * 
- * - * @author mschenke - * @version 1.0 - */ - -public class UnsignedByteArrayWrapper extends ByteArrayWrapper { - - public UnsignedByteArrayWrapper(byte[] array, GeneralGridGeometry geometry) { - super(array, geometry); - } - - public UnsignedByteArrayWrapper(byte[] array, int nx, int ny) { - super(array, nx, ny); - } - - public UnsignedByteArrayWrapper(int nx, int ny) { - super(nx, ny); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.common.geospatial.interpolation.data.DataWrapper1D# - * getDataValueInternal(int) - */ - @Override - protected double getDataValueInternal(int index) { - return array[index] & 0xFF; - } - -} diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedByteBufferWrapper.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedByteBufferWrapper.java deleted file mode 100644 index 05ad34aec4..0000000000 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedByteBufferWrapper.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * 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.geospatial.interpolation.data; - -import java.nio.ByteBuffer; - -import org.geotools.coverage.grid.GeneralGridGeometry; - -/** - * - * Unsigned ByteBuffer data wrapper - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 20, 2012            bsteffen     Initial creation
- * Nov 19, 2013  2393      bclement    changed to extend ByteBufferWrapper
- * 
- * 
- * - * @author bsteffen - * @version 1.0 - */ -public class UnsignedByteBufferWrapper extends ByteBufferWrapper { - - - /** - * @param buffer - * @param geometry - */ - public UnsignedByteBufferWrapper(ByteBuffer buffer, - GeneralGridGeometry geometry) { - super(buffer, geometry); - } - - /** - * @param buffer - * @param nx - * @param ny - */ - public UnsignedByteBufferWrapper(ByteBuffer buffer, int nx, int ny) { - super(buffer, nx, ny); - } - - /** - * @param geometry - */ - public UnsignedByteBufferWrapper(GeneralGridGeometry geometry) { - super(geometry); - } - - /** - * @param nx - * @param ny - */ - public UnsignedByteBufferWrapper(int nx, int ny) { - super(nx, ny); - } - - @Override - protected double getDataValueInternal(int index) { - return buffer.get(index) & 0xFF; - } - -} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedShortArrayWrapper.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedShortArrayWrapper.java deleted file mode 100644 index 838a08fdf2..0000000000 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedShortArrayWrapper.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * 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.geospatial.interpolation.data; - -import org.geotools.coverage.grid.GeneralGridGeometry; - -/** - * Wraps a short array as an unsigned {@link DataSource} and - * {@link DataDestination} - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jul 3, 2012            mschenke     Initial creation
- * 
- * 
- * - * @author mschenke - * @version 1.0 - */ - -public class UnsignedShortArrayWrapper extends ShortArrayWrapper { - - public UnsignedShortArrayWrapper(short[] array, GeneralGridGeometry geometry) { - super(array, geometry); - } - - public UnsignedShortArrayWrapper(short[] array, int nx, int ny) { - super(array, nx, ny); - } - - public UnsignedShortArrayWrapper(int nx, int ny) { - super(nx, ny); - } - - public UnsignedShortArrayWrapper(GeneralGridGeometry geometry) { - super(geometry); - } - - @Override - protected double getDataValueInternal(int index) { - return array[index] & 0xFFFF; - } - -} diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedShortBufferWrapper.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedShortBufferWrapper.java deleted file mode 100644 index 1f22c686bd..0000000000 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnsignedShortBufferWrapper.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * 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.geospatial.interpolation.data; - -import java.nio.ShortBuffer; - -import org.geotools.coverage.grid.GeneralGridGeometry; - -/** - * - * Unsigned ShortBuffer data wrapper - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 20, 2012            bsteffen     Initial creation
- * Nov 19, 2013  2393      bclement    changed to extend ShortBufferWrapper
- * 
- * 
- * - * @author bsteffen - * @version 1.0 - */ -public class UnsignedShortBufferWrapper extends ShortBufferWrapper { - - /** - * @param geometry - */ - public UnsignedShortBufferWrapper(GeneralGridGeometry geometry) { - super(geometry); - } - - /** - * @param nx - * @param ny - */ - public UnsignedShortBufferWrapper(int nx, int ny) { - super(nx, ny); - } - - /** - * @param buffer - * @param geometry - */ - public UnsignedShortBufferWrapper(ShortBuffer buffer, - GeneralGridGeometry geometry) { - super(buffer, geometry); - } - - /** - * @param buffer - * @param nx - * @param ny - */ - public UnsignedShortBufferWrapper(ShortBuffer buffer, int nx, int ny) { - super(buffer, nx, ny); - } - - @Override - protected double getDataValueInternal(int index) { - return buffer.get(index) & 0xFFFF; - } - -} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.numeric/.classpath b/edexOsgi/com.raytheon.uf.common.numeric/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.numeric/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.common.numeric/.project b/edexOsgi/com.raytheon.uf.common.numeric/.project new file mode 100644 index 0000000000..51b15e7184 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.numeric/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.common.numeric + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/edexOsgi/com.raytheon.uf.common.numeric/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.numeric/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..c537b63063 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.numeric/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/edexOsgi/com.raytheon.uf.common.numeric/.settings/org.eclipse.pde.core.prefs b/edexOsgi/com.raytheon.uf.common.numeric/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 0000000000..e8ff8be0ba --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.numeric/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +pluginProject.equinox=false +pluginProject.extensions=false +resolve.requirebundle=false diff --git a/edexOsgi/com.raytheon.uf.common.numeric/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.numeric/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..ade0f8919e --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.numeric/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Numeric +Bundle-SymbolicName: com.raytheon.uf.common.numeric +Bundle-Version: 1.14.0.qualifier +Bundle-Vendor: RAYTHEON +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Export-Package: com.raytheon.uf.common.numeric, + com.raytheon.uf.common.numeric.array, + com.raytheon.uf.common.numeric.buffer, + com.raytheon.uf.common.numeric.dest, + com.raytheon.uf.common.numeric.filter, + com.raytheon.uf.common.numeric.source diff --git a/edexOsgi/com.raytheon.uf.common.numeric/build.properties b/edexOsgi/com.raytheon.uf.common.numeric/build.properties new file mode 100644 index 0000000000..34d2e4d2da --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.numeric/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DataUtilities.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/DataUtilities.java similarity index 68% rename from edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DataUtilities.java rename to edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/DataUtilities.java index f26141ee12..38c67f6329 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DataUtilities.java +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/DataUtilities.java @@ -17,10 +17,14 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.geospatial.interpolation.data; +package com.raytheon.uf.common.numeric; + +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.source.DataSource; +import com.raytheon.uf.common.numeric.source.OffsetDataSource; /** - * Provide utility method for copying data from a {@link DataSource} to a + * Provide utility method for working with a {@link DataSource} or * {@link DataDestination}. * *
@@ -39,6 +43,22 @@ package com.raytheon.uf.common.geospatial.interpolation.data;
 
 public class DataUtilities {
 
+    /**
+     * Copy all data within the specified range from a source to a destination.
+     * For copying of different ranges {@link OffsetDataSource} can be used to
+     * shift the source indexes.
+     * 
+     * @param source
+     *            Any data source
+     * @param destination
+     *            any data destination
+     * @param nx
+     *            the width of the data to copy
+     * @param ny
+     *            the hieght of the data to copy.
+     * 
+     * @return the same destination that was provided.
+     */
     public static final  D copy(DataSource source,
             D destination, int nx, int ny) {
         for (int i = 0; i < nx; i += 1) {
@@ -49,6 +69,17 @@ public class DataUtilities {
         return destination;
     }
 
+    /**
+     * Determine the extrama of a source.
+     * 
+     * @param source
+     *            Any data source
+     * @param nx
+     *            the width of the data to copy
+     * @param ny
+     *            the hieght of the data to copy.
+     * @return The min/max values for the source.
+     */
     public static final MinMax getMinMax(DataSource source, int nx, int ny) {
         double minValue = Double.POSITIVE_INFINITY;
         double maxValue = Double.NEGATIVE_INFINITY;
@@ -69,6 +100,9 @@ public class DataUtilities {
         return new MinMax(minValue, maxValue);
     }
 
+    /**
+     * Class for holding Min/Max data values.
+     */
     public static class MinMax {
 
         private final double min;
diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/FloatArray2DWrapper.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/array/FloatArray2DWrapper.java
similarity index 62%
rename from edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/FloatArray2DWrapper.java
rename to edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/array/FloatArray2DWrapper.java
index abbb986836..0683a84358 100644
--- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/FloatArray2DWrapper.java
+++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/array/FloatArray2DWrapper.java
@@ -17,9 +17,10 @@
  * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
  * further licensing information.
  **/
-package com.raytheon.uf.common.geospatial.interpolation.data;
+package com.raytheon.uf.common.numeric.array;
 
-import org.geotools.coverage.grid.GeneralGridGeometry;
+import com.raytheon.uf.common.numeric.dest.DataDestination;
+import com.raytheon.uf.common.numeric.source.DataSource;
 
 /**
  * 
@@ -38,17 +39,17 @@ import org.geotools.coverage.grid.GeneralGridGeometry;
  * @author bsteffen
  * @version 1.0
  */
-public class FloatArray2DWrapper extends AbstractDataWrapper {
+public class FloatArray2DWrapper implements DataSource, DataDestination {
+
+    protected final int nx;
+
+    protected final int ny;
 
     protected final float[][] array;
 
-    public FloatArray2DWrapper(float[][] array, GeneralGridGeometry geometry) {
-        super(geometry);
-        this.array = array;
-    }
-
     public FloatArray2DWrapper(float[][] array, int nx, int ny) {
-        super(nx, ny);
+        this.nx = nx;
+        this.ny = ny;
         this.array = array;
     }
 
@@ -56,9 +57,13 @@ public class FloatArray2DWrapper extends AbstractDataWrapper {
         this(new float[ny][nx], nx, ny);
     }
 
-    public FloatArray2DWrapper(GeneralGridGeometry geometry) {
-        this(geometry.getGridRange().getSpan(0), geometry.getGridRange()
-                .getSpan(1));
+    protected boolean validateRange(int x, int y) {
+        if (y < 0 || y > ny - 1) {
+            return false;
+        } else if (x < 0 || x > nx - 1) {
+            return false;
+        }
+        return true;
     }
 
     public float[][] getArray() {
@@ -66,13 +71,18 @@ public class FloatArray2DWrapper extends AbstractDataWrapper {
     }
 
     @Override
-    public void setDataValueInternal(double dataValue, int x, int y) {
-        array[y][x] = (float) dataValue;
+    public void setDataValue(double dataValue, int x, int y) {
+        if (validateRange(x, y)) {
+            array[y][x] = (float) dataValue;
+        }
     }
 
     @Override
-    protected double getDataValueInternal(int x, int y) {
-        return array[y][x];
+    public double getDataValue(int x, int y) {
+        if (validateRange(x, y)) {
+            return array[y][x];
+        }
+        return Double.NaN;
     }
 
 }
\ No newline at end of file
diff --git a/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/BufferWrapper.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/BufferWrapper.java
new file mode 100644
index 0000000000..bda6404561
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/BufferWrapper.java
@@ -0,0 +1,222 @@
+/**
+ * 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.numeric.buffer;
+
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+
+import com.raytheon.uf.common.numeric.dest.DataDestination;
+import com.raytheon.uf.common.numeric.source.DataSource;
+
+/**
+ * 
+ * Abstract class for buffer backed data implementation that can act as both a
+ * source and destination.
+ * 
+ * 
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Mar 07, 2014  2791     bsteffen     Initial creation
+ * 
+ * 
+ * + * @author bsteffen + * @version 1.0 + */ +public abstract class BufferWrapper implements DataSource, + DataDestination { + + protected final int nx; + + protected final int ny; + + protected BufferWrapper(int nx, int ny) { + this.nx = nx; + this.ny = ny; + } + + /** + * @return the width of the data, + */ + public int getNx() { + return nx; + } + + /** + * @return the height of the data. + */ + public int getNy() { + return ny; + } + + protected boolean validateRange(int x, int y) { + if (y < 0 || y > ny - 1) { + return false; + } else if (x < 0 || x > nx - 1) { + return false; + } + return true; + } + + @Override + public double getDataValue(int x, int y) { + if (validateRange(x, y)) { + return getDataValueInternal(x + y * nx); + } + return Double.NaN; + } + + @Override + public void setDataValue(double dataValue, int x, int y) { + if (validateRange(x, y)) { + setDataValueInternal(dataValue, x + y * nx); + } + } + + /** + * @return the buffer that providing data for this wrapper. + */ + public abstract Buffer getBuffer(); + + /** + * + * @return an array version of this data or null if no array is available. + * No array will be available if the data is not backed by an + * array(For example direct memory or ByteBufer.as*) + */ + public abstract Object getArray(); + + protected abstract double getDataValueInternal(int index); + + protected abstract void setDataValueInternal(double dataValue, int index); + + /** + * @return The primitve class that is the type of data held in the buffer + * for this wrapper. + */ + public abstract Class getPrimitiveType(); + + /** + * Create a new buffer of a known primitive type. + * + * @param primitiveType + * The primitive type, must be one of float.class, double.class, + * byte.class, short.class, int.class, or long.class. + * @param nx + * the width of the data. + * @param ny + * the height of the data. + * @return a new BufferWrapper of the correct type. + */ + public static BufferWrapper create( + Class primitiveType, int nx, int ny) { + if (float.class.equals(primitiveType)) { + return new FloatBufferWrapper(nx, ny); + } else if (double.class.equals(primitiveType)) { + return new DoubleBufferWrapper(nx, ny); + } else if (byte.class.equals(primitiveType)) { + return new ByteBufferWrapper(nx, ny); + } else if (short.class.equals(primitiveType)) { + return new ShortBufferWrapper(nx, ny); + } else if (int.class.equals(primitiveType)) { + return new IntBufferWrapper(nx, ny); + } else if (long.class.equals(primitiveType)) { + return new LongBufferWrapper(nx, ny); + } else { + throw new IllegalArgumentException( + "Cannot make a buffer wrapper for " + + primitiveType.getName()); + } + } + + /** + * Wrap an existing numeric Buffer in BufferWrapper for convenient 2D + * indexing. + * + * @param buffer + * any Buffer except CharBuffer, Characters aren't numbers. + * @param nx + * the width of the data. + * @param ny + * the height of the data. + * @return a new BufferWrapper of the correct type. + */ + public static BufferWrapper wrap(Buffer buffer, int nx, + int ny) { + if (buffer instanceof FloatBuffer) { + return new FloatBufferWrapper((FloatBuffer) buffer, nx, ny); + } else if (buffer instanceof DoubleBuffer) { + return new DoubleBufferWrapper((DoubleBuffer) buffer, nx, ny); + } else if (buffer instanceof ByteBuffer) { + return new ByteBufferWrapper((ByteBuffer) buffer, nx, ny); + } else if (buffer instanceof ShortBuffer) { + return new ShortBufferWrapper((ShortBuffer) buffer, nx, ny); + } else if (buffer instanceof IntBuffer) { + return new IntBufferWrapper((IntBuffer) buffer, nx, ny); + } else if (buffer instanceof LongBuffer) { + return new LongBufferWrapper((LongBuffer) buffer, nx, ny); + } else { + throw new IllegalArgumentException( + "Cannot make a buffer wrapper for " + + buffer.getClass().getName()); + } + } + + /** + * Wrap an existing primitve array in BufferWrapper for convenient 2D + * indexing. + * + * @param array + * a primitve array, must be of type must be one of float[], + * double[], byte[], short[], int[], or long[]. + * @param nx + * the width of the data. + * @param ny + * the height of the data. + * @return a new BufferWrapper of the correct type. + */ + public static BufferWrapper wrapArray(Object array, int nx, int ny) { + if (array instanceof float[]) { + return new FloatBufferWrapper((float[]) array, nx, ny); + } else if (array instanceof double[]) { + return new DoubleBufferWrapper((double[]) array, nx, ny); + } else if (array instanceof byte[]) { + return new ByteBufferWrapper((byte[]) array, nx, ny); + } else if (array instanceof short[]) { + return new ShortBufferWrapper((short[]) array, nx, ny); + } else if (array instanceof int[]) { + return new IntBufferWrapper((int[]) array, nx, ny); + } else if (array instanceof long[]) { + return new LongBufferWrapper((long[]) array, nx, ny); + } else { + throw new IllegalArgumentException( + "Cannot make a buffer wrapper for " + + array.getClass().getName()); + } + } +} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/ByteBufferWrapper.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/ByteBufferWrapper.java similarity index 67% rename from edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/ByteBufferWrapper.java rename to edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/ByteBufferWrapper.java index 17f5e16fd7..8e8d355be7 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/ByteBufferWrapper.java +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/ByteBufferWrapper.java @@ -17,12 +17,11 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.geospatial.interpolation.data; +package com.raytheon.uf.common.numeric.buffer; +import java.awt.Rectangle; import java.nio.ByteBuffer; -import org.geotools.coverage.grid.GeneralGridGeometry; - /** * * ByteBuffer data wrapper @@ -33,41 +32,40 @@ import org.geotools.coverage.grid.GeneralGridGeometry; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Jun 20, 2012 bsteffen Initial creation - * Nov 19, 2013 2393 bclement added getArray + * Mar 07, 2014 2791 bsteffen Reimplemnt extending BufferWrapper. * *
* * @author bsteffen * @version 1.0 */ -public class ByteBufferWrapper extends DataWrapper1D { +public class ByteBufferWrapper extends BufferWrapper { protected final ByteBuffer buffer; - public ByteBufferWrapper(ByteBuffer buffer, GeneralGridGeometry geometry) { - super(geometry); - this.buffer = buffer; - } - public ByteBufferWrapper(ByteBuffer buffer, int nx, int ny) { super(nx, ny); this.buffer = buffer; } + public ByteBufferWrapper(byte[] array, int nx, int ny) { + this(ByteBuffer.wrap(array), nx, ny); + } + public ByteBufferWrapper(int nx, int ny) { this(ByteBuffer.allocate(nx * ny), nx, ny); } - public ByteBufferWrapper(GeneralGridGeometry geometry) { - // assume this is going to be a destination and avoid passing - // geometry to super to save time on checking for wrapping. - this(geometry.getGridRange().getSpan(0), geometry.getGridRange() - .getSpan(1)); + public ByteBufferWrapper(ByteBuffer buffer, Rectangle dimensions) { + this(buffer, dimensions.width, dimensions.height); } - public ByteBuffer getBuffer() { - return buffer; + public ByteBufferWrapper(byte[] array, Rectangle dimensions) { + this(array, dimensions.width, dimensions.height); + } + + public ByteBufferWrapper(Rectangle dimensions) { + this(dimensions.width, dimensions.height); } @Override @@ -80,12 +78,11 @@ public class ByteBufferWrapper extends DataWrapper1D { buffer.put(index, (byte) dataValue); } - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.common.geospatial.interpolation.data.DataWrapper1D# - * getPrimitiveArray() - */ + @Override + public ByteBuffer getBuffer() { + return buffer; + } + @Override public byte[] getArray() { if (buffer.hasArray()) { @@ -94,4 +91,8 @@ public class ByteBufferWrapper extends DataWrapper1D { return null; } + @Override + public Class getPrimitiveType() { + return byte.class; + } } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DoubleBufferWrapper.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/DoubleBufferWrapper.java similarity index 67% rename from edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DoubleBufferWrapper.java rename to edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/DoubleBufferWrapper.java index dcedce91ae..c49ca44c8d 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DoubleBufferWrapper.java +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/DoubleBufferWrapper.java @@ -17,12 +17,11 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.geospatial.interpolation.data; +package com.raytheon.uf.common.numeric.buffer; +import java.awt.Rectangle; import java.nio.DoubleBuffer; -import org.geotools.coverage.grid.GeneralGridGeometry; - /** * * DoubleBuffer data wrapper @@ -33,41 +32,40 @@ import org.geotools.coverage.grid.GeneralGridGeometry; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Jun 20, 2012 bsteffen Initial creation - * Nov 19, 2013 2393 bclement added getArray + * Mar 07, 2014 2791 bsteffen Reimplemnt extending BufferWrapper. * * * * @author bsteffen * @version 1.0 */ -public class DoubleBufferWrapper extends DataWrapper1D { +public class DoubleBufferWrapper extends BufferWrapper { protected final DoubleBuffer buffer; - public DoubleBufferWrapper(DoubleBuffer buffer, GeneralGridGeometry geometry) { - super(geometry); - this.buffer = buffer; - } - public DoubleBufferWrapper(DoubleBuffer buffer, int nx, int ny) { super(nx, ny); this.buffer = buffer; } + public DoubleBufferWrapper(double[] array, int nx, int ny) { + this(DoubleBuffer.wrap(array), nx, ny); + } + public DoubleBufferWrapper(int nx, int ny) { this(DoubleBuffer.allocate(nx * ny), nx, ny); } - public DoubleBufferWrapper(GeneralGridGeometry geometry) { - // assume this is going to be a destination and avoid passing - // geometry to super to save time on checking for wrapping. - this(geometry.getGridRange().getSpan(0), geometry.getGridRange() - .getSpan(1)); + public DoubleBufferWrapper(DoubleBuffer buffer, Rectangle dimensions) { + this(buffer, dimensions.width, dimensions.height); } - public DoubleBuffer getBuffer() { - return buffer; + public DoubleBufferWrapper(double[] array, Rectangle dimensions) { + this(array, dimensions.width, dimensions.height); + } + + public DoubleBufferWrapper(Rectangle dimensions) { + this(dimensions.width, dimensions.height); } @Override @@ -80,12 +78,11 @@ public class DoubleBufferWrapper extends DataWrapper1D { buffer.put(index, dataValue); } - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.common.geospatial.interpolation.data.DataWrapper1D# - * getPrimitiveArray() - */ + @Override + public DoubleBuffer getBuffer() { + return buffer; + } + @Override public double[] getArray() { if (buffer.hasArray()) { @@ -94,4 +91,8 @@ public class DoubleBufferWrapper extends DataWrapper1D { return null; } + @Override + public Class getPrimitiveType() { + return double.class; + } } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/FloatBufferWrapper.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/FloatBufferWrapper.java similarity index 67% rename from edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/FloatBufferWrapper.java rename to edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/FloatBufferWrapper.java index 9a3021ffd7..d410d0a3cf 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/FloatBufferWrapper.java +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/FloatBufferWrapper.java @@ -17,12 +17,11 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.geospatial.interpolation.data; +package com.raytheon.uf.common.numeric.buffer; +import java.awt.Rectangle; import java.nio.FloatBuffer; -import org.geotools.coverage.grid.GeneralGridGeometry; - /** * * FloatBuffer data wrapper @@ -33,41 +32,40 @@ import org.geotools.coverage.grid.GeneralGridGeometry; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Jun 20, 2012 bsteffen Initial creation - * Nov 19, 2013 2393 bclement added getArray + * Mar 07, 2014 2791 bsteffen Reimplemnt extending BufferWrapper. * * * * @author bsteffen * @version 1.0 */ -public class FloatBufferWrapper extends DataWrapper1D { +public class FloatBufferWrapper extends BufferWrapper { protected final FloatBuffer buffer; - public FloatBufferWrapper(FloatBuffer buffer, GeneralGridGeometry geometry) { - super(geometry); - this.buffer = buffer; - } - public FloatBufferWrapper(FloatBuffer buffer, int nx, int ny) { super(nx, ny); this.buffer = buffer; } + public FloatBufferWrapper(float[] array, int nx, int ny) { + this(FloatBuffer.wrap(array), nx, ny); + } + public FloatBufferWrapper(int nx, int ny) { this(FloatBuffer.allocate(nx * ny), nx, ny); } - public FloatBufferWrapper(GeneralGridGeometry geometry) { - // assume this is going to be a destination and avoid passing - // geometry to super to save time on checking for wrapping. - this(geometry.getGridRange().getSpan(0), geometry.getGridRange() - .getSpan(1)); + public FloatBufferWrapper(FloatBuffer buffer, Rectangle dimensions) { + this(buffer, dimensions.width, dimensions.height); } - public FloatBuffer getBuffer() { - return buffer; + public FloatBufferWrapper(float[] array, Rectangle dimensions) { + this(array, dimensions.width, dimensions.height); + } + + public FloatBufferWrapper(Rectangle dimensions) { + this(dimensions.width, dimensions.height); } @Override @@ -80,12 +78,11 @@ public class FloatBufferWrapper extends DataWrapper1D { buffer.put(index, (float) dataValue); } - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.common.geospatial.interpolation.data.DataWrapper1D# - * getPrimitiveArray() - */ + @Override + public FloatBuffer getBuffer() { + return buffer; + } + @Override public float[] getArray() { if (buffer.hasArray()) { @@ -94,4 +91,8 @@ public class FloatBufferWrapper extends DataWrapper1D { return null; } + @Override + public Class getPrimitiveType() { + return float.class; + } } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/IntBufferWrapper.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/IntBufferWrapper.java similarity index 67% rename from edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/IntBufferWrapper.java rename to edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/IntBufferWrapper.java index f5963a058d..4e8ffb3ec9 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/IntBufferWrapper.java +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/IntBufferWrapper.java @@ -17,12 +17,11 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.geospatial.interpolation.data; +package com.raytheon.uf.common.numeric.buffer; +import java.awt.Rectangle; import java.nio.IntBuffer; -import org.geotools.coverage.grid.GeneralGridGeometry; - /** * * IntBuffer data wrapper @@ -33,41 +32,40 @@ import org.geotools.coverage.grid.GeneralGridGeometry; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Jun 20, 2012 bsteffen Initial creation - * Nov 19, 2013 2393 bclement added getArray + * Mar 07, 2014 2791 bsteffen Reimplemnt extending BufferWrapper. * * * * @author bsteffen * @version 1.0 */ -public class IntBufferWrapper extends DataWrapper1D { +public class IntBufferWrapper extends BufferWrapper { protected final IntBuffer buffer; - public IntBufferWrapper(IntBuffer buffer, GeneralGridGeometry geometry) { - super(geometry); - this.buffer = buffer; - } - public IntBufferWrapper(IntBuffer buffer, int nx, int ny) { super(nx, ny); this.buffer = buffer; } + public IntBufferWrapper(int[] array, int nx, int ny) { + this(IntBuffer.wrap(array), nx, ny); + } + public IntBufferWrapper(int nx, int ny) { this(IntBuffer.allocate(nx * ny), nx, ny); } - public IntBufferWrapper(GeneralGridGeometry geometry) { - // assume this is going to be a destination and avoid passing - // geometry to super to save time on checking for wrapping. - this(geometry.getGridRange().getSpan(0), geometry.getGridRange() - .getSpan(1)); + public IntBufferWrapper(IntBuffer buffer, Rectangle dimensions) { + this(buffer, dimensions.width, dimensions.height); } - public IntBuffer getBuffer() { - return buffer; + public IntBufferWrapper(int[] array, Rectangle dimensions) { + this(array, dimensions.width, dimensions.height); + } + + public IntBufferWrapper(Rectangle dimensions) { + this(dimensions.width, dimensions.height); } @Override @@ -80,12 +78,11 @@ public class IntBufferWrapper extends DataWrapper1D { buffer.put(index, (int) dataValue); } - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.common.geospatial.interpolation.data.DataWrapper1D# - * getPrimitiveArray() - */ + @Override + public IntBuffer getBuffer() { + return buffer; + } + @Override public int[] getArray() { if (buffer.hasArray()) { @@ -94,4 +91,8 @@ public class IntBufferWrapper extends DataWrapper1D { return null; } + @Override + public Class getPrimitiveType() { + return int.class; + } } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/LongBufferWrapper.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/LongBufferWrapper.java new file mode 100644 index 0000000000..79503a4100 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/LongBufferWrapper.java @@ -0,0 +1,98 @@ +/** + * 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.numeric.buffer; + +import java.awt.Rectangle; +import java.nio.LongBuffer; + +/** + * + * LongBuffer data wrapper + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 07, 2014  2791     bsteffen     Reimplemnt extending BufferWrapper.
+ * 
+ * 
+ * + * @author bsteffen + * @version 1.0 + */ +public class LongBufferWrapper extends BufferWrapper { + + protected final LongBuffer buffer; + + public LongBufferWrapper(LongBuffer buffer, int nx, int ny) { + super(nx, ny); + this.buffer = buffer; + } + + public LongBufferWrapper(long[] array, int nx, int ny) { + this(LongBuffer.wrap(array), nx, ny); + } + + public LongBufferWrapper(int nx, int ny) { + this(LongBuffer.allocate(nx * ny), nx, ny); + } + + public LongBufferWrapper(LongBuffer buffer, Rectangle dimensions) { + this(buffer, dimensions.width, dimensions.height); + } + + public LongBufferWrapper(long[] array, Rectangle dimensions) { + this(array, dimensions.width, dimensions.height); + } + + public LongBufferWrapper(Rectangle dimensions) { + this(dimensions.width, dimensions.height); + } + + @Override + protected double getDataValueInternal(int index) { + return buffer.get(index); + } + + @Override + public void setDataValueInternal(double dataValue, int index) { + buffer.put(index, (long) dataValue); + } + + @Override + public LongBuffer getBuffer() { + return buffer; + } + + @Override + public long[] getArray() { + if (buffer.hasArray()) { + return buffer.array(); + } + return null; + } + + @Override + public Class getPrimitiveType() { + return long.class; + } +} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/ShortBufferWrapper.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/ShortBufferWrapper.java similarity index 64% rename from edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/ShortBufferWrapper.java rename to edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/ShortBufferWrapper.java index ab10bf1b98..1f0ef7a3f4 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/ShortBufferWrapper.java +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/buffer/ShortBufferWrapper.java @@ -17,12 +17,11 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.geospatial.interpolation.data; +package com.raytheon.uf.common.numeric.buffer; +import java.awt.Rectangle; import java.nio.ShortBuffer; -import org.geotools.coverage.grid.GeneralGridGeometry; - /** * * ShortBuffer data wrapper @@ -33,41 +32,40 @@ import org.geotools.coverage.grid.GeneralGridGeometry; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Jun 20, 2012 bsteffen Initial creation - * Nov 19, 2013 2393 bclement added getArray + * Mar 07, 2014 2791 bsteffen Reimplemnt extending BufferWrapper. * * * * @author bsteffen * @version 1.0 */ -public class ShortBufferWrapper extends DataWrapper1D { +public class ShortBufferWrapper extends BufferWrapper { protected final ShortBuffer buffer; - public ShortBufferWrapper(ShortBuffer buffer, GeneralGridGeometry geometry) { - super(geometry); - this.buffer = buffer; - } - public ShortBufferWrapper(ShortBuffer buffer, int nx, int ny) { super(nx, ny); this.buffer = buffer; } + public ShortBufferWrapper(short[] array, int nx, int ny) { + this(ShortBuffer.wrap(array), nx, ny); + } + public ShortBufferWrapper(int nx, int ny) { this(ShortBuffer.allocate(nx * ny), nx, ny); } - public ShortBufferWrapper(GeneralGridGeometry geometry) { - // assume this is going to be a destination and avoid passing - // geometry to super to save time on checking for wrapping. - this(geometry.getGridRange().getSpan(0), geometry.getGridRange() - .getSpan(1)); + public ShortBufferWrapper(ShortBuffer buffer, Rectangle dimensions) { + this(buffer, dimensions.width, dimensions.height); } - public ShortBuffer getBuffer() { - return buffer; + public ShortBufferWrapper(short[] array, Rectangle dimensions) { + this(array, dimensions.width, dimensions.height); + } + + public ShortBufferWrapper(Rectangle dimensions) { + this(dimensions.width, dimensions.height); } @Override @@ -76,16 +74,15 @@ public class ShortBufferWrapper extends DataWrapper1D { } @Override - public void setDataValueInternal(double dataValue, int index) { + protected void setDataValueInternal(double dataValue, int index) { buffer.put(index, (short) dataValue); } - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.common.geospatial.interpolation.data.DataWrapper1D# - * getPrimitiveArray() - */ + @Override + public ShortBuffer getBuffer() { + return buffer; + } + @Override public short[] getArray() { if (buffer.hasArray()) { @@ -94,4 +91,8 @@ public class ShortBufferWrapper extends DataWrapper1D { return null; } + @Override + public Class getPrimitiveType() { + return short.class; + } } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DataDestination.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/dest/DataDestination.java similarity index 79% rename from edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DataDestination.java rename to edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/dest/DataDestination.java index 98a879aaf9..6a8f11f6b4 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DataDestination.java +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/dest/DataDestination.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.geospatial.interpolation.data; +package com.raytheon.uf.common.numeric.dest; /** * An abstraction for writing numeric data from a 2D grid of numeric data. @@ -26,9 +26,10 @@ package com.raytheon.uf.common.geospatial.interpolation.data; * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Jun 18, 2012 bsteffen Initial creation + * Date Ticket# Engineer Description + * ------------- -------- ----------- -------------------------- + * Jun 18, 2012 bsteffen Initial creation + * Mar 07, 2014 2791 bsteffen Move to numeric plugin. * * * diff --git a/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/dest/FilteredDataDestination.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/dest/FilteredDataDestination.java new file mode 100644 index 0000000000..13d2ae1bce --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/dest/FilteredDataDestination.java @@ -0,0 +1,88 @@ +/** + * 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.numeric.dest; + +import java.util.Arrays; + +import com.raytheon.uf.common.numeric.filter.DataFilter; + +/** + * A Destination which filters the input values before applying then to another + * destination. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Mar 06, 2014  2791     bsteffen    Initial creation
+ * 
+ * 
+ * + * @author bsteffen + * @version 1.0 + */ + +public class FilteredDataDestination implements DataDestination { + + protected final DataDestination wrappedDestination; + + protected final DataFilter[] filters; + + protected FilteredDataDestination(DataDestination wrappedDestination, + DataFilter... filters) { + this.wrappedDestination = wrappedDestination; + this.filters = filters; + } + + @Override + public void setDataValue(double dataValue, int x, int y) { + for (DataFilter filter : filters) { + dataValue = filter.filter(dataValue); + } + wrappedDestination.setDataValue(dataValue, x, y); + } + + public DataDestination getWrappedDestination() { + return wrappedDestination; + } + + public DataFilter[] getFilters() { + return filters; + } + + public static FilteredDataDestination addFilters( + DataDestination wrappedDestination, DataFilter... filters) { + if (FilteredDataDestination.class.equals(wrappedDestination.getClass())) { + FilteredDataDestination oldDest = (FilteredDataDestination) wrappedDestination; + DataFilter[] oldFilters = oldDest.getFilters(); + DataFilter[] newFilters = Arrays.copyOf(oldFilters, filters.length + + oldFilters.length); + System.arraycopy(oldFilters, 0, newFilters, filters.length, + oldFilters.length); + return new FilteredDataDestination(oldDest.getWrappedDestination(), + newFilters); + } else { + return new FilteredDataDestination(wrappedDestination, filters); + } + } + +} diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnitConvertingDataSource.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/DataFilter.java similarity index 51% rename from edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnitConvertingDataSource.java rename to edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/DataFilter.java index e6ed48572f..1dee0dff41 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/UnitConvertingDataSource.java +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/DataFilter.java @@ -17,13 +17,16 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.geospatial.interpolation.data; +package com.raytheon.uf.common.numeric.filter; -import javax.measure.converter.UnitConverter; +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.source.DataSource; /** - * - * Source which wraps another source and converts data on demand. + * An abstraction for any algorithm that takes a number and converts it to + * another number. Some of the uses of filters are data validation, unit + * conversion or data mapping. Filters are useful for manipulating data in a + * {@link DataSource} or {@link DataDestination}. * *
  * 
@@ -31,37 +34,14 @@ import javax.measure.converter.UnitConverter;
  * 
  * Date          Ticket#  Engineer    Description
  * ------------- -------- ----------- --------------------------
- * Feb 25, 2014  2791     bsteffen    Initial creation
+ * Mar 06, 2014  2791     bsteffen    Initial creation
  * 
  * 
* * @author bsteffen * @version 1.0 */ -public class UnitConvertingDataSource implements DataSource { - - protected UnitConverter unitConverter; - - protected DataSource wrappedSource; - - /** - * Constructor - * - * @param converter - * the unit converter to apply when setting the values in the - * destination - * @param source - * the source to get values from - */ - public UnitConvertingDataSource(UnitConverter converter, DataSource source) { - this.unitConverter = converter; - this.wrappedSource = source; - } - - @Override - public double getDataValue(int x, int y) { - double val = unitConverter.convert(wrappedSource.getDataValue(x, y)); - return val; - } +public interface DataFilter { + public double filter(double value); } diff --git a/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/FillValueFilter.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/FillValueFilter.java new file mode 100644 index 0000000000..735660798b --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/FillValueFilter.java @@ -0,0 +1,70 @@ +/** + * 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.numeric.filter; + +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.dest.FilteredDataDestination; +import com.raytheon.uf.common.numeric.source.DataSource; +import com.raytheon.uf.common.numeric.source.FilteredDataSource; + +/** + * A Filter which converts any occurance of a given value to Double.NaN. This is + * most useful for a source of integer types that use a specific value to + * represent invalid points. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Mar 06, 2014  2791     bsteffen    Initial creation
+ * 
+ * 
+ * + * @author bsteffen + * @version 1.0 + */ +public class FillValueFilter implements DataFilter { + + private final double fillValue; + + public FillValueFilter(double fillValue) { + this.fillValue = fillValue; + } + + @Override + public double filter(double value) { + if (value == fillValue) { + return Double.NaN; + } + return fillValue; + } + + public static FilteredDataSource apply(DataSource source, double fillValue) { + return FilteredDataSource.addFilters(source, new FillValueFilter( + fillValue)); + } + + public static DataDestination apply(DataDestination dest, double fillValue) { + return FilteredDataDestination.addFilters(dest, new FillValueFilter( + fillValue)); + } +} diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/InvalidRangeDataSource.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/InvalidRangeFilter.java similarity index 55% rename from edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/InvalidRangeDataSource.java rename to edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/InvalidRangeFilter.java index 43ac423929..a169dc8e0f 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/InvalidRangeDataSource.java +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/InvalidRangeFilter.java @@ -17,7 +17,12 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.geospatial.interpolation.data; +package com.raytheon.uf.common.numeric.filter; + +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.dest.FilteredDataDestination; +import com.raytheon.uf.common.numeric.source.DataSource; +import com.raytheon.uf.common.numeric.source.FilteredDataSource; /** * Returns NaN for all data values that are within a range that can be @@ -29,7 +34,7 @@ package com.raytheon.uf.common.geospatial.interpolation.data; * * Date Ticket# Engineer Description * ------------- -------- ----------- -------------------------- - * Feb 24, 2014 2791 bsteffen Initial creation + * Mar 06, 2014 2791 bsteffen Initial creation * * * @@ -37,29 +42,34 @@ package com.raytheon.uf.common.geospatial.interpolation.data; * @version 1.0 */ -public class InvalidRangeDataSource implements DataSource { - - protected final DataSource wrappedSource; +public class InvalidRangeFilter implements DataFilter { protected final double badlo; protected final double badhi; - public InvalidRangeDataSource(DataSource wrappedSource, double badlo, - double badhi) { - this.wrappedSource = wrappedSource; + public InvalidRangeFilter(double badlo, double badhi) { this.badlo = badlo; this.badhi = badhi; } - @Override - public double getDataValue(int x, int y) { - double val = wrappedSource.getDataValue(y, x); - if (val > badlo && val < badhi) { - val = Double.NaN; + public double filter(double value) { + if (value > badlo && value < badhi) { + return Double.NaN; } - return val; + return value; } + public static FilteredDataSource apply(DataSource source, double badlo, + double badhi) { + return FilteredDataSource.addFilters(source, new InvalidRangeFilter( + badlo, badhi)); + } + + public static FilteredDataDestination apply(DataDestination dest, + double badlo, double badhi) { + return FilteredDataDestination.addFilters(dest, new InvalidRangeFilter( + badlo, badhi)); + } } diff --git a/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/InverseFillValueFilter.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/InverseFillValueFilter.java new file mode 100644 index 0000000000..420c4d1efc --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/InverseFillValueFilter.java @@ -0,0 +1,73 @@ +/** + * 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.numeric.filter; + +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.dest.FilteredDataDestination; +import com.raytheon.uf.common.numeric.source.DataSource; +import com.raytheon.uf.common.numeric.source.FilteredDataSource; + +/** + * A Filter which converts any occurance of Double.NaN to a specific fill valie. + * This is most useful for a destination of integer types that use a specific + * value to represent invalid points. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Mar 06, 2014  2791     bsteffen    Initial creation
+ * 
+ * 
+ * + * @author bsteffen + * @version 1.0 + */ + +public class InverseFillValueFilter implements DataFilter { + + private final double fillValue; + + public InverseFillValueFilter(double fillValue) { + this.fillValue = fillValue; + } + + @Override + public double filter(double value) { + if (Double.isNaN(value)) { + return fillValue; + } + return value; + } + + public static FilteredDataSource apply(DataSource source, double fillValue) { + return FilteredDataSource.addFilters(source, + new InverseFillValueFilter(fillValue)); + } + + public static FilteredDataDestination apply(DataDestination dest, + double fillValue) { + return FilteredDataDestination.addFilters(dest, + new InverseFillValueFilter(fillValue)); + } + +} diff --git a/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/UnsignedFilter.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/UnsignedFilter.java new file mode 100644 index 0000000000..c651d35ec5 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/UnsignedFilter.java @@ -0,0 +1,68 @@ +/** + * 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.numeric.filter; + +import com.raytheon.uf.common.numeric.buffer.ByteBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.ShortBufferWrapper; +import com.raytheon.uf.common.numeric.source.DataSource; +import com.raytheon.uf.common.numeric.source.FilteredDataSource; + +/** + * + * Converts a source providing regular short or byte data to a source providing + * unsigned versions of the same data. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 06, 2014  2791     bsteffen    Initial creation
+ * 
+ * 
+ * + * @author bsteffen + * @version 1.0 + */ +public class UnsignedFilter implements DataFilter { + + private final int mask; + + private UnsignedFilter(int mask) { + this.mask = mask; + } + + @Override + public double filter(double value) { + return ((int) value) & mask; + } + + public static DataSource apply(ByteBufferWrapper byteData) { + return FilteredDataSource + .addFilters(byteData, new UnsignedFilter(0xFF)); + } + + public static DataSource apply(ShortBufferWrapper shortData) { + return FilteredDataSource.addFilters(shortData, new UnsignedFilter( + 0xFFFF)); + } + +} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/ValidRangeFilter.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/ValidRangeFilter.java new file mode 100644 index 0000000000..2fba66507b --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/filter/ValidRangeFilter.java @@ -0,0 +1,73 @@ +/** + * 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.numeric.filter; + +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.dest.FilteredDataDestination; +import com.raytheon.uf.common.numeric.source.DataSource; +import com.raytheon.uf.common.numeric.source.FilteredDataSource; + +/** + * Converts all input values that are outside of a specific range to NaN. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Mar 06, 2014  2791     bsteffen    Initial creation
+ * 
+ * 
+ * + * @author bsteffen + * @version 1.0 + */ +public class ValidRangeFilter implements DataFilter { + + protected final double minValid; + + protected final double maxValid; + + public ValidRangeFilter(double minValid, double maxValid) { + this.minValid = minValid; + this.maxValid = maxValid; + } + + @Override + public double filter(double value) { + if (value < minValid || value > maxValid) { + return Double.NaN; + } + return value; + } + + public static FilteredDataSource apply(DataSource source, double minValid, + double maxValid) { + return FilteredDataSource.addFilters(source, new ValidRangeFilter( + minValid, maxValid)); + } + + public static FilteredDataDestination apply(DataDestination dest, + double minValid, double maxValid) { + return FilteredDataDestination.addFilters(dest, new ValidRangeFilter( + minValid, maxValid)); + } +} diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/AbstractTiledDataSource.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/AbstractTiledDataSource.java similarity index 97% rename from edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/AbstractTiledDataSource.java rename to edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/AbstractTiledDataSource.java index 2b64e40dbb..50bdc9bc25 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/AbstractTiledDataSource.java +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/AbstractTiledDataSource.java @@ -17,8 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.geospatial.interpolation.data; - +package com.raytheon.uf.common.numeric.source; /** * DataSource which can retrieve tiles of data on demand. diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/AxisSwapDataSource.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/AxisSwapDataSource.java similarity index 95% rename from edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/AxisSwapDataSource.java rename to edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/AxisSwapDataSource.java index 979be4679f..d06f8ee9c7 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/AxisSwapDataSource.java +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/AxisSwapDataSource.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.geospatial.interpolation.data; +package com.raytheon.uf.common.numeric.source; /** * Wrapper source which swaps the X and Y axis when accessing data. diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DataSource.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/DataSource.java similarity index 62% rename from edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DataSource.java rename to edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/DataSource.java index 342afd9282..686873b9a2 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/DataSource.java +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/DataSource.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.geospatial.interpolation.data; +package com.raytheon.uf.common.numeric.source; /** * An abstraction for reading numeric data from a 2D grid of numeric data. @@ -26,9 +26,10 @@ package com.raytheon.uf.common.geospatial.interpolation.data; * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Jun 18, 2012 bsteffen Initial creation + * Date Ticket# Engineer Description + * ------------- -------- ----------- -------------------------- + * Jun 18, 2012 bsteffen Initial creation + * Mar 07, 2014 2791 bsteffen Move to numeric plugin. * * * @@ -38,6 +39,17 @@ package com.raytheon.uf.common.geospatial.interpolation.data; public interface DataSource { + /** + * Get a data value at the specified location. If the coordiantes are + * outside the valid range of data Double.NaN should be returned without an + * exception. + * + * @param x + * x coordiante of data + * @param y + * y coordiante of data + * @return a data value + */ public double getDataValue(int x, int y); } diff --git a/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/FilteredDataSource.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/FilteredDataSource.java new file mode 100644 index 0000000000..a3bc440c33 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/FilteredDataSource.java @@ -0,0 +1,88 @@ +/** + * 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.numeric.source; + +import java.util.Arrays; + +import com.raytheon.uf.common.numeric.filter.DataFilter; + +/** + * A Source which filters the values retrieved from another source source. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Mar 06, 2014  2791     bsteffen    Initial creation
+ * 
+ * 
+ * + * @author bsteffen + * @version 1.0 + */ + +public class FilteredDataSource implements DataSource { + + protected final DataSource wrappedSource; + + protected final DataFilter[] filters; + + protected FilteredDataSource(DataSource wrappedSource, + DataFilter... filters) { + this.wrappedSource = wrappedSource; + this.filters = filters; + } + + @Override + public double getDataValue(int x, int y) { + double dataValue = wrappedSource.getDataValue(x, y); + for (DataFilter filter : filters) { + dataValue = filter.filter(dataValue); + } + return dataValue; + } + + protected DataFilter[] getFilters() { + return filters; + } + + protected DataSource getWrappedSource() { + return wrappedSource; + } + + public static FilteredDataSource addFilters(DataSource wrappedSource, + DataFilter... filters){ + if (FilteredDataSource.class.equals(wrappedSource.getClass())) { + FilteredDataSource oldSource = (FilteredDataSource) wrappedSource; + DataFilter[] oldFilters = oldSource.getFilters(); + DataFilter[] newFilters = Arrays.copyOf(oldFilters, filters.length + + oldFilters.length); + System.arraycopy(oldFilters, 0, newFilters, filters.length, + oldFilters.length); + return new FilteredDataSource(oldSource.getWrappedSource(), + newFilters); + }else{ + return new FilteredDataSource(wrappedSource, filters); + } + } + +} diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/OffsetDataSource.java b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/OffsetDataSource.java similarity index 96% rename from edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/OffsetDataSource.java rename to edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/OffsetDataSource.java index 8371113fd4..36f2a9b988 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/OffsetDataSource.java +++ b/edexOsgi/com.raytheon.uf.common.numeric/src/com/raytheon/uf/common/numeric/source/OffsetDataSource.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.geospatial.interpolation.data; +package com.raytheon.uf.common.numeric.source; /** * DataSource which wraps another DataSource but offsets the coordinates by diff --git a/edexOsgi/com.raytheon.uf.common.topo/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.topo/META-INF/MANIFEST.MF index 22cd9731e4..45149c2c39 100644 --- a/edexOsgi/com.raytheon.uf.common.topo/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.topo/META-INF/MANIFEST.MF @@ -2,12 +2,12 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Topo Plug-in Bundle-SymbolicName: com.raytheon.uf.common.topo -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON -Eclipse-BuddyPolicy: registered, ext, global Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: com.raytheon.uf.common.datastorage;bundle-version="1.11.17", - com.raytheon.uf.common.serialization;bundle-version="1.11.17", - com.raytheon.uf.common.geospatial;bundle-version="1.11.17", - com.raytheon.uf.common.status;bundle-version="1.12.1174" +Require-Bundle: com.raytheon.uf.common.datastorage, + com.raytheon.uf.common.serialization, + com.raytheon.uf.common.geospatial;bundle-version="1.14.0", + com.raytheon.uf.common.status, + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Export-Package: com.raytheon.uf.common.topo diff --git a/edexOsgi/com.raytheon.uf.common.topo/src/com/raytheon/uf/common/topo/CachedTopoQuery.java b/edexOsgi/com.raytheon.uf.common.topo/src/com/raytheon/uf/common/topo/CachedTopoQuery.java index 6dc7750ebc..41a85bb58e 100644 --- a/edexOsgi/com.raytheon.uf.common.topo/src/com/raytheon/uf/common/topo/CachedTopoQuery.java +++ b/edexOsgi/com.raytheon.uf.common.topo/src/com/raytheon/uf/common/topo/CachedTopoQuery.java @@ -32,7 +32,7 @@ import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.geospatial.interpolation.GridReprojection; import com.raytheon.uf.common.geospatial.interpolation.LatLonGridSampler; import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; @@ -165,7 +165,8 @@ public class CachedTopoQuery { * @return the topo data array in row major order */ public float[] getHeight(GridGeometry2D targetGeom) { - FloatArrayWrapper destination = new FloatArrayWrapper(targetGeom); + FloatBufferWrapper destination = new FloatBufferWrapper( + targetGeom.getGridRange2D()); GridReprojection reprojection = new GridReprojection(source.getGridGeometry(), targetGeom); try { reprojection.reprojectedGrid(new NearestNeighborInterpolation(), source, destination); diff --git a/edexOsgi/com.raytheon.uf.common.topo/src/com/raytheon/uf/common/topo/TiledTopoSource.java b/edexOsgi/com.raytheon.uf.common.topo/src/com/raytheon/uf/common/topo/TiledTopoSource.java index 2c5f6e3b4f..ae080b243c 100644 --- a/edexOsgi/com.raytheon.uf.common.topo/src/com/raytheon/uf/common/topo/TiledTopoSource.java +++ b/edexOsgi/com.raytheon.uf.common.topo/src/com/raytheon/uf/common/topo/TiledTopoSource.java @@ -31,13 +31,10 @@ import org.geotools.coverage.grid.GridGeometry2D; import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.Request; import com.raytheon.uf.common.datastorage.StorageException; -import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; -import com.raytheon.uf.common.datastorage.records.ShortDataRecord; -import com.raytheon.uf.common.geospatial.interpolation.data.AbstractTiledDataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.ShortArrayWrapper; +import com.raytheon.uf.common.numeric.buffer.BufferWrapper; +import com.raytheon.uf.common.numeric.source.AbstractTiledDataSource; +import com.raytheon.uf.common.numeric.source.DataSource; /** * Tiled data source for loading topo tiles and caching tiles as soft reference @@ -47,10 +44,12 @@ import com.raytheon.uf.common.geospatial.interpolation.data.ShortArrayWrapper; * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Dec 11, 2012 bsteffen Initial creation - * Aug 06, 2013 2235 bsteffen Added Caching version of TopoQuery. + * Date Ticket# Engineer Description + * ------------- -------- ----------- -------------------------- + * Dec 11, 2012 bsteffen Initial creation + * Aug 06, 2013 2235 bsteffen Added Caching version of TopoQuery. + * Mar 07, 2014 2791 bsteffen Move Data Source/Destination to numeric + * plugin. * * * @@ -69,8 +68,7 @@ public class TiledTopoSource extends AbstractTiledDataSource { private Map> tiles = new HashMap>(); public TiledTopoSource(int tileSize, GridGeometry2D gridGeometry, - IDataStore dataStore, - String dataset) { + IDataStore dataStore, String dataset) { super(tileSize, gridGeometry.getGridRange2D().width, gridGeometry .getGridRange2D().height); this.gridGeometry = gridGeometry; @@ -96,6 +94,7 @@ public class TiledTopoSource extends AbstractTiledDataSource { } + @Override protected DataSource getTile(int startX, int startY, int width, int height) { Point key = new Point(startX, startY); DataSource tile = null; @@ -114,21 +113,11 @@ public class TiledTopoSource extends AbstractTiledDataSource { protected DataSource requestTile(int startX, int startY, int width, int height) { try { - IDataRecord record = dataStore.retrieve( - "/", - dataset, - Request.buildSlab(new int[] { startX, startY }, new int[] { - startX + width, startY + height })); - if (record instanceof FloatDataRecord) { - return new FloatArrayWrapper((float[]) record.getDataObject(), - width, height); - } else if (record instanceof ShortDataRecord) { - return new ShortArrayWrapper((short[]) record.getDataObject(), - width, height); - } else { - throw new DataRetrievalException("Unrecognized record type: " - + record.getClass().getSimpleName()); - } + Request req = Request.buildSlab(new int[] { startX, startY }, + new int[] { startX + width, startY + height }); + IDataRecord record = dataStore.retrieve("/", dataset, req); + return BufferWrapper.wrapArray(record.getDataObject(), width, + height); } catch (FileNotFoundException e) { throw new DataRetrievalException(e); } catch (StorageException e) { diff --git a/edexOsgi/com.raytheon.uf.edex.database/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.database/META-INF/MANIFEST.MF index f6a3e6c347..35aa76af05 100644 --- a/edexOsgi/com.raytheon.uf.edex.database/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.database/META-INF/MANIFEST.MF @@ -21,7 +21,8 @@ Require-Bundle: com.raytheon.uf.common.dataquery;bundle-version="1.0.0", com.raytheon.uf.common.localization;bundle-version="1.12.1174", com.raytheon.uf.common.util, org.slf4j;bundle-version="1.7.5", - org.reflections;bundle-version="0.9.9" + org.reflections;bundle-version="0.9.9", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Export-Package: com.raytheon.uf.edex.database, com.raytheon.uf.edex.database.cluster, com.raytheon.uf.edex.database.cluster.handler, diff --git a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/DataRecordWrapUtil.java b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/DataRecordWrapUtil.java deleted file mode 100644 index 24f0a697b8..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/DataRecordWrapUtil.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * 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.edex.database.plugin; - -import com.raytheon.uf.common.datastorage.StorageException; -import com.raytheon.uf.common.datastorage.records.ByteDataRecord; -import com.raytheon.uf.common.datastorage.records.FloatDataRecord; -import com.raytheon.uf.common.datastorage.records.IDataRecord; -import com.raytheon.uf.common.datastorage.records.IntegerDataRecord; -import com.raytheon.uf.common.datastorage.records.ShortDataRecord; -import com.raytheon.uf.common.geospatial.interpolation.data.AbstractDataWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.ByteArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.DataWrapper1D; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.IntArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.ShortArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.UnsignedByteArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.UnsignedShortArrayWrapper; - -/** - * Utility for wrapping data records to be a data source/destination - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Nov 19, 2013  2393      bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ - -public class DataRecordWrapUtil { - - /** - * Create an {@link AbstractDataWrapper} source from the supplied - * {@link IDataRecord} with given dimensions. - * - * @param rec - * The record containing data to be wrapped. - * @param nx - * Number of items on the x axis. - * @param ny - * Number of items on the y axis. - * @return The wrapped data. - * @throws StorageException - */ - public static DataWrapper1D wrap(IDataRecord rec, int nx, int ny) - throws StorageException { - // default to signed data - return wrap(rec, nx, ny, false); - } - - /** - * Create an {@link AbstractDataWrapper} source from the supplied - * {@link IDataRecord} with given dimensions. - * - * @param rec - * The record containing data to be wrapped. - * @param nx - * Number of items on the x axis. - * @param ny - * Number of items on the y axis. - * @param unsigned - * attempt to treat the data as unsigned if possible - * @return The wrapped data. - * @throws StorageException - */ - public static DataWrapper1D wrap(IDataRecord rec, int nx, int ny, - boolean unsigned) throws StorageException { - DataWrapper1D source = null; - - if (rec instanceof ByteDataRecord) { - byte[] b = ((ByteDataRecord) rec).getByteData(); - if (unsigned) { - source = new UnsignedByteArrayWrapper(b, nx, ny); - } else { - source = new ByteArrayWrapper(b, nx, ny); - } - } else if (rec instanceof ShortDataRecord) { - short[] s = ((ShortDataRecord) rec).getShortData(); - if (unsigned) { - source = new UnsignedShortArrayWrapper(s, nx, ny); - } else { - source = new ShortArrayWrapper(s, nx, ny); - } - } else if (rec instanceof IntegerDataRecord) { - int[] i = ((IntegerDataRecord) rec).getIntData(); - source = new IntArrayWrapper(i, nx, ny); - } else if (rec instanceof FloatDataRecord) { - float[] f = ((FloatDataRecord) rec).getFloatData(); - source = new FloatArrayWrapper(f, nx, ny); - } else { - throw new StorageException("Unsupported data record type: " - + rec.getClass(), rec); - } - return source; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/DownscaleStoreUtil.java b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/DownscaleStoreUtil.java index 5675d7cab2..4e4a728a9e 100644 --- a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/DownscaleStoreUtil.java +++ b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/DownscaleStoreUtil.java @@ -29,8 +29,14 @@ import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.StorageException; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.geospatial.interpolation.GridDownscaler; -import com.raytheon.uf.common.geospatial.interpolation.data.AbstractDataWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.DataWrapper1D; +import com.raytheon.uf.common.numeric.buffer.BufferWrapper; +import com.raytheon.uf.common.numeric.buffer.ByteBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.ShortBufferWrapper; +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.filter.FillValueFilter; +import com.raytheon.uf.common.numeric.filter.InverseFillValueFilter; +import com.raytheon.uf.common.numeric.filter.UnsignedFilter; +import com.raytheon.uf.common.numeric.source.DataSource; /** * Utility for storing downscaled data to datastore @@ -39,9 +45,11 @@ import com.raytheon.uf.common.geospatial.interpolation.data.DataWrapper1D; * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Nov 19, 2013 2393 bclement Initial creation + * Date Ticket# Engineer Description + * ------------- -------- ----------- -------------------------- + * Nov 19, 2013 2393 bclement Initial creation + * Mar 07, 2014 2791 bsteffen Move Data Source/Destination to numeric + * plugin. * * * @@ -72,6 +80,8 @@ public class DownscaleStoreUtil { * @return fill value */ public double getFillValue(); + + public boolean isSigned(); } /** @@ -86,7 +96,7 @@ public class DownscaleStoreUtil { */ public static int storeInterpolated( IDataStore dataStore, GridDownscaler downScaler, - DataWrapper1D dataSource, IDataRecordCreator creator) + BufferWrapper dataSource, IDataRecordCreator creator) throws StorageException { // default to batch storage return storeInterpolated(dataStore, downScaler, dataSource, creator, @@ -108,11 +118,9 @@ public class DownscaleStoreUtil { */ public static int storeInterpolated( IDataStore dataStore, GridDownscaler downScaler, - DataWrapper1D dataSource, IDataRecordCreator creator, + BufferWrapper dataWrapper, IDataRecordCreator creator, boolean storeAfterEach) throws StorageException { - dataSource.setFillValue(creator.getFillValue()); - // How many interpolation levels do we need for this data? int levels = downScaler.getNumberOfDownscaleLevels(); @@ -125,18 +133,33 @@ public class DownscaleStoreUtil { int downScaleLevel = level + 1; Rectangle size = downScaler.getDownscaleSize(downScaleLevel); - DataWrapper1D dest = AbstractDataWrapper.createNew( - dataSource.getClass(), size); - dest.setFillValue(creator.getFillValue()); + BufferWrapper destWrapper = BufferWrapper + .create(dataWrapper.getPrimitiveType(), + size.width, size.height); + + DataSource dataSource = dataWrapper; + if (creator.isSigned() == false) { + if (dataSource instanceof ByteBufferWrapper) { + dataSource = UnsignedFilter + .apply((ByteBufferWrapper) dataSource); + } else if (dataSource instanceof ShortBufferWrapper) { + dataSource = UnsignedFilter + .apply((ShortBufferWrapper) dataSource); + } + } + dataSource = FillValueFilter.apply(dataSource, + creator.getFillValue()); + DataDestination dataDest = InverseFillValueFilter.apply( + (DataDestination) destWrapper, creator.getFillValue()); try { // Downscale from previous level downScaler.downscale(downScaleLevel - 1, downScaleLevel, - dataSource, dest); - Object data = dest.getArray(); + dataSource, dataDest); + Object data = destWrapper.getArray(); if (data == null) { throw new StorageException( "Unable to get downscaled data from destination type: " - + dest.getClass(), null); + + destWrapper.getClass(), null); } IDataRecord dr = creator.create(data, downScaleLevel, size); dataStore.addDataRecord(dr); @@ -144,7 +167,7 @@ public class DownscaleStoreUtil { dataStore.store(); } // Set source to current level - dataSource = dest; + dataWrapper = destWrapper; } catch (TransformException e) { throw new StorageException( "Error creating downscaled data", null, e); diff --git a/edexOsgi/com.raytheon.uf.edex.grid.staticdata/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.grid.staticdata/META-INF/MANIFEST.MF index 27b004ea82..c7e3c0d11c 100644 --- a/edexOsgi/com.raytheon.uf.edex.grid.staticdata/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.grid.staticdata/META-INF/MANIFEST.MF @@ -2,20 +2,21 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Grid Static Data Bundle-SymbolicName: com.raytheon.uf.edex.grid.staticdata -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: javax.measure;bundle-version="1.0.0", - com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0", - com.raytheon.uf.edex.plugin.grid;bundle-version="1.0.0", - com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174", - com.raytheon.uf.common.parameter;bundle-version="1.0.0", - com.raytheon.uf.common.status;bundle-version="1.12.1174", - com.raytheon.uf.common.gridcoverage;bundle-version="1.0.0", - com.raytheon.uf.edex.decodertools;bundle-version="1.12.1174", - com.raytheon.edex.common;bundle-version="1.12.1174", - com.raytheon.edex.plugin.gfe;bundle-version="1.12.1174", - com.raytheon.uf.common.comm;bundle-version="1.12.1174", - com.raytheon.uf.common.topo;bundle-version="1.12.1174" +Require-Bundle: javax.measure, + com.raytheon.uf.common.dataplugin.grid;bundle-version="1.13.0", + com.raytheon.uf.edex.plugin.grid, + com.raytheon.uf.common.dataplugin.level;bundle-version="1.14.0", + com.raytheon.uf.common.parameter, + com.raytheon.uf.common.status, + com.raytheon.uf.common.gridcoverage;bundle-version="1.13.0", + com.raytheon.uf.edex.decodertools, + com.raytheon.edex.common, + com.raytheon.edex.plugin.gfe, + com.raytheon.uf.common.comm, + com.raytheon.uf.common.topo;bundle-version="1.14.0", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Export-Package: com.raytheon.uf.edex.grid.staticdata, com.raytheon.uf.edex.grid.staticdata.topo diff --git a/edexOsgi/com.raytheon.uf.edex.grid.staticdata/src/com/raytheon/uf/edex/grid/staticdata/topo/StaticTopoData.java b/edexOsgi/com.raytheon.uf.edex.grid.staticdata/src/com/raytheon/uf/edex/grid/staticdata/topo/StaticTopoData.java index 2bd2865e8b..85902388fc 100644 --- a/edexOsgi/com.raytheon.uf.edex.grid.staticdata/src/com/raytheon/uf/edex/grid/staticdata/topo/StaticTopoData.java +++ b/edexOsgi/com.raytheon.uf.edex.grid.staticdata/src/com/raytheon/uf/edex/grid/staticdata/topo/StaticTopoData.java @@ -59,8 +59,8 @@ import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation; import com.raytheon.uf.common.geospatial.interpolation.GridReprojection; import com.raytheon.uf.common.geospatial.interpolation.GridSampler; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; import com.raytheon.uf.common.gridcoverage.GridCoverage; +import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper; import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; @@ -534,7 +534,7 @@ public class StaticTopoData { */ private float[] getTopoData(GridGeometry2D inGeom, CoordinateReferenceSystem inCrs, int coverageNx, int coverageNy) { - FloatArrayWrapper finalDataWrapper = null; + FloatBufferWrapper finalDataWrapper = null; BilinearInterpolation interp = new BilinearInterpolation(); interp.setMissingThreshold(0.0001f); @@ -546,7 +546,8 @@ public class StaticTopoData { GridSampler sampler = new GridSampler(source, interp); try { if (finalDataWrapper == null) { - finalDataWrapper = new FloatArrayWrapper(inGeom); + finalDataWrapper = new FloatBufferWrapper( + inGeom.getGridRange2D()); reprojection.reprojectedGrid(sampler, finalDataWrapper); } else { boolean done = true; diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/META-INF/MANIFEST.MF index 617fa46411..573b1af846 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/META-INF/MANIFEST.MF @@ -14,5 +14,6 @@ Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174", org.apache.commons.lang;bundle-version="2.3.0", com.raytheon.uf.edex.plugin.npp;bundle-version="1.0.0", com.raytheon.uf.common.status;bundle-version="1.12.1174", - com.raytheon.uf.common.localization;bundle-version="1.12.1174" + com.raytheon.uf.common.localization;bundle-version="1.12.1174", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Import-Package: org.apache.commons.logging diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/src/com/raytheon/uf/edex/plugin/npp/viirs/dao/VIIRSDao.java b/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/src/com/raytheon/uf/edex/plugin/npp/viirs/dao/VIIRSDao.java index 472e58baac..81cc42fd62 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/src/com/raytheon/uf/edex/plugin/npp/viirs/dao/VIIRSDao.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/src/com/raytheon/uf/edex/plugin/npp/viirs/dao/VIIRSDao.java @@ -39,13 +39,16 @@ import com.raytheon.uf.common.datastorage.StorageProperties; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation; import com.raytheon.uf.common.geospatial.interpolation.GridDownscaler; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; -import com.raytheon.uf.common.geospatial.interpolation.data.DataWrapper1D; +import com.raytheon.uf.common.numeric.buffer.BufferWrapper; +import com.raytheon.uf.common.numeric.buffer.ShortBufferWrapper; +import com.raytheon.uf.common.numeric.dest.DataDestination; +import com.raytheon.uf.common.numeric.filter.InverseFillValueFilter; +import com.raytheon.uf.common.numeric.filter.UnsignedFilter; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.edex.core.dataplugin.PluginRegistry; import com.raytheon.uf.edex.database.DataAccessLayerException; -import com.raytheon.uf.edex.database.plugin.DataRecordWrapUtil; import com.raytheon.uf.edex.database.plugin.DownscaleStoreUtil; import com.raytheon.uf.edex.database.plugin.DownscaleStoreUtil.IDataRecordCreator; import com.raytheon.uf.edex.database.plugin.PluginDao; @@ -59,11 +62,13 @@ import com.raytheon.uf.edex.plugin.npp.viirs.VIIRSMessageData; * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Dec 1, 2011 mschenke Initial creation - * Feb 21, 2012 #30 mschenke Updated code to account for missingValue - * in messageData being float now + * Date Ticket# Engineer Description + * ------------- -------- ----------- -------------------------- + * Dec 01, 2011 mschenke Initial creation + * Feb 21, 2012 30 mschenke Updated code to account for missingValue + * in messageData being float now + * Mar 07, 2014 2791 bsteffen Move Data Source/Destination to numeric + * plugin. * * * @@ -179,6 +184,12 @@ public class VIIRSDao extends PluginDao { idr.setCorrelationObject(record); return idr; } + + @Override + public boolean isSigned() { + return false; + } + }; IDataRecord fullSize = creator @@ -187,16 +198,21 @@ public class VIIRSDao extends PluginDao { // Data sources are create anonymously here to avoid having the // fillValue/validMin/validMax even checked when getting values but // still getting the getDataValueInternal functionality - DataWrapper1D ds = DataRecordWrapUtil.wrap(fullSize, nx, ny, true); + BufferWrapper ds = BufferWrapper.wrapArray(rawData, nx, ny); - ds.setFillValue(fillValue); + DataDestination dest = InverseFillValueFilter.apply( + (DataDestination) ds, fillValue); // Wrap the source and replace set each value which will replace // anything in missingValues with fillValue - DataSource source = new VIIRSDataSourceWrapper(ds, missingValues); + DataSource source = ds; + if (ds instanceof ShortBufferWrapper) { + source = UnsignedFilter.apply((ShortBufferWrapper) ds); + } + source = new VIIRSDataSourceWrapper(source, missingValues); for (int y = 0; y < ny; ++y) { for (int x = 0; x < nx; ++x) { - ds.setDataValue(source.getDataValue(x, y), x, y); + dest.setDataValue(source.getDataValue(x, y), x, y); } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/src/com/raytheon/uf/edex/plugin/npp/viirs/dao/VIIRSDataSourceWrapper.java b/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/src/com/raytheon/uf/edex/plugin/npp/viirs/dao/VIIRSDataSourceWrapper.java index 81588f3c25..e09e811ef1 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/src/com/raytheon/uf/edex/plugin/npp/viirs/dao/VIIRSDataSourceWrapper.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/src/com/raytheon/uf/edex/plugin/npp/viirs/dao/VIIRSDataSourceWrapper.java @@ -19,7 +19,7 @@ **/ package com.raytheon.uf.edex.plugin.npp.viirs.dao; -import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; +import com.raytheon.uf.common.numeric.source.DataSource; /** * Wraps a {@link DataSource} and checks for an array of missingValues and diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/src/com/raytheon/uf/edex/plugin/npp/viirs/scaling/VIIRSDataScaler.java b/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/src/com/raytheon/uf/edex/plugin/npp/viirs/scaling/VIIRSDataScaler.java deleted file mode 100644 index 947a06171c..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.npp.viirs/src/com/raytheon/uf/edex/plugin/npp/viirs/scaling/VIIRSDataScaler.java +++ /dev/null @@ -1,156 +0,0 @@ -/** - * 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.edex.plugin.npp.viirs.scaling; - -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; - -import org.geotools.coverage.grid.GeneralGridGeometry; -import org.geotools.coverage.grid.GridEnvelope2D; -import org.geotools.geometry.Envelope2D; -import org.geotools.referencing.crs.DefaultEngineeringCRS; - -import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation; -import com.raytheon.uf.common.geospatial.interpolation.GridReprojection; -import com.raytheon.uf.common.geospatial.interpolation.data.AbstractDataWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.UnsignedShortArrayWrapper; - -/** - * This class is responsible for scaling VIIRS data - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 7, 2011             mschenke     Initial creation
- * Feb 21, 2012 #30        mschenke     Changed missing value to float
- * 
- * 
- * 
- * - * @author mschenke - * @version 1.0 - */ - -public class VIIRSDataScaler { - - private static final int DESIRED_SIZE = 512 * 512; - - /** - * This method will return a list of recommended sizes to scale the data - * down to - * - * @param width - * @param height - * @return - */ - public static List getScaleSizes(int width, int height) { - List scaleSizes = new ArrayList(); - int size = 0; - do { - scaleSizes.add(new Rectangle(width, height)); - size = width * height; - width /= 2; - height /= 2; - } while (size > DESIRED_SIZE); - - return scaleSizes; - } - - /** - * Given a full dataset, this method will scale the data down to the desired - * size. Objects supported are 1D java primitive arrays (floats and unsigned - * shorts) - * - * @param fullData - * @param fullSize - * @param desiredSize - * @return - */ - public static Object scaleData(Object fullData, Rectangle fullSize, - Rectangle desiredSize, float missingValue) { - // Early return check - if (fullSize.equals(desiredSize)) { - return fullData; - } - - GeneralGridGeometry sourceGeom = new GeneralGridGeometry( - new GridEnvelope2D(fullSize.x, fullSize.y, fullSize.width, - fullSize.height), new Envelope2D( - DefaultEngineeringCRS.CARTESIAN_2D, fullSize)); - GeneralGridGeometry targetGeom = new GeneralGridGeometry( - new GridEnvelope2D(desiredSize.x, desiredSize.y, - desiredSize.width, desiredSize.height), new Envelope2D( - DefaultEngineeringCRS.CARTESIAN_2D, fullSize)); - - // Construct reprojection object - GridReprojection reprojection = new GridReprojection(sourceGeom, - targetGeom); - - AbstractDataWrapper source = null; - AbstractDataWrapper destination = null; - Object returnValue = null; - if (fullData instanceof short[]) { - source = new UnsignedShortArrayWrapper((short[]) fullData, - sourceGeom); - destination = new UnsignedShortArrayWrapper(targetGeom); - returnValue = ((UnsignedShortArrayWrapper) destination).getArray(); - } else if (fullData instanceof float[]) { - source = new FloatArrayWrapper((float[]) fullData, sourceGeom); - destination = new FloatArrayWrapper(targetGeom); - returnValue = ((FloatArrayWrapper) destination).getArray(); - } - - if (returnValue != null) { - source.setFillValue(missingValue); - destination.setFillValue(missingValue); - - // Create interpolation object - BilinearInterpolation interpolation = new BilinearInterpolation(); - interpolation.setMissingThreshold(0.0f); - - try { - reprojection - .reprojectedGrid(interpolation, source, destination); - return returnValue; - } catch (Exception e) { - // TODO: Log - } - } - return null; - } - - public static int getValidHeight(float[] data, float missing, int width, - int height) { - // Find first row with bad data - for (int h = 0; h < height; ++h) { - float value = data[h * width]; - if (value == missing) { - return h; - } - } - - return height; - } -} diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.mcidas/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.common.dataplugin.mcidas/META-INF/MANIFEST.MF index cbce56b84a..b98cf6da91 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.mcidas/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.mcidas/META-INF/MANIFEST.MF @@ -16,7 +16,8 @@ Require-Bundle: com.raytheon.edex.common;bundle-version="1.11.17", javax.persistence;bundle-version="1.0.0", com.raytheon.edex.uengine;bundle-version="1.11.17", org.apache.commons.codec;bundle-version="1.3.0", - edu.wisc.ssec.mcidas;bundle-version="1.0.0" + edu.wisc.ssec.mcidas;bundle-version="1.0.0", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Export-Package: gov.noaa.nws.ncep.common.dataplugin.mcidas, gov.noaa.nws.ncep.common.dataplugin.mcidas.dao, gov.noaa.nws.ncep.common.dataplugin.mcidas.fixed diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.mcidas/src/gov/noaa/nws/ncep/common/dataplugin/mcidas/dao/McidasDao.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.mcidas/src/gov/noaa/nws/ncep/common/dataplugin/mcidas/dao/McidasDao.java index 3940622ec0..a168aadb68 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.mcidas/src/gov/noaa/nws/ncep/common/dataplugin/mcidas/dao/McidasDao.java +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.mcidas/src/gov/noaa/nws/ncep/common/dataplugin/mcidas/dao/McidasDao.java @@ -10,6 +10,8 @@ * 10/2009 144 T. Lee Created * 11/2009 144 T. Lee Implemented area name DAO * Nov 14, 2013 2393 bclement added in-java interpolation + * Mar 07, 2014 2791 bsteffen Move Data Source/Destination to numeric + * plugin. * * * @author tlee @@ -39,8 +41,7 @@ import com.raytheon.uf.common.datastorage.records.AbstractStorageRecord; import com.raytheon.uf.common.datastorage.records.ByteDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.geospatial.interpolation.GridDownscaler; -import com.raytheon.uf.common.geospatial.interpolation.data.DataWrapper1D; -import com.raytheon.uf.edex.database.plugin.DataRecordWrapUtil; +import com.raytheon.uf.common.numeric.buffer.BufferWrapper; import com.raytheon.uf.edex.database.plugin.DownscaleStoreUtil; import com.raytheon.uf.edex.database.plugin.DownscaleStoreUtil.IDataRecordCreator; import com.raytheon.uf.edex.database.plugin.PluginDao; @@ -100,9 +101,8 @@ public class McidasDao extends PluginDao { // Store the base record. dataStore.addDataRecord(storageRecord); - DataWrapper1D dataSource = DataRecordWrapUtil.wrap(storageRecord, - xdim, - ydim, true); + BufferWrapper dataSource = BufferWrapper.wrapArray( + storageRecord.getDataObject(), xdim, ydim); // this way of interpolating does not create the Data-interpolated/0 // link to the full sized data. This shouldn't be an issue since the // retrieval code checks for level 0 and requests the full sized @@ -130,6 +130,12 @@ public class McidasDao extends PluginDao { public double getFillValue() { return Double.NaN; } + + @Override + public boolean isSigned() { + return false; + } + }); } return dataStore; diff --git a/ncep/gov.noaa.nws.ncep.viz.cloudHeight/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.viz.cloudHeight/META-INF/MANIFEST.MF index 3291c4e007..e2434c69f1 100644 --- a/ncep/gov.noaa.nws.ncep.viz.cloudHeight/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.viz.cloudHeight/META-INF/MANIFEST.MF @@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.ui, gov.noaa.nws.ncep.viz.localization;bundle-version="1.0.0", gov.noaa.nws.ncep.viz.rsc.satellite;bundle-version="1.0.0", gov.noaa.nws.ncep.edex.common;bundle-version="1.0.0", - com.raytheon.uf.common.colormap;bundle-version="1.12.1174" + com.raytheon.uf.common.colormap;bundle-version="1.12.1174", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: com.raytheon.uf.common.pypies, diff --git a/ncep/gov.noaa.nws.ncep.viz.cloudHeight/src/gov/noaa/nws/ncep/viz/cloudHeight/CloudHeightProcesser.java b/ncep/gov.noaa.nws.ncep.viz.cloudHeight/src/gov/noaa/nws/ncep/viz/cloudHeight/CloudHeightProcesser.java index c32e973e00..c13fc857c5 100644 --- a/ncep/gov.noaa.nws.ncep.viz.cloudHeight/src/gov/noaa/nws/ncep/viz/cloudHeight/CloudHeightProcesser.java +++ b/ncep/gov.noaa.nws.ncep.viz.cloudHeight/src/gov/noaa/nws/ncep/viz/cloudHeight/CloudHeightProcesser.java @@ -63,7 +63,9 @@ import com.raytheon.uf.common.datastorage.records.ByteDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.geospatial.ISpatialEnabled; import com.raytheon.uf.common.geospatial.MapUtil; -import com.raytheon.uf.common.geospatial.interpolation.data.UnsignedByteBufferWrapper; +import com.raytheon.uf.common.numeric.buffer.ByteBufferWrapper; +import com.raytheon.uf.common.numeric.filter.UnsignedFilter; +import com.raytheon.uf.common.numeric.source.DataSource; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.util.BufferUtil; import com.raytheon.uf.viz.core.HDF5Util; @@ -116,6 +118,7 @@ import com.vividsolutions.jts.geom.Coordinate; * 02/11/2013 972 G. Hull IDisplayPane instead of NCDisplayPane * 10/13/2013 T. Lee Fixed station data retrieval; Fixed moist adiabatic computation error; * Added climate cloud height + * 03/07/2014 2791 bsteffen Move Data Source/Destination to numeric plugin. * * @version 1 */ @@ -1104,8 +1107,9 @@ public class CloudHeightProcesser { * Wrap the raw data of bytes into a * ByteBufferWrapper object */ - UnsignedByteBufferWrapper bdf = new UnsignedByteBufferWrapper( - byteBuffer, maxX, maxY); + DataSource bdf = UnsignedFilter + .apply(new ByteBufferWrapper( + byteBuffer, maxX, maxY)); /* * Get the actual pixel value information * from the byte array diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/META-INF/MANIFEST.MF index 717a4c481a..09f4c9c673 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/META-INF/MANIFEST.MF @@ -31,7 +31,8 @@ Require-Bundle: org.eclipse.ui, gov.noaa.nws.ncep.common.log;bundle-version="1.0.0", gov.noaa.nws.ncep.viz.gempak;bundle-version="1.0.0", gov.noaa.nws.ncep.viz.gempak.nativelib;bundle-version="1.0.0", - com.raytheon.uf.common.style;bundle-version="1.0.0" + com.raytheon.uf.common.style;bundle-version="1.0.0", + com.raytheon.uf.common.numeric;bundle-version="1.14.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: gov.noaa.nws.ncep.viz.rsc.ncgrid,