made Bravo parser more lenient, ignoring extra columns

Change-Id: Ieec433b4bd32fa7d283ac0045c37a4dd39aeafa6
This commit is contained in:
Axel Uhl
2017-03-11 17:52:57 +01:00
parent a40f4a2baa
commit e2fe0019a0
3 changed files with 9 additions and 6 deletions
@@ -1,7 +1,7 @@
#------------------------------------------------------------
#-- File created 09/04/2016 at 23:26:40
#------------------------------------------------------------
jjlDATE jjlTIME Epoch RideHeight RideHeightPortHull RideHeightStbdHull Heel Trim ImuSensor_GyroX ImuSensor_GyroY ImuSensor_GyroZ ImuSensor_Pitch ImuSensor_Roll ImuSensor_Yaw ImuSensor_LinearAccX ImuSensor_LinearAccY ImuSensor_LinearAccZ Hb_Z Dn_Z Db_Z LKF_ride_hgh LKF_ride_hgh_Position LKF_ride_hgh_Velocity LKF_ride_hgh_Acceleration LKF_ride_hgh_PositionError LKF_ride_hgh_VelocityError LKF_ride_hgh_AccelerationError Gps_Gga_PosFixTime Gps_Gga_Lat Gps_Gga_Lon Gps_Gga_QI Gps_Gga_HDOP Gps_Gga_AntHeight Gps_Vtg_TMG Gps_Vtg_SOGKnots Gps_Rmc_MagVar Gps_EastVelocity Gps_NorthVelocity Gps_UpVelocity BravoNet_Node0x0A0_Ch0 BravoNet_Node0x0A0_Voltage BravoNet_Node0x0A0_Temperature BravoNet_Node0x0A0_Current
jjlDATE jjlTIME Epoch RideHeight RideHeightPortHull RideHeightStbdHull Heel Trim ImuSensor_GyroX ImuSensor_GyroY ImuSensor_GyroZ ImuSensor_Pitch ImuSensor_Roll ImuSensor_Yaw ImuSensor_LinearAccX ImuSensor_LinearAccY ImuSensor_LinearAccZ Hb_Z Dn_Z Db_Z LKF_ride_hgh LKF_ride_hgh_Position LKF_ride_hgh_Velocity LKF_ride_hgh_Acceleration LKF_ride_hgh_PositionError LKF_ride_hgh_VelocityError LKF_ride_hgh_AccelerationError Gps_Gga_PosFixTime Gps_Gga_Lat Gps_Gga_Lon Gps_Gga_QI Gps_Gga_HDOP Gps_Gga_AntHeight Gps_Vtg_TMG Gps_Vtg_SOGKnots Gps_Rmc_MagVar Gps_EastVelocity Gps_NorthVelocity Gps_UpVelocity BravoNet_Node0x0A0_Ch0 BravoNet_Node0x0A0_Voltage BravoNet_Node0x0A0_Temperature BravoNet_Node0x0A0_Current
20160409.000000 232640.908740 1460244399905.000000 0.757862 0.650044 0.865680 2.095203 -10.572519 0.014012 0.080612 0.075319 -10.572519 -2.095203 358.804353 -0.021935 0.017397 0.000239 -0.673131 -0.757548 -0.743131 0.013623 -0.757862 -0.004228 -0.018140 0.074238 0.272712 0.037974 212640.800000 5232.276310 1325.488310 1.000000 1.100000 80.800000 306.100000 0.370000 3.200000 -0.170000 0.130000 -0.000000 0.733032 24.043011 36.640236 0.054741
20160409.000000 232641.008763 1460244399995.000000 0.758014 0.650158 0.865870 2.095937 -10.571562 0.032092 0.217810 -0.023014 -10.571683 -2.096830 358.798479 -0.028412 0.021632 -0.027246 -0.673131 -0.757548 -0.743131 0.019586 -0.758014 -0.005095 -0.018096 0.069231 0.211765 0.035063 212640.800000 5232.276310 1325.488310 1.000000 1.100000 80.800000 306.100000 0.370000 3.200000 -0.150000 0.110000 -0.000000 0.733032 24.000978 35.988564 0.054741
20160409.000000 232641.105742 1460244400089.000000 0.758203 0.650319 0.866087 2.096466 -10.570188 0.073738 0.193435 0.107095 -10.570447 -2.097253 358.792882 -0.042638 0.045676 -0.010817 -0.673131 -0.757547 -0.743131 0.019374 -0.758203 -0.006152 -0.018839 0.064587 0.170564 0.032760 212641.000000 5232.276260 1325.488390 1.000000 1.100000 80.800000 306.100000 0.300000 3.200000 -0.150000 0.110000 -0.000000 0.733032 24.043011 35.988564 0.054741
@@ -64,7 +64,6 @@ public class BravoDataImportTest {
}
private void testImport(ImportData importData) throws FormatNotSupportedException, IOException {
bravoDataImporter.importFixes(importData.getInputStream(), (fixes, device) -> {
for (DoubleVectorFix fix : fixes) {
callbackCallCount++;
@@ -6,8 +6,10 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level;
@@ -142,10 +144,12 @@ public class BravoDataImporterImpl implements DoubleVectorFixImporter {
String header = headerTokens[j];
colIndicesInFile.put(header, j);
}
List<String> columnsInFix = metadata.getFileColumns();
if (colIndicesInFile.size() != columnsInFix.size() || !colIndicesInFile.keySet().containsAll(columnsInFix)) {
LOG.log(Level.SEVERE, "Missing headers");
throw new RuntimeException("Missing headers in import files");
List<String> requiredColumnsInFix = metadata.getTrackColumns();
if (!colIndicesInFile.keySet().containsAll(requiredColumnsInFix)) {
final Set<String> missingColumns = new HashSet<>(requiredColumnsInFix);
missingColumns.removeAll(colIndicesInFile.keySet());
LOG.log(Level.SEVERE, "Missing headers: "+missingColumns);
throw new RuntimeException("Missing headers "+missingColumns+" in import files");
}
return colIndicesInFile;
}