@Override public StructureData getFeatureData() throws IOException { return stnFeature.getFeatureData(); }
@Override public StationTimeSeriesFeatureCollection subset(List<StationFeature> stnsWanted, CalendarDateRange dateRange) throws IOException { if (dateRange == null) return subset(stnsWanted); List<StationFeature> subsetStations = new ArrayList<>(); for (StationFeature sf : stnsWanted) { StationTimeSeriesFeature stsf = (StationTimeSeriesFeature) sf; // LOOK StationTimeSeriesFeature subset = stsf.subset(dateRange); subsetStations.add(subset); } return new StationSubset(this, subsetStations); }
private PointFeatureIterator getNextIterator() throws IOException { if (!iter.hasNext()) return null; TimedCollection.Dataset td = iter.next(); Formatter errlog = new Formatter(); currentDataset = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(FeatureType.STATION, td.getLocation(), null, errlog); List<FeatureCollection> fcList = currentDataset.getPointFeatureCollectionList(); StationTimeSeriesFeatureCollection stnCollection = (StationTimeSeriesFeatureCollection) fcList.get(0); Station s = stnCollection.getStation(getName()); if (s == null) { System.out.printf("CompositeStationFeatureIterator dataset: %s missing station %s%n", td.getLocation(), getName()); return getNextIterator(); } StationTimeSeriesFeature stnFeature = stnCollection.getStationFeature(s); if (CompositeDatasetFactory.debug) System.out.printf("CompositeStationFeatureIterator open dataset: %s for %s%n", td.getLocation(), s.getName()); return stnFeature.getPointFeatureIterator(bufferSize); }
static int countLocations(StationTimeSeriesFeatureCollection sfc) throws IOException { System.out.printf(" Station List Size = %d %n", sfc.getStationFeatures().size()); // check uniqueness Map<String, StationTimeSeriesFeature> stns = new HashMap<>(5000); Map<MyLocation, StationTimeSeriesFeature> locs = new HashMap<>(5000); int dups = 0; for (StationTimeSeriesFeature sf : sfc) { StationTimeSeriesFeature other = stns.get(sf.getName()); if (other != null && dups < 10) { System.out.printf(" duplicate name = %s %n", sf); System.out.printf(" of = %s %n", other); dups++; } else stns.put(sf.getName(), sf); MyLocation loc = new MyLocation(sf); StationTimeSeriesFeature already = locs.get(loc); if (already != null) { System.out.printf(" duplicate location %s(%s) of %s(%s) %n", sf.getName(), sf.getDescription(), already.getName(), already.getDescription()); } else locs.put(loc, sf); } System.out.printf(" duplicate names = %d %n", dups); System.out.printf(" unique locs = %d %n", locs.size()); System.out.printf(" unique stns = %d %n", stns.size()); return stns.size(); }
private PointFeatureIterator getNextIterator() throws IOException { if (!iter.hasNext()) return null; TimedCollection.Dataset td = iter.next(); Formatter errlog = new Formatter(); currentDataset = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(FeatureType.STATION, td.getLocation(), null, errlog); if (currentDataset == null) throw new IllegalStateException("Cant open FeatureDatasetPoint " + td.getLocation()); List<DsgFeatureCollection> fcList = currentDataset.getPointFeatureCollectionList(); StationTimeSeriesFeatureCollection stnCollection = (StationTimeSeriesFeatureCollection) fcList.get(0); StationFeature s = stnCollection.findStationFeature(getName()); if (s == null) { System.out.printf("CompositeStationFeatureIterator dataset: %s missing station %s%n", td.getLocation(), getName()); return getNextIterator(); } StationTimeSeriesFeature stnFeature = stnCollection.getStationTimeSeriesFeature(s); if (CompositeDatasetFactory.debug) System.out.printf("CompositeStationFeatureIterator open dataset: %s for %s%n", td.getLocation(), s.getName()); return stnFeature.getPointFeatureIterator(); }
@Nonnull @Override public StructureData getFeatureData() throws IOException { return stnFeature.getFeatureData(); }
private PointFeatureIterator getNextIterator() throws IOException { if (!iter.hasNext()) return null; TimedCollection.Dataset td = iter.next(); Formatter errlog = new Formatter(); currentDataset = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(FeatureType.STATION, td.getLocation(), null, errlog); List<FeatureCollection> fcList = currentDataset.getPointFeatureCollectionList(); StationTimeSeriesFeatureCollection stnCollection = (StationTimeSeriesFeatureCollection) fcList.get(0); Station s = stnCollection.getStation(getName()); if (s == null) { System.out.printf("CompositeStationFeatureIterator dataset: %s missing station %s%n", td.getLocation(), getName()); return getNextIterator(); } StationTimeSeriesFeature stnFeature = stnCollection.getStationFeature(s); if (CompositeDatasetFactory.debug) System.out.printf("CompositeStationFeatureIterator open dataset: %s for %s%n", td.getLocation(), s.getName()); return stnFeature.getPointFeatureIterator(bufferSize); }
@Override protected StationHelper createStationHelper() throws IOException { TimedCollection.Dataset td = dataCollection.getPrototype(); if (td == null) throw new RuntimeException("No datasets in the collection"); Formatter errlog = new Formatter(); try (FeatureDatasetPoint openDataset = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open( FeatureType.STATION, td.getLocation(), null, errlog)) { StationHelper stationHelper = new StationHelper(); List<FeatureCollection> fcList = openDataset.getPointFeatureCollectionList(); StationTimeSeriesCollectionImpl openCollection = (StationTimeSeriesCollectionImpl) fcList.get(0); List<Station> stns = openCollection.getStations(); for (Station s : stns) { StationTimeSeriesFeature stnFeature = openCollection.getStationFeature(s); stationHelper.addStation(new CompositeStationFeature(s, timeUnit, altUnits, stnFeature.getFeatureData(), this.dataCollection)); } dataVariables = openDataset.getDataVariables(); globalAttributes = openDataset.getGlobalAttributes(); return stationHelper; } }
assert pfc instanceof StationTimeSeriesFeatureImpl : pfc.getClass().getName(); StationTimeSeriesFeature s = (StationTimeSeriesFeature) pfc; StructureData sdata = s.getFeatureData(); StructureMembers.Member m = sdata.findMember("stnInfo"); assert m != null : "missing stnInfo";