public boolean filter(NestedPointFeatureCollection pointFeatureCollection) { StationProfileFeature stationFeature = (StationProfileFeature) pointFeatureCollection; return stationHelper.getStation(stationFeature.getName()) != null; } }
@Override protected StationHelper createStationHelper() throws IOException { StationHelper stationHelper = new StationHelper(); for (BufrCdmIndexProto.Station s : index.stations) stationHelper.addStation(new BufrStation(s)); return stationHelper; }
@Override public PointFeatureCollectionIterator getPointFeatureCollectionIterator(int bufferSize) throws IOException { // an anonymous class iterating over the stations return new PointFeatureCollectionIterator() { Iterator<Station> stationIter = stationHelper.getStations().iterator(); public boolean hasNext() throws IOException { return stationIter.hasNext(); } public PointFeatureCollection next() throws IOException { return (PointFeatureCollection) stationIter.next(); } public void setBufferSize(int bytes) { } public void finish() { } }; }
@Override protected StationHelper createStationHelper() throws IOException { List<StationFeature> stations = from.getStationHelper().getStationFeatures(boundingBoxSubset); StationHelper stationHelper = new StationHelper(); stationHelper.setStations(stations); return stationHelper; }
@Override protected StationHelper createStationHelper() throws IOException { StationHelper stationHelper = new StationHelper(); stationHelper.setStations(stations); return stationHelper; }
@Override protected void initStationHelper() { from.initStationHelper(); this.stationHelper = new StationHelper(); try { this.stationHelper.setStations(this.stationHelper.getStations(boundingBoxSubset)); } catch (IOException e) { throw new RuntimeException(e); } }
protected RecordStationObs(StructureData sdata, int recno, boolean useId) { super(recno); this.recno = recno; this.sdata = sdata; this.timeUnit = RecordDatasetHelper.this.timeUnit; StructureMembers members = sdata.getStructureMembers(); obsTime = getTime(members.findMember(obsTimeVName), sdata); nomTime = (nomTimeVName == null) ? obsTime : getTime(members.findMember(nomTimeVName), sdata); if (useId) { // this assumes the station id/name is stored in the obs record String stationId; if (stationIdType == DataType.INT) { stationId = Integer.toString( sdata.getScalarInt(stnIdVName)); } else stationId = sdata.getScalarString(stnIdVName).trim(); station = stationHelper.getStation(stationId); if (null != errs) errs.format(" cant find station id = <%s> when reading record %d\n", stationId, recno); log.error(" cant find station id = <"+stationId+"> when reading record "+recno); } else { // use a station index List<Station> stations = stationHelper.getStations(); int stationIndex = sdata.getScalarInt(stnIndexVName); if (stationIndex < 0 || stationIndex >= stations.size()) { if (null != errs) errs.format(" cant find station at index =%d when reading record %d\n", stationIndex, recno); log.error("cant find station at index = "+stationIndex+" when reading record "+recno); } else station = stations.get(stationIndex); } location = station; }
@Override public List<StationFeature> getStationFeatures() throws IOException { return getStationHelper().getStationFeatures(); }
@Override public LatLonRect getBoundingBox() { return getStationHelper().getBoundingBox(); }
public void setStations( List<StationFeature> nstations) { stations = new ArrayList<>(); stationHash = new HashMap<>(); for (StationFeature s : nstations) addStation(s); }
@Override protected StationHelper createStationHelper() throws IOException { return from.getStationHelper().subset(stations); }
public List<StationFeature> getStationFeatures( List<String> stnNames) { return getStationHelper().getStationFeaturesFromNames(stnNames); }
public StationHelper subset(LatLonRect bb) throws IOException { StationHelper result = new StationHelper(); result.setStations( getStationFeatures(bb)); return result; }
@Override protected StationHelper createStationHelper() throws IOException { StationHelper stationHelper = new StationHelper(); stationHelper.setStations(stations); return stationHelper; }
protected RecordStationObs(StructureData sdata, int recno, boolean useId) { super(recno); this.recno = recno; this.sdata = sdata; this.timeUnit = RecordDatasetHelper.this.timeUnit; StructureMembers members = sdata.getStructureMembers(); obsTime = getTime(members.findMember(obsTimeVName), sdata); nomTime = (nomTimeVName == null) ? obsTime : getTime(members.findMember(nomTimeVName), sdata); if (useId) { // this assumes the station id/name is stored in the obs record String stationId; if (stationIdType == DataType.INT) { stationId = Integer.toString( sdata.getScalarInt(stnIdVName)); } else stationId = sdata.getScalarString(stnIdVName).trim(); station = stationHelper.getStation(stationId); if (null != errs) errs.format(" cant find station id = <%s> when reading record %d%n", stationId, recno); log.error(" cant find station id = <"+stationId+"> when reading record "+recno); } else { // use a station index List<Station> stations = stationHelper.getStations(); int stationIndex = sdata.getScalarInt(stnIndexVName); if (stationIndex < 0 || stationIndex >= stations.size()) { if (null != errs) errs.format(" cant find station at index =%d when reading record %d%n", stationIndex, recno); log.error("cant find station at index = "+stationIndex+" when reading record "+recno); } else station = stations.get(stationIndex); } location = station; }
@Override public List<StationFeature> getStationFeatures() throws IOException { return getStationHelper().getStationFeatures(); } }
@Override public LatLonRect getBoundingBox() { return getStationHelper().getBoundingBox(); }
public void setStations( List<Station> nstations) { stations = new ArrayList<Station>(); stationHash = new HashMap<String, Station>(); for (Station s : nstations) addStation(s); }
protected StationHelper createStationHelper() throws IOException { return from.getStationHelper().subset(stations); }
@Override public List<StationFeature> getStationFeatures(List<String> stnNames) { return getStationHelper().getStationFeaturesFromNames(stnNames); }