private void writeHeader(ProfileFeature profile, PointFeature obs) throws IOException { Formatter coordNames = new Formatter().format("%s %s %s", profileTimeName, latName, lonName); List<VariableSimpleIF> coords = new ArrayList<>(); if (useAlt) { coords.add( VariableSimpleImpl.makeScalar(altitudeCoordinateName, "obs altitude", altUnits, DataType.DOUBLE) .add(new Attribute(CF.STANDARD_NAME, "altitude")) .add(new Attribute(CF.POSITIVE, CF1Convention.getZisPositive(altitudeCoordinateName, altUnits)))); coordNames.format(" %s", altitudeCoordinateName); } super.writeHeader(coords, profile.getFeatureData(), obs.getFeatureData(), coordNames.toString()); }
private void writeHeader(ProfileFeature profile, PointFeature obs) throws IOException { Formatter coordNames = new Formatter().format("%s %s %s", profileTimeName, latName, lonName); List<VariableSimpleIF> coords = new ArrayList<>(); if (useAlt) { coords.add( VariableSimpleImpl.makeScalar(altitudeCoordinateName, "obs altitude", altUnits, DataType.DOUBLE) .add(new Attribute(CF.STANDARD_NAME, "altitude")) .add(new Attribute(CF.POSITIVE, CF1Convention.getZisPositive(altitudeCoordinateName, altUnits)))); coordNames.format(" %s", altitudeCoordinateName); } super.writeHeader(coords, profile.getFeatureData(), obs.getFeatureData(), coordNames.toString()); }
private void writeHeader(SectionFeature section, ProfileFeature profile, PointFeature obs) throws IOException { StructureData sectionData = section.getFeatureData(); StructureData profileData = profile.getFeatureData(); StructureData obsData = obs.getFeatureData(); Formatter coordNames = new Formatter().format("%s %s %s", profileTimeName, latName, lonName); List<VariableSimpleIF> obsCoords = new ArrayList<>(); if (useAlt) { obsCoords.add( VariableSimpleImpl.makeScalar(altitudeCoordinateName, "obs altitude", altUnits, DataType.DOUBLE) .add(new Attribute(CF.STANDARD_NAME, "altitude")) .add(new Attribute(CF.POSITIVE, CF1Convention.getZisPositive(altitudeCoordinateName, altUnits)))); coordNames.format(" %s", altitudeCoordinateName); } super.writeHeader2(obsCoords, sectionData, profileData, obsData, coordNames.toString()); }
private void writeHeader(TrajectoryProfileFeature section, ProfileFeature profile, PointFeature obs) throws IOException { StructureData sectionData = section.getFeatureData(); StructureData profileData = profile.getFeatureData(); StructureData obsData = obs.getFeatureData(); Formatter coordNames = new Formatter().format("%s %s %s", profileTimeName, latName, lonName); List<VariableSimpleIF> obsCoords = new ArrayList<>(); if (useAlt) { obsCoords.add( VariableSimpleImpl.makeScalar(altitudeCoordinateName, "obs altitude", altUnits, DataType.DOUBLE) .add(new Attribute(CF.STANDARD_NAME, "altitude")) .add(new Attribute(CF.POSITIVE, CF1Convention.getZisPositive(altitudeCoordinateName, altUnits)))); coordNames.format(" %s", altitudeCoordinateName); } super.writeHeader2(obsCoords, sectionData, profileData, obsData, coordNames.toString()); }
private void writeHeader(StationProfileFeature stn, ProfileFeature profile, PointFeature obs) throws IOException { StructureData profileData = profile.getFeatureData(); StructureData obsData = obs.getFeatureData();
private void writeHeader(StationProfileFeature stn, ProfileFeature profile, PointFeature obs) throws IOException { StructureData profileData = profile.getFeatureData(); StructureData obsData = obs.getFeatureData();
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; }
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; }
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; }
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); }
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); }
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); }