Merge "Issue #1962 Allow Viirs Decoder to accept numeric missing values." into omaha_13.4.1

Former-commit-id: 0cd2fe1b01 [formerly 6d0e867afd] [formerly b5c86153d3] [formerly 85bb98e13e [formerly b5c86153d3 [formerly 80a023582f55b076cfbb27e260ed357c35d68ad7]]]
Former-commit-id: 85bb98e13e
Former-commit-id: 3b0cb62239e00e07c4e408b70806ff0e510d2e09 [formerly e851193480]
Former-commit-id: 9e0167500e
This commit is contained in:
Nate Jensen 2013-05-01 17:10:03 -05:00 committed by Gerrit Code Review
commit 1112ec62fe

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