Skip to content

Commit a36284c

Browse files
committed
fixed bug reported by Bob
1 parent de76c28 commit a36284c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/ucar/unidata/data/point/PointObFactory.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,11 +1171,18 @@ public static FieldImpl makePointObsFromField(FieldImpl input,
11711171
double temp1 = 0.0;
11721172
double dew = 0.0;
11731173
double speed = 0.0;
1174-
if(rhType != null) {
1175-
temp = ((Real) ob.getComponent(tempIndex)).getValue(DataUtil.parseUnit("Celsius"));
1176-
temp1 = ((Real) ob.getComponent(tempIndex)).getValue(DataUtil.parseUnit("Fahrenheit"));
1177-
dew = ((Real) ob.getComponent(dewIndex)).getValue(DataUtil.parseUnit("Celsius"));
1178-
speed = ((Real) ob.getComponent(speedIndex)).getValue(Speed.MILES_PER_HOUR);
1174+
1175+
if (rhType != null) {
1176+
if (tempIndex >= 0) {
1177+
temp = ((Real) ob.getComponent(tempIndex)).getValue(DataUtil.parseUnit("Celsius"));
1178+
temp1 = ((Real) ob.getComponent(tempIndex)).getValue(DataUtil.parseUnit("Fahrenheit"));
1179+
}
1180+
if (dewIndex >= 0) {
1181+
dew = ((Real) ob.getComponent(dewIndex)).getValue(DataUtil.parseUnit("Celsius"));
1182+
}
1183+
if (speedIndex >= 0) {
1184+
speed = ((Real) ob.getComponent(speedIndex)).getValue(Speed.MILES_PER_HOUR);
1185+
}
11791186
}
11801187
// now make data
11811188
if (allReals && tupleType != null) {

0 commit comments

Comments
 (0)