use of au.gov.amsa.geo.model.SegmentOptions in project risky by amsa-code.
the class EffectiveSpeedCheckFailures2Main method main.
public static void main(String[] args) throws ParseException {
SegmentOptions options = SegmentOptions.builder().acceptAnyFixHours(12L).maxSpeedKnots(50).build();
tasmania().groupBy(fix -> fix.mmsi()).flatMap(g -> g.lift(new OperatorEffectiveSpeedChecker(options)).buffer(2, 1).filter(list -> list.size() == 2 && list.get(0).isOk() && !list.get(1).isOk()).doOnNext(list -> {
System.out.println(" ok," + list.get(0));
System.out.println("bad," + list.get(1));
})).count().toBlocking().single();
}
use of au.gov.amsa.geo.model.SegmentOptions in project risky by amsa-code.
the class OperatorEffectiveSpeedCheckerTest method testSpiritOfTasmania.
@Test
public void testSpiritOfTasmania() throws ParseException {
SegmentOptions options = SegmentOptions.builder().acceptAnyFixHours(12L).maxSpeedKnots(50).build();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
df.setTimeZone(TimeZone.getTimeZone("UTC"));
Fix a = new FixImpl(1, -39.572643f, 145.38763f, df.parse("2015-01-01T03:36:36").getTime(), AisClass.A);
Fix b = new FixImpl(1, -40.095074f, 145.71864f, df.parse("2015-01-01T04:52:25").getTime(), AisClass.A);
System.out.println(Position.create(a.lat(), a.lon()).getDistanceToKm(Position.create(b.lat(), b.lon())) / 1.852 / (75.81666666 / 60) + "knots");
assertEquals(27.605441702145423, EffectiveSpeedChecker.effectiveSpeedKnots(a, b, options).get(), 0.00001);
}
Aggregations