Issue #2791 Move DataSource/DataDestination to its own project, add DataFilter.

Former-commit-id: 9122b6da99 [formerly 9122b6da99 [formerly ba5ff870337c7ac66d633077d84de867e5df967c]]
Former-commit-id: 8650074737
Former-commit-id: d3043fda5a
This commit is contained in:
Ben Steffensmeier 2014-03-07 15:47:22 -06:00
parent 61af779433
commit a1ac082c94
127 changed files with 1930 additions and 2169 deletions

View file

@ -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

View file

@ -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;

View file

@ -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,

View file

@ -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

View file

@ -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.
*
* </pre>
*
@ -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 {
}
}
}

View file

@ -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;

View file

@ -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();
}

View file

@ -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<Double> mosaicComparator;
private final AbstractDataWrapper fullDest;
private final BufferWrapper fullDest;
private final GridEnvelope2D envelope;
public MosaicDataDestination(Comparator<Double> mosaicComparator,
AbstractDataWrapper fullDest, GridEnvelope2D envelope) {
BufferWrapper fullDest, GridEnvelope2D envelope) {
this.mosaicComparator = mosaicComparator;
this.fullDest = fullDest;
this.envelope = envelope;

View file

@ -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

View file

@ -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.
*
* </pre>
*
@ -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(),

View file

@ -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

View file

@ -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

View file

@ -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);
}
}

View file

@ -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

View file

@ -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;
*
* <pre>
* 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.
*
* </pre>
*
@ -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,

View file

@ -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

View file

@ -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;
*
* <pre>
* 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.
*
* </pre>
*
@ -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,

View file

@ -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,

View file

@ -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;

View file

@ -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;
}

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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<Coordinate> {
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);
}

View file

@ -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);

View file

@ -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;
/**

View file

@ -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

View file

@ -1,2 +0,0 @@
com.raytheon.viz.dataaccess.rsc.grid.GenericGridResourceData
com.raytheon.viz.dataaccess.rsc.geometry.GenericGeometryResourceData

View file

@ -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;
}
}

View file

@ -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.
*
* </pre>
*
@ -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();

View file

@ -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,

View file

@ -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

View file

@ -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;
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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<GridResourceData> 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);

View file

@ -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;

View file

@ -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;
}

View file

@ -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,

View file

@ -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,

View file

@ -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

View file

@ -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.
* </pre>
*
* @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,

View file

@ -104,6 +104,12 @@
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.common.numeric"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.common.geospatial"
download-size="0"

View file

@ -2,12 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Dataaccess
Bundle-SymbolicName: com.raytheon.uf.common.dataaccess
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.14.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: com.raytheon.uf.common.time;visibility:=reexport,
com.raytheon.uf.common.datastorage,
com.raytheon.uf.common.geospatial;visibility:=reexport,
com.raytheon.uf.common.geospatial;bundle-version="1.14.0";visibility:=reexport,
javax.measure;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.level;visibility:=reexport,
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
@ -15,7 +15,8 @@ Require-Bundle: com.raytheon.uf.common.time;visibility:=reexport,
com.raytheon.uf.common.localization;bundle-version="1.12.1174",
com.raytheon.uf.common.dataquery;bundle-version="1.0.0",
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.message;bundle-version="1.12.1174"
com.raytheon.uf.common.message;bundle-version="1.12.1174",
com.raytheon.uf.common.numeric;bundle-version="1.14.0"
Export-Package: com.raytheon.uf.common.dataaccess,
com.raytheon.uf.common.dataaccess.exception,
com.raytheon.uf.common.dataaccess.geom,

View file

@ -24,8 +24,8 @@ import javax.measure.unit.Unit;
import org.geotools.coverage.grid.GridGeometry2D;
import com.raytheon.uf.common.dataaccess.IData;
import com.raytheon.uf.common.geospatial.interpolation.data.DataDestination;
import com.raytheon.uf.common.geospatial.interpolation.data.UnitConvertingDataDestination;
import com.raytheon.uf.common.geospatial.data.UnitConvertingDataFilter;
import com.raytheon.uf.common.numeric.dest.DataDestination;
/**
* An IGridData represents data that is gridded, ie rectangular (when not
@ -33,7 +33,7 @@ import com.raytheon.uf.common.geospatial.interpolation.data.UnitConvertingDataDe
*
* To get the data values out of the IGridData, use
* populateData(DataDestination) with a DataDestination in the format you are
* looking for. You can also use a {@link UnitConvertingDataDestination} to
* looking for. You can also use a {@link UnitConvertingDataFilter} to
* obtain the data in a specific unit.
*
*
@ -78,7 +78,7 @@ public interface IGridData extends IData {
* Populates the DataDestination argument with the raw data converted to the
* type to match the DataDestination. The destination must not be null. If
* unit conversions are desired, use the
* {@link UnitConvertingDataDestination} to specify what unit conversion
* {@link UnitConvertingDataFilter} to specify what unit conversion
* should be applied to the data.
*
* @param destination

View file

@ -38,8 +38,8 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.geospatial.interpolation.data.DataSource;
import com.raytheon.uf.common.geospatial.util.SubGridGeometryCalculator;
import com.raytheon.uf.common.numeric.source.DataSource;
import com.vividsolutions.jts.geom.Envelope;
/**

View file

@ -28,8 +28,8 @@ import org.geotools.coverage.grid.GridGeometry2D;
import com.raytheon.uf.common.dataaccess.grid.IGridData;
import com.raytheon.uf.common.dataplugin.level.Level;
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;
import com.raytheon.uf.common.time.DataTime;
/**

View file

@ -23,9 +23,9 @@ import javax.measure.unit.Unit;
import javax.measure.unit.UnitFormat;
import com.raytheon.uf.common.dataaccess.grid.IGridData;
import com.raytheon.uf.common.geospatial.interpolation.data.DataDestination;
import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper;
import com.raytheon.uf.common.geospatial.interpolation.data.UnitConvertingDataDestination;
import com.raytheon.uf.common.geospatial.data.UnitConvertingDataFilter;
import com.raytheon.uf.common.numeric.buffer.FloatBufferWrapper;
import com.raytheon.uf.common.numeric.dest.DataDestination;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -71,8 +71,8 @@ public class GridResponseData extends AbstractResponseData {
parameter = data.getParameter();
Unit<?> 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

View file

@ -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.
*
* </pre>
*
@ -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;
}
}

View file

@ -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,

View file

@ -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.
*
* </pre>
*
@ -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<Grid2DFloat>(rotation);

View file

@ -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 "

View file

@ -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,

View file

@ -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;

View file

@ -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,

View file

@ -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;

View file

@ -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,

View file

@ -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

View file

@ -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,

View file

@ -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.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Mar 06, 2014 2791 bsteffen Initial creation
*
* </pre>
*
* @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<? extends Number> 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);
}
}
}

View file

@ -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.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Mar 07, 2014 2791 bsteffen Initial creation
*
* </pre>
*
* @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));
}
}

View file

@ -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.

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 20, 2012 bsteffen Initial creation
* Nov 19, 2013 2393 bclement added createNew method
*
* </pre>
*
* @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 extends AbstractDataWrapper> T createNew(
Class<? extends T> c, Rectangle size)
throws IllegalArgumentException {
try {
Constructor<? extends T> 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);
}
}
}

View file

@ -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.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 13, 2012 jkorman Initial creation
*
* </pre>
*
* @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;
}
}

View file

@ -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.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 20, 2012 bsteffen Initial creation
* Nov 19, 2013 2393 bclement added abstract method for primitive array
*
* </pre>
*
* @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();
}

View file

@ -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
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 20, 2012 bsteffen Initial creation
*
* </pre>
*
* @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;
}
}

View file

@ -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}
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 5, 2012 njensen Initial creation
*
* </pre>
*
* @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;
}
}

View file

@ -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}
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 3, 2012 mschenke Initial creation
*
* </pre>
*
* @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;
}
}

View file

@ -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;
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 12, 2012 njensen Initial creation
*
* </pre>
*
* @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;
}
}

View file

@ -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.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 3, 2012 mschenke Initial creation
*
* </pre>
*
* @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;
}
}

View file

@ -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
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 20, 2012 bsteffen Initial creation
* Nov 19, 2013 2393 bclement changed to extend ByteBufferWrapper
*
* </pre>
*
* @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;
}
}

View file

@ -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}
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 3, 2012 mschenke Initial creation
*
* </pre>
*
* @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;
}
}

View file

@ -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
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 20, 2012 bsteffen Initial creation
* Nov 19, 2013 2393 bclement changed to extend ShortBufferWrapper
*
* </pre>
*
* @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;
}
}

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.common.numeric</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -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

View file

@ -0,0 +1,4 @@
eclipse.preferences.version=1
pluginProject.equinox=false
pluginProject.extensions=false
resolve.requirebundle=false

View file

@ -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

View file

@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View file

@ -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}.
*
* <pre>
@ -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 extends DataDestination> 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;

View file

@ -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;
}
}

View file

@ -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.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Mar 07, 2014 2791 bsteffen Initial creation
*
* </pre>
*
* @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<? extends Number> 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<? extends Number> 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());
}
}
}

View file

@ -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.
*
* </pre>
*
* @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<Byte> getPrimitiveType() {
return byte.class;
}
}

View file

@ -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.
*
* </pre>
*
* @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<Double> getPrimitiveType() {
return double.class;
}
}

View file

@ -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.
*
* </pre>
*
* @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<Float> getPrimitiveType() {
return float.class;
}
}

View file

@ -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.
*
* </pre>
*
* @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<Integer> getPrimitiveType() {
return int.class;
}
}

View file

@ -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
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 07, 2014 2791 bsteffen Reimplemnt extending BufferWrapper.
*
* </pre>
*
* @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<Long> getPrimitiveType() {
return long.class;
}
}

View file

@ -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.
*
* </pre>
*
* @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<Short> getPrimitiveType() {
return short.class;
}
}

View file

@ -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.
*
* </pre>
*

View file

@ -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.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Mar 06, 2014 2791 bsteffen Initial creation
*
* </pre>
*
* @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);
}
}
}

View file

@ -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}.
*
* <pre>
*
@ -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
*
* </pre>
*
* @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);
}

Some files were not shown because too many files have changed in this diff Show more