public void writeRecord(PointFeature sobs, StructureData sdata) throws IOException { writeRecord(sobs.getObservationTime(), sobs.getObservationTimeAsCalendarDate(), sobs.getLocation(), sdata); }
public PointFeature deepCopy(PointFeature from) throws IOException { PointFeatureCopy deep = new PointFeatureCopy(from); deep.data = StructureDataDeep.copy(from.getFeatureData(), sm); return deep; }
PointFeatureCopy(PointFeature pf) { super(pf.getFeatureCollection(), pf.getLocation(), pf.getObservationTime(), pf.getNominalTime(), pf.getFeatureCollection().getTimeUnit()); }
StationPointFeatureCopy(StationFeature station, PointFeature pf) { super(station, pf.getObservationTime(), pf.getNominalTime(), du); this.station = station; }
PointFeatureCopy(PointFeature pf) { super(pf.getLocation(), pf.getObservationTime(), pf.getNominalTime(), du); }
StationPointFeatureCopy(StationFeature station, PointFeature pf) { super(pf.getFeatureCollection(), station, pf.getObservationTime(), pf.getNominalTime(), pf.getFeatureCollection().getTimeUnit()); this.station = station; }
private boolean filter(PointFeature pdata) { if ((filter_date != null) && !filter_date.includes(pdata.getObservationTimeAsCalendarDate())) return false; if ((filter_bb != null) && !filter_bb.contains(pdata.getLocation().getLatitude(), pdata.getLocation().getLongitude())) return false; return true; }
static private void checkPointFeature(PointFeature pobs, CalendarDateUnit timeUnit) throws java.io.IOException { Assert.assertNotNull("PointFeature location", pobs.getLocation()); Assert.assertNotNull("PointFeature time", pobs.getNominalTimeAsCalendarDate()); Assert.assertNotNull("PointFeature dataAll", pobs.getDataAll()); Assert.assertNotNull("PointFeature featureData", pobs.getFeatureData()); Assert.assertEquals("PointFeature makeCalendarDate", timeUnit.makeCalendarDate(pobs.getObservationTime()), pobs.getObservationTimeAsCalendarDate()); assert timeUnit.makeCalendarDate(pobs.getObservationTime()).equals(pobs.getObservationTimeAsCalendarDate()); checkData( pobs.getDataAll()); }
public void writeObsData(PointFeature pf) throws IOException { StructureDataScalar coords = new StructureDataScalar("Coords"); coords.addMember(altitudeCoordinateName, null, null, DataType.DOUBLE, false, pf.getLocation().getAltitude()); StructureDataComposite sdall = new StructureDataComposite(); sdall.add(coords); // coords first so it takes precedence sdall.add(pf.getFeatureData()); obsRecno = super.writeStructureData(obsRecno, record, sdall, dataMap); }
static public PointStreamProto.PointFeature encodePointFeature(PointFeature pf) throws IOException { PointStreamProto.Location.Builder locBuilder = PointStreamProto.Location.newBuilder(); locBuilder.setTime(pf.getObservationTime()); if (!Double.isNaN(pf.getNominalTime()) && (pf.getNominalTime() != pf.getObservationTime())) locBuilder.setNomTime(pf.getNominalTime()); EarthLocation loc = pf.getLocation(); locBuilder.setLat(loc.getLatitude()); locBuilder.setLon(loc.getLongitude()); builder.setLoc(locBuilder); StructureData sdata = pf.getData(); ArrayStructureBB abb = IospHelper.copyToArrayBB(sdata); ByteBuffer bb = abb.getByteBuffer();
public static boolean equals(PointFeature pointFeat1, PointFeature pointFeat2) throws IOException { if (pointFeat1 == pointFeat2) { return true; } else if (pointFeat1 == null || pointFeat2 == null) { return false; } if (!equals(pointFeat1.getLocation(), pointFeat2.getLocation())) { return false; } else if (!Misc.nearlyEquals(pointFeat1.getObservationTime(), pointFeat2.getObservationTime(), 1.0e-8)) { return false; } else if (!Misc.nearlyEquals(pointFeat1.getNominalTime(), pointFeat2.getNominalTime(), 1.0e-8)) { return false; } else if (!equals(pointFeat1.getFeatureData(), pointFeat2.getFeatureData())) { return false; } // getObservationTimeAsDate() and getObservationTimeAsCalendarDate() derive from getObservationTime(). // getNominalTimeAsDate() and getNominalTimeAsCalendarDate() derive from getNominalTime(). // getDataAll() may include data that doesn't "belong" to this feature, so ignore it. // getData() is deprecated. return true; }
public void writeObsData(PointFeature pf) throws IOException { EarthLocation loc = pf.getLocation(); trackBB(loc.getLatLon(), timeUnit.makeCalendarDate(pf.getObservationTime())); StructureDataScalar coords = new StructureDataScalar("Coords"); coords.addMember(timeName, null, null, DataType.DOUBLE, false, pf.getObservationTime()); coords.addMember(latName, null, null, DataType.DOUBLE, false, loc.getLatitude()); coords.addMember(lonName, null, null, DataType.DOUBLE, false, loc.getLongitude()); if (altUnits != null) coords.addMember(altName, null, null, DataType.DOUBLE, false, loc.getAltitude()); StructureDataComposite sdall = new StructureDataComposite(); sdall.add(coords); // coords first so it takes precedence sdall.add(pf.getFeatureData()); obsRecno = super.writeStructureData(obsRecno, record, sdall, dataMap); }
static public PointStreamProto.PointFeature encodePointFeature(PointFeature pf) throws IOException { PointStreamProto.Location.Builder locBuilder = PointStreamProto.Location.newBuilder(); locBuilder.setTime(pf.getObservationTime()); locBuilder.setNomTime(pf.getNominalTime()); EarthLocation loc = pf.getLocation(); locBuilder.setLat(loc.getLatitude()); locBuilder.setLon(loc.getLongitude()); builder.setLoc(locBuilder); StructureData sdata = pf.getDataAll(); ArrayStructureBB abb = StructureDataDeep.copyToArrayBB(sdata); ByteBuffer bb = abb.getByteBuffer();
protected void calcBounds(PointFeature pf) { count++; if (!calcBounds) return; if (pf == null) return; if (bb == null) bb = new LatLonRect(pf.getLocation().getLatLon(), .001, .001); else bb.extend(pf.getLocation().getLatLon()); double obsTime = pf.getObservationTime(); minTime = Math.min(minTime, obsTime); maxTime = Math.max(maxTime, obsTime); }
public int compareTo(PointFeature other) { if (obsTime < other.getObservationTime()) return -1; if (obsTime > other.getObservationTime()) return 1; return 0; }
public void writeRecord(Station s, PointFeature sobs, StructureData sdata) throws IOException { writeRecord(s.getName(), sobs.getObservationTime(), sobs.getObservationTimeAsCalendarDate(), sdata); }
while (pointFeatureCollection.hasNext()) { PointFeature pointFeature = (PointFeature) pointFeatureCollection.next(); StructureData data = pointFeature.getData(); if (count == 0) { EarthLocation loc = pointFeature.getLocation(); // LOOK we dont know this until we see the obs String altUnits = Double.isNaN(loc.getAltitude()) ? null : "meters"; // LOOK units may be wrong writer = new WriterCFPointDataset(out, pfDataset.getGlobalAttributes(), altUnits);
protected void calcBounds(PointFeature pf) { count++; if (!calcBounds) return; if (pf == null) return; if (bb == null) bb = new LatLonRect(pf.getLocation().getLatLon(), .001, .001); else bb.extend(pf.getLocation().getLatLon()); if (timeUnit == null) timeUnit = pf.getTimeUnit(); double obsTime = pf.getObservationTime(); minTime = Math.min(minTime, obsTime); maxTime = Math.max(maxTime, obsTime); }
StructureData data = pointFeature.getDataAll(); if (count == 0) { EarthLocation loc = pointFeature.getLocation(); // LOOK we dont know this until we see the obs String altUnits = Double.isNaN(loc.getAltitude()) ? null : "meters"; // LOOK units may be wrong writer = new WriterCFPointDataset(out, pfDataset.getGlobalAttributes(), altUnits);
static int countLocations(PointFeatureCollection pfc) throws IOException { int count = 0; Set<MyLocation> locs = new HashSet<>(80000); pfc.resetIteration(); while (pfc.hasNext()) { PointFeature pf = pfc.next(); MyLocation loc = new MyLocation(pf.getLocation()); if (!locs.contains(loc)) locs.add(loc); count++; //if (count % 1000 == 0) System.out.printf("Count %d%n", count); } System.out.printf("Count Points = %d Unique points = %d %n", count, locs.size()); return locs.size(); //The problem is that all the locations are coming up with the same value. This: //always returns the same lat/lon/alt (of the first observation). //(pos was populated going through the PointFeatureIterator). }