Issue #1962 Allow Viirs Decoder to accept numeric missing values.

Former-commit-id: 0286f91956 [formerly db039f5af5 [formerly f46cda54fd5cea0f0daa5cd7c7152c07ea3bc4e3]]
Former-commit-id: db039f5af5
Former-commit-id: 065b26988c
This commit is contained in:
Ben Steffensmeier 2013-05-01 15:14:09 -05:00
parent 1c9529ab22
commit 28012d41f7

View file

@ -62,6 +62,8 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* Dec 1, 2011 mschenke Initial creation
* Feb 21, 2012 #30 mschenke Changed VIIRS decoder to read time attribute out of record
* instead of using WMO header
* May 01, 2013 1962 bsteffen Allow Viirs Decoder to accept numeric
* missing values.
*
* </pre>
*
@ -236,12 +238,27 @@ public class VIIRSDecoder extends AbstractNPPDecoder {
for (Attribute attr : var.getAttributes()) {
if (MISSING_VALUE_ID.equals(attr.getName())) {
String missing = attr.getStringValue();
String[] split = missing
.split(MISSING_VALUE_SPLIT_STRING);
missingValues = new float[split.length];
for (int i = 0; i < split.length; ++i) {
missingValues[i] = Float.parseFloat(split[i]);
if (attr.getDataType().isString()) {
String missing = attr.getStringValue();
String[] split = missing
.split(MISSING_VALUE_SPLIT_STRING);
missingValues = new float[split.length];
for (int i = 0; i < split.length; ++i) {
missingValues[i] = Float
.parseFloat(split[i]);
}
} else if(attr.getDataType().isNumeric()){
if(attr.isArray()){
missingValues = new float[attr.getLength()];
for (int i = 0; i < missingValues.length; i += 1) {
missingValues[i] = attr
.getNumericValue(i)
.floatValue();
}
}else{
missingValues = new float[] { attr
.getNumericValue().floatValue() };
}
}
break;
}