Issue #2947 Minor satellite and derived parameter improvements.
Former-commit-id:428f3a2d8b
[formerlydd794a3c12
[formerly d5fe527ff45e02cbbba3a92f2031d500db879839]] Former-commit-id:dd794a3c12
Former-commit-id:2d66e58671
This commit is contained in:
parent
ce74b40f0b
commit
4004fe2d18
5 changed files with 136 additions and 92 deletions
|
@ -28,10 +28,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.raytheon.uf.common.inventory.data.AbstractRequestableData;
|
|
||||||
import com.raytheon.uf.common.inventory.exception.DataCubeException;
|
|
||||||
import com.raytheon.uf.common.inventory.TimeAndSpace;
|
|
||||||
import com.raytheon.uf.common.inventory.tree.AbstractRequestableNode;
|
|
||||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||||
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
|
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
|
||||||
import com.raytheon.uf.common.dataquery.requests.DbQueryRequestSet;
|
import com.raytheon.uf.common.dataquery.requests.DbQueryRequestSet;
|
||||||
|
@ -43,7 +39,12 @@ import com.raytheon.uf.common.datastorage.Request;
|
||||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||||
import com.raytheon.uf.common.derivparam.inv.AvailabilityContainer;
|
import com.raytheon.uf.common.derivparam.inv.AvailabilityContainer;
|
||||||
import com.raytheon.uf.common.derivparam.inv.MetadataContainer;
|
import com.raytheon.uf.common.derivparam.inv.MetadataContainer;
|
||||||
|
import com.raytheon.uf.common.inventory.TimeAndSpace;
|
||||||
|
import com.raytheon.uf.common.inventory.data.AbstractRequestableData;
|
||||||
|
import com.raytheon.uf.common.inventory.exception.DataCubeException;
|
||||||
|
import com.raytheon.uf.common.inventory.tree.AbstractRequestableNode;
|
||||||
import com.raytheon.uf.common.serialization.comm.RequestRouter;
|
import com.raytheon.uf.common.serialization.comm.RequestRouter;
|
||||||
|
import com.raytheon.uf.common.time.BinOffset;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,11 +56,13 @@ import com.raytheon.uf.common.time.DataTime;
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------- -------- ----------- --------------------------
|
||||||
* Jan 30, 2012 mschenke Initial creation
|
* Jan 30, 2012 mschenke Initial creation
|
||||||
* Feb 25, 2013 1659 bsteffen Stop derived parameters from sending
|
* Feb 25, 2013 1659 bsteffen Stop derived parameters from sending
|
||||||
* empty requests for cached times
|
* empty requests for cached times
|
||||||
* Jan 30, 2014 #2725 ekladstrup Remove usage of ThriftClient
|
* Jan 30, 2014 2725 ekladstrup Remove usage of ThriftClient
|
||||||
|
* Apr 11, 2014 2947 bsteffen Fix binoffset time queries and getRecord.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -169,6 +172,11 @@ public abstract class AbstractDataCubeAdapter extends DefaultDataCubeAdapter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (request.getBinOffset() != null) {
|
||||||
|
BinOffset bin = request.getBinOffset();
|
||||||
|
results = bin.getNormalizedTimes(results
|
||||||
|
.toArray(new DataTime[0]));
|
||||||
|
}
|
||||||
if (!request.isMaxQuery() || results.isEmpty()) {
|
if (!request.isMaxQuery() || results.isEmpty()) {
|
||||||
finalResponse.add(new ArrayList<DataTime>(results));
|
finalResponse.add(new ArrayList<DataTime>(results));
|
||||||
} else {
|
} else {
|
||||||
|
@ -255,7 +263,13 @@ public abstract class AbstractDataCubeAdapter extends DefaultDataCubeAdapter {
|
||||||
public IDataRecord[] getRecord(PluginDataObject obj, Request req,
|
public IDataRecord[] getRecord(PluginDataObject obj, Request req,
|
||||||
String dataset) throws DataCubeException {
|
String dataset) throws DataCubeException {
|
||||||
getRecords(Arrays.asList(obj), req, dataset);
|
getRecords(Arrays.asList(obj), req, dataset);
|
||||||
IDataRecord[] result = (IDataRecord[]) obj.getMessageData();
|
IDataRecord[] result = null;
|
||||||
|
Object message = obj.getMessageData();
|
||||||
|
if (message instanceof IDataRecord[]) {
|
||||||
|
result = (IDataRecord[]) message;
|
||||||
|
} else if (message instanceof IDataRecord) {
|
||||||
|
result = new IDataRecord[] { (IDataRecord) message };
|
||||||
|
}
|
||||||
obj.setMessageData(null);
|
obj.setMessageData(null);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,12 +66,15 @@ import com.vividsolutions.jts.geom.Polygon;
|
||||||
* <pre>
|
* <pre>
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------- -------- ----------- --------------------------
|
||||||
* Jul 24, 2007 353 bphillip Initial Checkin
|
* Jul 24, 2007 353 bphillip Initial Checkin
|
||||||
* Jul 12, 2012 798 jkorman Changed projection "magic" numbers
|
* Jul 12, 2012 798 jkorman Changed projection "magic" numbers
|
||||||
* Jul 16, 2013 2181 bsteffen Convert geometry types to use hibernate-
|
* Jul 16, 2013 2181 bsteffen Convert geometry types to use hibernate-
|
||||||
* spatial
|
* spatial
|
||||||
* Sep 30, 2013 2333 mschenke Refactored to store coordinates in CRS space
|
* Sep 30, 2013 2333 mschenke Refactored to store coordinates in CRS
|
||||||
|
* space
|
||||||
|
* Apr 11, 2014 2947 bsteffen Fix equals
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
|
@ -417,9 +420,15 @@ public class SatMapCoverage extends PersistableDataObject<Object> implements
|
||||||
if (Double.doubleToLongBits(minY) != Double
|
if (Double.doubleToLongBits(minY) != Double
|
||||||
.doubleToLongBits(other.minY))
|
.doubleToLongBits(other.minY))
|
||||||
return false;
|
return false;
|
||||||
if (nx != other.nx)
|
if (nx == null) {
|
||||||
|
if (other.nx != null)
|
||||||
return false;
|
return false;
|
||||||
if (ny != other.ny)
|
} else if (!nx.equals(other.nx))
|
||||||
|
return false;
|
||||||
|
if (ny == null) {
|
||||||
|
if (other.ny != null)
|
||||||
|
return false;
|
||||||
|
} else if (!ny.equals(other.ny))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import jep.JepException;
|
import jep.JepException;
|
||||||
|
|
||||||
import com.raytheon.uf.common.inventory.tree.CubeLevel;
|
|
||||||
import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
|
import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
|
||||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||||
|
@ -35,8 +34,9 @@ import com.raytheon.uf.common.datastorage.records.IntegerDataRecord;
|
||||||
import com.raytheon.uf.common.datastorage.records.LongDataRecord;
|
import com.raytheon.uf.common.datastorage.records.LongDataRecord;
|
||||||
import com.raytheon.uf.common.datastorage.records.ShortDataRecord;
|
import com.raytheon.uf.common.datastorage.records.ShortDataRecord;
|
||||||
import com.raytheon.uf.common.datastorage.records.StringDataRecord;
|
import com.raytheon.uf.common.datastorage.records.StringDataRecord;
|
||||||
import com.raytheon.uf.common.python.PythonInterpreter;
|
|
||||||
import com.raytheon.uf.common.derivparam.library.DerivedParameterRequest;
|
import com.raytheon.uf.common.derivparam.library.DerivedParameterRequest;
|
||||||
|
import com.raytheon.uf.common.inventory.tree.CubeLevel;
|
||||||
|
import com.raytheon.uf.common.python.PythonInterpreter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A script for running the master derived parameter script, which can run any
|
* A script for running the master derived parameter script, which can run any
|
||||||
|
@ -45,11 +45,13 @@ import com.raytheon.uf.common.derivparam.library.DerivedParameterRequest;
|
||||||
* <pre>
|
* <pre>
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------- -------- ----------- --------------------------
|
||||||
* Jul 8, 2008 njensen Initial creation
|
* Jul 08, 2008 njensen Initial creation
|
||||||
* Nov 20, 2009 #3387 jelkins Use derived script's variableId instead of filename
|
* Nov 20, 2009 3387 jelkins Use derived script's variableId instead of filename
|
||||||
* Nov 21, 2009 #3576 rjpeter Refactored to populate DerivParamDesc.
|
* Nov 21, 2009 3576 rjpeter Refactored to populate DerivParamDesc.
|
||||||
* Oct 29, 2013 2476 njensen Renamed numeric methods to numpy
|
* Oct 29, 2013 2476 njensen Renamed numeric methods to numpy
|
||||||
|
* Apr 11, 2014 2947 bsteffen Allow returning NaN
|
||||||
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author njensen
|
* @author njensen
|
||||||
|
@ -351,20 +353,9 @@ public class MasterDerivScript extends PythonInterpreter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void filterResult() throws JepException {
|
private void filterResult() throws JepException {
|
||||||
StringBuilder script = new StringBuilder();
|
|
||||||
jep.eval("import numpy");
|
|
||||||
// Float NaN filtering
|
|
||||||
script.append("if isinstance(" + RESULT + ", numpy.ndarray) and "
|
|
||||||
+ RESULT + ".dtype == numpy.float32:\n");
|
|
||||||
script.append(" " + RESULT + "[" + RESULT + " <= -9999] = -999999\n");
|
|
||||||
script.append(" " + RESULT + "[" + RESULT + " >= 999999] = -999999\n");
|
|
||||||
script.append(" " + RESULT + "[ numpy.isnan(" + RESULT
|
|
||||||
+ ") ] = -999999\n");
|
|
||||||
script.append(" " + RESULT + "[ numpy.isinf(" + RESULT
|
|
||||||
+ ") ] = -999999\n");
|
|
||||||
jep.eval(script.toString());
|
|
||||||
script = new StringBuilder();
|
|
||||||
// String conversion
|
// String conversion
|
||||||
|
jep.eval("import numpy");
|
||||||
|
StringBuilder script = new StringBuilder();
|
||||||
script.append("if isinstance(" + RESULT + ", numpy.ndarray) and "
|
script.append("if isinstance(" + RESULT + ", numpy.ndarray) and "
|
||||||
+ RESULT + ".dtype.kind == \"S\":\n");
|
+ RESULT + ".dtype.kind == \"S\":\n");
|
||||||
script.append(" " + RESULT + "=" + RESULT + ".flatten().tolist()\n");
|
script.append(" " + RESULT + "=" + RESULT + ".flatten().tolist()\n");
|
||||||
|
|
|
@ -32,13 +32,6 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.raytheon.uf.common.inventory.data.AbstractRequestableData;
|
|
||||||
import com.raytheon.uf.common.inventory.data.AliasRequestableData;
|
|
||||||
import com.raytheon.uf.common.inventory.exception.DataCubeException;
|
|
||||||
import com.raytheon.uf.common.inventory.TimeAndSpace;
|
|
||||||
import com.raytheon.uf.common.inventory.TimeAndSpaceMatcher;
|
|
||||||
import com.raytheon.uf.common.inventory.TimeAndSpaceMatcher.MatchResult;
|
|
||||||
import com.raytheon.uf.common.inventory.tree.AbstractRequestableNode;
|
|
||||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||||
import com.raytheon.uf.common.derivparam.data.DerivedRequestableData;
|
import com.raytheon.uf.common.derivparam.data.DerivedRequestableData;
|
||||||
import com.raytheon.uf.common.derivparam.inv.AvailabilityContainer;
|
import com.raytheon.uf.common.derivparam.inv.AvailabilityContainer;
|
||||||
|
@ -47,6 +40,13 @@ import com.raytheon.uf.common.derivparam.library.DerivParamField;
|
||||||
import com.raytheon.uf.common.derivparam.library.DerivParamMethod;
|
import com.raytheon.uf.common.derivparam.library.DerivParamMethod;
|
||||||
import com.raytheon.uf.common.derivparam.library.DerivedParameterRequest;
|
import com.raytheon.uf.common.derivparam.library.DerivedParameterRequest;
|
||||||
import com.raytheon.uf.common.derivparam.library.IDerivParamField;
|
import com.raytheon.uf.common.derivparam.library.IDerivParamField;
|
||||||
|
import com.raytheon.uf.common.inventory.TimeAndSpace;
|
||||||
|
import com.raytheon.uf.common.inventory.TimeAndSpaceMatcher;
|
||||||
|
import com.raytheon.uf.common.inventory.TimeAndSpaceMatcher.MatchResult;
|
||||||
|
import com.raytheon.uf.common.inventory.data.AbstractRequestableData;
|
||||||
|
import com.raytheon.uf.common.inventory.data.AliasRequestableData;
|
||||||
|
import com.raytheon.uf.common.inventory.exception.DataCubeException;
|
||||||
|
import com.raytheon.uf.common.inventory.tree.AbstractRequestableNode;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,8 +58,9 @@ import com.raytheon.uf.common.time.DataTime;
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------- -------- ----------- --------------------------
|
||||||
* Dec 14, 2009 rjpeter Initial creation
|
* Dec 14, 2009 rjpeter Initial creation
|
||||||
|
* Apr 11, 2014 2947 bsteffen Don't check units until data is requested.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -400,15 +401,11 @@ public class DerivedLevelNode extends AbstractDerivedDataNode {
|
||||||
Set<AbstractRequestableData> newRecs = new HashSet<AbstractRequestableData>(
|
Set<AbstractRequestableData> newRecs = new HashSet<AbstractRequestableData>(
|
||||||
records.size());
|
records.size());
|
||||||
for (AbstractRequestableData record : records) {
|
for (AbstractRequestableData record : records) {
|
||||||
if (record.getUnit() != null
|
/* Wrap in an alias to perform unit conversion when necessary. */
|
||||||
&& !record.getUnit().equals(field.getUnit())
|
|
||||||
&& record.getUnit().isCompatible(field.getUnit())) {
|
|
||||||
AbstractRequestableData alias = new AliasRequestableData(record);
|
AbstractRequestableData alias = new AliasRequestableData(record);
|
||||||
alias.setUnit(field.getUnit());
|
alias.setUnit(field.getUnit());
|
||||||
newRecs.add(alias);
|
newRecs.add(alias);
|
||||||
} else {
|
|
||||||
newRecs.add(record);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return newRecs;
|
return newRecs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,12 @@ import javax.measure.converter.UnitConverter;
|
||||||
import javax.measure.unit.NonSI;
|
import javax.measure.unit.NonSI;
|
||||||
import javax.measure.unit.Unit;
|
import javax.measure.unit.Unit;
|
||||||
|
|
||||||
import com.raytheon.uf.common.inventory.exception.DataCubeException;
|
import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
|
||||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
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.inventory.exception.DataCubeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a simple alias, where a parameter represents the same data as
|
* Represents a simple alias, where a parameter represents the same data as
|
||||||
|
@ -42,6 +45,8 @@ import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||||
* ------------- -------- ----------- --------------------------
|
* ------------- -------- ----------- --------------------------
|
||||||
* Jan 15, 2010 3965 rjpeter Initial creation
|
* Jan 15, 2010 3965 rjpeter Initial creation
|
||||||
* Jan 14, 2014 2661 bsteffen Make vectors u,v only
|
* Jan 14, 2014 2661 bsteffen Make vectors u,v only
|
||||||
|
* Apr 11, 2014 2947 bsteffen Perform unit conversion on more types of
|
||||||
|
* records.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -59,6 +64,7 @@ public class AliasRequestableData extends AbstractRequestableData {
|
||||||
this.space = sourceRecord.space;
|
this.space = sourceRecord.space;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getDataValue(Object arg) throws DataCubeException {
|
public Object getDataValue(Object arg) throws DataCubeException {
|
||||||
return getDataAndConvert(sourceRecord, arg);
|
return getDataAndConvert(sourceRecord, arg);
|
||||||
}
|
}
|
||||||
|
@ -102,41 +108,14 @@ public class AliasRequestableData extends AbstractRequestableData {
|
||||||
if ((Float) rval > -9999) {
|
if ((Float) rval > -9999) {
|
||||||
rval = converter.convert((Float) rval);
|
rval = converter.convert((Float) rval);
|
||||||
}
|
}
|
||||||
} else if (rval instanceof FloatDataRecord) {
|
} else if (rval instanceof IDataRecord) {
|
||||||
float[] data = ((FloatDataRecord) rval).getFloatData();
|
rval = convertDataRecord(converter, (IDataRecord) rval);
|
||||||
for (int c = 0; c < data.length; c++) {
|
|
||||||
if (data[c] > -9999) {
|
|
||||||
|
|
||||||
data[c] = (float) converter.convert(data[c]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (rval instanceof FloatDataRecord[]) {
|
|
||||||
FloatDataRecord[] recs = (FloatDataRecord[]) rval;
|
|
||||||
if (recs.length != 1 || !unit.equals(NonSI.DEGREE_ANGLE)) {
|
|
||||||
for (int i = 0; i < recs.length; i++) {
|
|
||||||
float[] data = recs[i].getFloatData();
|
|
||||||
for (int c = 0; c < data.length; c++) {
|
|
||||||
if (data[c] > -9999) {
|
|
||||||
data[c] = (float) converter
|
|
||||||
.convert(data[c]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (rval instanceof IDataRecord[]) {
|
} else if (rval instanceof IDataRecord[]) {
|
||||||
IDataRecord[] recs = (IDataRecord[]) rval;
|
IDataRecord[] recs = (IDataRecord[]) rval;
|
||||||
if (recs.length != 1 || !unit.equals(NonSI.DEGREE_ANGLE)) {
|
if (recs.length != 1 || !unit.equals(NonSI.DEGREE_ANGLE)) {
|
||||||
|
rval = recs = Arrays.copyOf(recs, recs.length);
|
||||||
for (int i = 0; i < recs.length; i++) {
|
for (int i = 0; i < recs.length; i++) {
|
||||||
if (recs[i] instanceof FloatDataRecord) {
|
recs[i] = convertDataRecord(converter, recs[i]);
|
||||||
float[] data = ((FloatDataRecord) recs[i])
|
|
||||||
.getFloatData();
|
|
||||||
for (int c = 0; c < data.length; c++) {
|
|
||||||
if (data[c] > -9999) {
|
|
||||||
data[c] = (float) converter
|
|
||||||
.convert(data[c]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,6 +124,60 @@ public class AliasRequestableData extends AbstractRequestableData {
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static IDataRecord convertDataRecord(UnitConverter converter,
|
||||||
|
IDataRecord record) {
|
||||||
|
float[] newData = null;
|
||||||
|
double fillValue = Double.NaN;
|
||||||
|
if (record.getFillValue() != null) {
|
||||||
|
fillValue = record.getFillValue().doubleValue();
|
||||||
|
}
|
||||||
|
if (record instanceof FloatDataRecord) {
|
||||||
|
float[] data = ((FloatDataRecord) record).getFloatData();
|
||||||
|
newData = new float[data.length];
|
||||||
|
for (int c = 0; c < data.length; c++) {
|
||||||
|
if (data[c] == fillValue) {
|
||||||
|
newData[c] = Float.NaN;
|
||||||
|
} else {
|
||||||
|
newData[c] = (float) converter.convert(data[c]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (record instanceof ByteDataRecord) {
|
||||||
|
byte[] data = ((ByteDataRecord) record).getByteData();
|
||||||
|
newData = new float[data.length];
|
||||||
|
for (int c = 0; c < data.length; c++) {
|
||||||
|
if (data[c] == fillValue) {
|
||||||
|
newData[c] = Float.NaN;
|
||||||
|
} else {
|
||||||
|
newData[c] = (float) converter.convert(data[c]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (record instanceof ShortDataRecord) {
|
||||||
|
short[] data = ((ShortDataRecord) record).getShortData();
|
||||||
|
newData = new float[data.length];
|
||||||
|
for (int c = 0; c < data.length; c++) {
|
||||||
|
if (data[c] == fillValue) {
|
||||||
|
newData[c] = Float.NaN;
|
||||||
|
} else {
|
||||||
|
newData[c] = (float) converter.convert(data[c]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (record instanceof IntegerDataRecord) {
|
||||||
|
int[] data = ((IntegerDataRecord) record).getIntData();
|
||||||
|
newData = new float[data.length];
|
||||||
|
for (int c = 0; c < data.length; c++) {
|
||||||
|
if (data[c] == fillValue) {
|
||||||
|
newData[c] = Float.NaN;
|
||||||
|
} else {
|
||||||
|
newData[c] = (float) converter.convert(data[c]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
return new FloatDataRecord(record.getName(), record.getGroup(),
|
||||||
|
newData, record.getDimension(), record.getSizes());
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue