StandardTrajectoryCollectionSubset(TrajectoryFeatureCollection from, LatLonRect boundingBox) { super(from.getName()+"-subset", from.getTimeUnit(), from.getAltUnits()); this.from = from; this.boundingBox = boundingBox; }
StandardTrajectoryCollectionSubset(TrajectoryFeatureCollection from, LatLonRect boundingBox) { super(from.getName()+"-subset", from.getTimeUnit(), from.getAltUnits()); this.from = from; this.boundingBox = boundingBox; }
private static int writeTrajectoryFeatureCollection(FeatureDatasetPoint fdpoint, TrajectoryFeatureCollection fc, String fileOut, CFPointWriterConfig config) throws IOException { try (WriterCFTrajectoryCollection cfWriter = new WriterCFTrajectoryCollection(fileOut, fdpoint.getGlobalAttributes(), fdpoint.getDataVariables(), fc.getTimeUnit(), fc.getAltUnits(), config)) { cfWriter.setExtraVariables( fc.getExtraVariables()); // LOOK not always needed int count = 0; int name_strlen = 0; int ntrajs = fc.size(); if (ntrajs < 0) { for (TrajectoryFeature traj : fc) { name_strlen = Math.max(name_strlen, traj.getName().length()); count++; } ntrajs = count; } cfWriter.setFeatureAuxInfo(ntrajs, name_strlen); count = 0; for (TrajectoryFeature traj : fc) { count += cfWriter.writeTrajectory(traj); if (debug && count % 10 == 0) System.out.printf("%d ", count); if (debug && count % 100 == 0) System.out.printf("%n "); } cfWriter.finish(); return count; } }
private static int writeTrajectoryFeatureCollection(FeatureDatasetPoint fdpoint, TrajectoryFeatureCollection pds, String fileOut, CFPointWriterConfig config) throws IOException { WriterCFTrajectoryCollection cfWriter = new WriterCFTrajectoryCollection(fileOut, fdpoint.getGlobalAttributes(), fdpoint.getDataVariables(), pds.getExtraVariables(), pds.getTimeUnit(), pds.getAltUnits(), config); // LOOK not always needed int count = 0; int name_strlen = 0; int ntrajs = pds.size(); if (ntrajs < 0) { pds.resetIteration(); while (pds.hasNext()) { TrajectoryFeature feature = pds.next(); name_strlen = Math.max(name_strlen, feature.getName().length()); count++; } ntrajs = count; } cfWriter.setFeatureAuxInfo(ntrajs, name_strlen); count = 0; pds.resetIteration(); while (pds.hasNext()) { TrajectoryFeature feature = pds.next(); count += cfWriter.writeTrajectory(feature); if (debug && count % 10 == 0) System.out.printf("%d ", count); if (debug && count % 100 == 0) System.out.printf("%n "); } cfWriter.finish(); return count; }