use of org.n52.sos.netcdf.data.subsensor.ProfileSubSensor in project SOS by 52North.
the class AbstractNetcdfEncoder method populateHeightDepthArray.
private Double populateHeightDepthArray(AbstractSensorDataset sensorDataset, Array heightDephtArray, Variable v) throws EncodingException {
Index index = heightDephtArray.getIndex();
int indexCounter = 0;
Double consistentBinHeight = null;
for (SubSensor subSensor : sensorDataset.getSubSensors()) {
if (subSensor instanceof ProfileSubSensor) {
index.setDim(0, indexCounter++);
heightDephtArray.setDouble(index, checkValue(v, ((ProfileSubSensor) subSensor).getHeight()));
// check for consistent bin size
if (subSensor instanceof BinProfileSubSensor) {
double binHeight = checkValue(v, ((BinProfileSubSensor) subSensor).getBinHeight());
if (consistentBinHeight == null) {
consistentBinHeight = binHeight;
} else if (consistentBinHeight != getNetcdfHelper().getFillValue() && consistentBinHeight != binHeight) {
// mark bin height as inconsistent
consistentBinHeight = getNetcdfHelper().getFillValue();
}
}
} else {
throw new EncodingException("Non-profile subsensors not supported.");
}
}
return consistentBinHeight;
}
Aggregations