public StationTimeSeriesCollectionFlattened(StationTimeSeriesCollectionImpl from, CalendarDateRange dateRange) { super( from.getName(), from.getTimeUnit(), from.getAltUnits()); this.dateRange = dateRange; this.from = from; }
@Override public void resetIteration() throws IOException { localIterator = getPointFeatureCollectionIterator(-1); } }
public StationTimeSeriesFeatureCollection subset(ucar.unidata.geoloc.LatLonRect boundingBox) throws IOException { return subset( getStations(boundingBox)); }
@Override public StationTimeSeriesFeatureCollection subset(LatLonRect boundingBox, CalendarDateRange dateRange) throws IOException { return subset(getStationFeatures(boundingBox), dateRange); }
@Override public List<Station> getStations() { return getStationHelper().getStations(); }
protected StationHelper getStationHelper() { if (stationHelper == null) { synchronized (this) { if (stationHelper == null) { try { stationHelper = createStationHelper(); } catch (IOException e) { // The methods that will call getStationHelper() aren't declared to throw IOException, so we must // wrap it in an unchecked exception. throw new RuntimeException(e); } } } } assert stationHelper != null : "stationHelper is null for StationTimeSeriesCollectionImpl"+getName(); return stationHelper; }
@Override public boolean hasNext() throws IOException { if (localIterator == null) resetIteration(); return localIterator.hasNext(); }
public StationTimeSeriesCollectionFlattened(StationTimeSeriesCollectionImpl from, CalendarDateRange dateRange) { super( from.getName()); this.dateRange = dateRange; this.from = from; }
public StationIterator() { stationIter = getStationHelper().getStationFeatures().iterator(); CollectionInfo info = getInfo(); if (!info.isComplete()) calcInfo = info; }
@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); }
@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; } }
public PointFeatureCollection flatten(List<String> stations, DateRange dateRange, List<VariableSimpleIF> varList) throws IOException { return flatten(stations, CalendarDateRange.of(dateRange), varList); }
protected StationHelper getStationHelper() { if (stationHelper == null) { synchronized (this) { if (stationHelper == null) { try { stationHelper = createStationHelper(); } catch (IOException e) { // The methods that will call getStationHelper() aren't declared to throw IOException, so we must // wrap it in an unchecked exception. throw new RuntimeException(e); } } } } assert stationHelper != null : "We screwed this up."; return stationHelper; }
@Override protected void initStationHelper() { TimedCollection.Dataset td = dataCollection.getPrototype(); if (td == null) throw new RuntimeException("No datasets in the collection"); Formatter errlog = new Formatter(); FeatureDatasetPoint openDataset = null; try { openDataset = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(FeatureType.STATION, td.getLocation(), null, errlog); List<FeatureCollection> fcList = openDataset.getPointFeatureCollectionList(); StationTimeSeriesCollectionImpl openCollection = (StationTimeSeriesCollectionImpl) fcList.get(0); List<Station> stns = openCollection.getStations(); stationHelper = new StationHelper(); for (Station s : stns) stationHelper.addStation(new CompositeStationFeature(s, null, this.dataCollection)); dataVariables = openDataset.getDataVariables(); } catch (Exception ioe) { throw new RuntimeException(td.getLocation(), ioe); } finally { try { if (openDataset != null) openDataset.close(); } catch (Throwable t) { } } }
@Override public List<StationFeature> getStationFeatures() throws IOException { return getStationHelper().getStationFeatures(); }
@Override public StationTimeSeriesFeatureCollection subset(ucar.unidata.geoloc.LatLonRect boundingBox) throws IOException { return subset( getStationFeatures(boundingBox)); }
@Override public boolean hasNext() throws IOException { if (localIterator == null) resetIteration(); return localIterator.hasNext(); }
StationTimeSeriesCollectionSubset(StationTimeSeriesCollectionImpl from, List<Station> stations) { super(from.getName()); this.from = from; this.stationHelper = new StationHelper(); this.stationHelper.setStations(stations); }
public PointFeatureCollection flatten(List<String> stations, DateRange dateRange, List<VariableSimpleIF> varList) throws IOException { return flatten(stations, CalendarDateRange.of(dateRange), varList); }
StationSubset(StationTimeSeriesCollectionImpl from, List<StationFeature> stations) { super(from.getName(), from.getTimeUnit(), from.getAltUnits()); this.stations = stations; }