@Override public String toString() { return "CollectionInfo{" + "bbox=" + bbox + ", dateRange=" + getCalendarDateRange(null) + ", nfeatures=" + nfeatures + ", nobs=" + nobs + ", complete=" + complete + '}'; } }
@Nullable @Override public CalendarDateRange getCalendarDateRange() { return (info == null) ? null : info.getCalendarDateRange(timeUnit); }
@Override public void calcBounds(java.util.Formatter sf) { for (DsgFeatureCollection pfc : collectionList) { try { CollectionInfo info = new DsgCollectionHelper(pfc).calcBounds(); sf.format(" bb = %s %n", info.bbox == null ? "" :info.bbox.toString2()); sf.format(" dates = %s %n", info.getCalendarDateRange(pfc.getTimeUnit())); } catch (IOException e) { e.printStackTrace(); } } }
@Override public PointFeatureIterator getPointFeatureIterator() throws IOException { String query = PointDatasetRemote.makeQuery("stn=" + s.getName(), null, getInfo().getCalendarDateRange(this.getTimeUnit())); InputStream in = null; try { in = CdmRemote.sendQuery(null, uri, query); PointStream.MessageType mtype = PointStream.readMagic(in); if (mtype == PointStream.MessageType.End) { // no obs were found in.close(); return new PointIteratorEmpty(); // return empty iterator } if (mtype != PointStream.MessageType.PointFeatureCollection) { throw new RuntimeException("Station Request: bad response = " + mtype); } int len = NcStream.readVInt(in); byte[] b = new byte[len]; NcStream.readFully(in, b); PointStreamProto.PointFeatureCollection pfc = PointStreamProto.PointFeatureCollection.parseFrom(b); riter = new PointIteratorStream(StationFeatureStream.this, in, new PointStream.ProtobufPointFeatureMaker(pfc)); return riter; } catch (Throwable t) { if (in != null) in.close(); throw new IOException(t.getMessage(), t); } } }