@Override public List<CalendarDate> getTimes() throws IOException { List<CalendarDate> result = new ArrayList<>(); for (ProfileFeature pf : this) { result.add(pf.getTime()); } return result; }
@Override public ProfileFeature getProfileByDate(CalendarDate date) throws IOException { for (ProfileFeature pf : this) { if (pf.getTime().equals(date)) return pf; } return null; }
@Override public boolean filter(PointFeatureCollection pointFeatureCollection) { ProfileFeature profileFeature = (ProfileFeature) pointFeatureCollection; return dateRange.includes(profileFeature.getTime()); } }
@Override public List<Date> getTimes() throws IOException { List<Date> result = new ArrayList<Date>(); resetIteration(); while (hasNext()) { ProfileFeature pf = next(); result.add(pf.getTime()); } return result; }
@Override public List<Date> getTimes() throws IOException { List<Date> result = new ArrayList<>(); resetIteration(); while (hasNext()) { ProfileFeature pf = next(); result.add(pf.getTime()); } return result; }
@Override public ProfileFeature getProfileByDate(Date date) throws IOException { resetIteration(); while (hasNext()) { ProfileFeature pf = next(); if (pf.getTime().equals(date)) return pf; } return null; }
@Override public ProfileFeature getProfileByDate(Date date) throws IOException { resetIteration(); while (hasNext()) { ProfileFeature pf = next(); if (pf.getTime().equals(date)) return pf; } return null; }
public void writeProfileData(ProfileFeature profile, int nobs) throws IOException { trackBB(profile.getLatLon(), profile.getTime()); StructureDataScalar profileCoords = new StructureDataScalar("Coords"); profileCoords.addMember(latName, null, null, DataType.DOUBLE, profile.getLatLon().getLatitude()); profileCoords.addMember(lonName, null, null, DataType.DOUBLE, profile.getLatLon().getLongitude()); if (profile.getTime() != null) // LOOK time not always part of profile profileCoords.addMember(profileTimeName, null, null, DataType.DOUBLE, timeUnit.makeOffsetFromRefDate(profile.getTime())); profileCoords.addMemberString(profileIdName, null, null, profile.getName().trim(), id_strlen); profileCoords.addMember(numberOfObsName, null, null, DataType.INT, nobs); StructureData profileData = profile.getFeatureData(); StructureDataComposite sdall = new StructureDataComposite(); sdall.add(profileCoords); // coords first so it takes precedence sdall.add(profileData); profileRecno = super.writeStructureData(profileRecno, profileStruct, sdall, featureVarMap); }
public void writeProfileData(ProfileFeature profile, int nobs) throws IOException { trackBB(profile.getLatLon(), CalendarDate.of(profile.getTime())); StructureDataScalar profileCoords = new StructureDataScalar("Coords"); profileCoords.addMember(latName, null, null, DataType.DOUBLE, false, profile.getLatLon().getLatitude()); profileCoords.addMember(lonName, null, null, DataType.DOUBLE, false, profile.getLatLon().getLongitude()); if (profile.getTime() != null) profileCoords.addMember(profileTimeName, null, null, DataType.DOUBLE, false, timeUnit.makeValue(profile.getTime())); // LOOK time not always part of profile profileCoords.addMemberString(profileIdName, null, null, profile.getName().trim(), id_strlen); profileCoords.addMember(numberOfObsName, null, null, DataType.INT, false, nobs); StructureData profileData = profile.getFeatureData(); StructureDataComposite sdall = new StructureDataComposite(); sdall.add(profileCoords); // coords first so it takes precedence sdall.add(profileData); profileRecno = super.writeStructureData(profileRecno, profileStruct, sdall, featureVarMap); }
for (TrajectoryProfileFeature spf : fc) { for (ProfileFeature profile : spf) { if (profile.getTime() == null) continue; // assume this means its a "incomplete multidimensional"
for (StationProfileFeature spf : fc) { for (ProfileFeature pf : spf) { if (pf.getTime() == null) continue; // assume this means its an "incomplete multidimensional"
public void writeProfileData(int sectionIndex, ProfileFeature profile, int nobs) throws IOException { trackBB(profile.getLatLon(), profile.getTime()); StructureDataScalar profileCoords = new StructureDataScalar("Coords"); profileCoords.addMember(latName, null, null, DataType.DOUBLE, profile.getLatLon().getLatitude()); profileCoords.addMember(lonName, null, null, DataType.DOUBLE, profile.getLatLon().getLongitude()); // double time = (profile.getTime() != null) ? (double) profile.getTime().getTime() : 0.0; double timeInMyUnits = timeUnit.makeOffsetFromRefDate(profile.getTime()); profileCoords.addMember(profileTimeName, null, null, DataType.DOUBLE, timeInMyUnits); // LOOK time not always part of profile profileCoords.addMemberString(profileIdName, null, null, profile.getName().trim(), id_strlen); profileCoords.addMember(numberOfObsName, null, null, DataType.INT, nobs); profileCoords.addMember(trajectoryIndexName, null, null, DataType.INT, sectionIndex); StructureDataComposite sdall = new StructureDataComposite(); sdall.add(profileCoords); // coords first so it takes precedence sdall.add(profile.getFeatureData()); profileRecno = super.writeStructureData(profileRecno, profileStruct, sdall, profileVarMap); }
public void writeProfileData(int stnIndex, ProfileFeature profile, int nobs) throws IOException { trackBB(profile.getLatLon(), profile.getTime()); StructureDataScalar profileCoords = new StructureDataScalar("Coords"); profileCoords.addMember(latName, null, null, DataType.DOUBLE, profile.getLatLon().getLatitude()); profileCoords.addMember(lonName, null, null, DataType.DOUBLE, profile.getLatLon().getLongitude()); //Date date = (profile.getTime() != null) ? (double) profile.getTime().getTime() : 0.0; // LOOK (profile.getTime() != null) ??? double timeInMyUnits = timeUnit.makeOffsetFromRefDate(profile.getTime()); profileCoords.addMember(profileTimeName, null, null, DataType.DOUBLE, timeInMyUnits); // LOOK time not always part of profile profileCoords.addMemberString(profileIdName, null, null, profile.getName().trim(), id_strlen); profileCoords.addMember(numberOfObsName, null, null, DataType.INT, nobs); profileCoords.addMember(stationIndexName, null, null, DataType.INT, stnIndex); StructureDataComposite sdall = new StructureDataComposite(); sdall.add(profileCoords); // coords first so it takes precedence sdall.add(profile.getFeatureData()); profileRecno = super.writeStructureData(profileRecno, profileStruct, sdall, profileVarMap); }
public void writeProfileData(int stnIndex, ProfileFeature profile, int nobs) throws IOException { trackBB(profile.getLatLon(), CalendarDate.of(profile.getTime())); StructureDataScalar profileCoords = new StructureDataScalar("Coords"); profileCoords.addMember(latName, null, null, DataType.DOUBLE, false, profile.getLatLon().getLatitude()); profileCoords.addMember(lonName, null, null, DataType.DOUBLE, false, profile.getLatLon().getLongitude()); //Date date = (profile.getTime() != null) ? (double) profile.getTime().getTime() : 0.0; // LOOK (profile.getTime() != null) ??? double timeInMyUnits = timeUnit.makeValue(profile.getTime()); profileCoords.addMember(profileTimeName, null, null, DataType.DOUBLE, false, timeInMyUnits); // LOOK time not always part of profile profileCoords.addMemberString(profileIdName, null, null, profile.getName().trim(), id_strlen); profileCoords.addMember(numberOfObsName, null, null, DataType.INT, false, nobs); profileCoords.addMember(stationIndexName, null, null, DataType.INT, false, stnIndex); StructureDataComposite sdall = new StructureDataComposite(); sdall.add(profileCoords); // coords first so it takes precedence sdall.add(profile.getFeatureData()); profileRecno = super.writeStructureData(profileRecno, profileStruct, sdall, profileVarMap); }
static int checkProfileFeatureCollection(ProfileFeatureCollection profileFeatureCollection, boolean show) throws IOException { long start = System.currentTimeMillis(); int count = 0; Set<String> profileNames = new HashSet<>(); for (ProfileFeature profile : profileFeatureCollection) { checkDsgFeatureCollection(profile); Assert.assertNotNull("ProfileFeature time", profile.getTime()); Assert.assertNotNull("ProfileFeature latlon", profile.getLatLon()); Assert.assertNotNull("ProfileFeature featureData", profile.getFeatureData()); Assert.assertTrue(!profileNames.contains(profile.getName())); profileNames.add(profile.getName()); // assert pf.getTime() != null; count += checkPointFeatureCollection(profile, show); } long took = System.currentTimeMillis() - start; if (show) System.out.println(" testStationProfileFeatureCollection complete count= " + count + " full iter took= " + took + " msec"); return count; }
public void writeProfileData(int sectionIndex, ProfileFeature profile, int nobs) throws IOException { trackBB(profile.getLatLon(), CalendarDate.of(profile.getTime())); StructureDataScalar profileCoords = new StructureDataScalar("Coords"); profileCoords.addMember(latName, null, null, DataType.DOUBLE, false, profile.getLatLon().getLatitude()); profileCoords.addMember(lonName, null, null, DataType.DOUBLE, false, profile.getLatLon().getLongitude()); // double time = (profile.getTime() != null) ? (double) profile.getTime().getTime() : 0.0; double timeInMyUnits = timeUnit.makeValue(profile.getTime()); profileCoords.addMember(profileTimeName, null, null, DataType.DOUBLE, false, timeInMyUnits); // LOOK time not always part of profile profileCoords.addMemberString(profileIdName, null, null, profile.getName().trim(), id_strlen); profileCoords.addMember(numberOfObsName, null, null, DataType.INT, false, nobs); profileCoords.addMember(trajectoryIndexName, null, null, DataType.INT, false, sectionIndex); StructureDataComposite sdall = new StructureDataComposite(); sdall.add(profileCoords); // coords first so it takes precedence sdall.add(profile.getFeatureData()); profileRecno = super.writeStructureData(profileRecno, profileStruct, sdall, profileVarMap); }
static int checkSectionFeatureCollection(TrajectoryProfileFeatureCollection sectionFeatureCollection, boolean show) throws IOException { long start = System.currentTimeMillis(); int count = 0; for (TrajectoryProfileFeature section : sectionFeatureCollection) { checkDsgFeatureCollection(section); Assert.assertNotNull("SectionFeature featureData", section.getFeatureData()); Set<String> profileNames = new HashSet<>(); for (ProfileFeature profile : section) { checkDsgFeatureCollection(profile); Assert.assertNotNull("ProfileFeature time", profile.getTime()); Assert.assertNotNull("ProfileFeature latlon", profile.getLatLon()); Assert.assertNotNull("ProfileFeature featureData", profile.getFeatureData()); Assert.assertTrue(!profileNames.contains(profile.getName())); profileNames.add(profile.getName()); if (show) System.out.printf(" ProfileFeature=%s %n", profile.getName()); count += checkPointFeatureCollection(profile, show); } } long took = System.currentTimeMillis() - start; if (show) System.out.println(" testStationProfileFeatureCollection complete count= " + count + " full iter took= " + took + " msec"); return count; }
while (spf.hasNext()) { ProfileFeature pf = spf.next(); if (pf.getTime() == null) continue; // assume this means its a "incomplete multidimensional"
static int checkStationProfileFeatureCollection(StationProfileFeatureCollection stationProfileFeatureCollection, boolean show) throws IOException { long start = System.currentTimeMillis(); int count = 0; for (StationProfileFeature spf : stationProfileFeatureCollection) { checkDsgFeatureCollection(spf); Assert.assertNotNull("StationProfileFeature latlon", spf.getLatLon()); Assert.assertNotNull("StationProfileFeature featureData", spf.getFeatureData()); // iterates through the profile but not the profile data List<CalendarDate> times = spf.getTimes(); if (showAll) { System.out.printf(" times= "); for (CalendarDate t : times) System.out.printf("%s, ", t); System.out.printf("%n"); } Set<String> profileNames = new HashSet<>(); for (ProfileFeature profile : spf) { checkDsgFeatureCollection(profile); Assert.assertNotNull("ProfileFeature time", profile.getTime()); Assert.assertNotNull("ProfileFeature latlon", profile.getLatLon()); Assert.assertNotNull("ProfileFeature featureData", profile.getFeatureData()); Assert.assertTrue(!profileNames.contains(profile.getName())); profileNames.add(profile.getName()); if (show) System.out.printf(" ProfileFeature=%s %n", profile.getName()); count += checkPointFeatureCollection(profile, show); } } long took = System.currentTimeMillis() - start; if (show) System.out.println(" testStationProfileFeatureCollection complete count= " + count + " full iter took= " + took + " msec"); return count; }