if (pods == null) {
throw new Exception("can't open file");
}
List<FeatureCollection> collectionList = pods.getPointFeatureCollectionList();
FeatureCollection fc = collectionList.get(0);
LatLonRect llr = new LatLonRect(new LatLonPointImpl(33.4, -92.2), new LatLonPointImpl(47.9, -75.89));
System.out.println("llr = " + llr);
Date now = new Date();
Date ago = new Date(now.getTime() - 3600000);
DateRange dr = new DateRange(ago, now);
PointFeatureCollection collection = null;
if (fc instanceof PointFeatureCollection) {
collection = (PointFeatureCollection) fc;
if (llr != null) {
collection = collection.subset(llr, dr);
}
} else if (fc instanceof NestedPointFeatureCollection) {
NestedPointFeatureCollection npfc = (NestedPointFeatureCollection) fc;
collection = npfc.flatten(llr, dr);
} else {
throw new IllegalArgumentException("Can't handle collection of type " + fc.getClass().getName());
}
PointFeatureIterator dataIterator = collection.getPointFeatureIterator(-1);
int numObs = 0;
while (dataIterator.hasNext()) {
PointFeature po = (PointFeature) dataIterator.next();
numObs++;
ucar.unidata.geoloc.EarthLocation el = po.getLocation();
StructureData structure = po.getData();
assert llr.contains(el.getLatLon()) : el.getLatLon();
assert dr.included(po.getNominalTimeAsDate());
if (numObs % 1000 == 0)
System.out.printf("%d el = %s %n", numObs, el);
}
dataIterator.finish();