public List<VariableSimpleIF> getDataVariables() { List<VariableSimpleIF> data = new ArrayList<VariableSimpleIF>(); addDataVariables(data, leaf); return data; }
public PointFeatureCollectionIterator getPointFeatureCollectionIterator(int bufferSize) throws IOException { Cursor cursor = new Cursor(ft.getNumberOfLevels()); cursor.recnum[2] = recnum; // the station record cursor.tableData[2] = stationData; // obs(leaf) = 0, profile=1, station(root)=2 cursor.currentIndex = 2; ft.addParentJoin(cursor); // there may be parent joins return new TimeSeriesOfProfileFeatureIterator(cursor); }
this.root = getRoot(); timeVE = findCoordinateAxis(Table.CoordName.Time, leaf, 0); latVE = findCoordinateAxis(Table.CoordName.Lat, leaf, 0); lonVE = findCoordinateAxis(Table.CoordName.Lon, leaf, 0); altVE = findCoordinateAxis(Table.CoordName.Elev, leaf, 0); nomTimeVE = findCoordinateAxis(Table.CoordName.TimeNominal, leaf, 0); stnVE = findCoordinateAxis(Table.CoordName.StnId, leaf, 0); stnDescVE = findCoordinateAxis(Table.CoordName.StnDesc, leaf, 0); wmoVE = findCoordinateAxis(Table.CoordName.WmoId, leaf, 0); stnAltVE = findCoordinateAxis(Table.CoordName.StnAlt, leaf, 0); missingVE = findCoordinateAxis(Table.CoordName.MissingVar, leaf, 0); idVE = findCoordinateAxis(Table.CoordName.FeatureId, root, nlevels-1); // LOOK start at root ??
public FeatureType getFirstFeatureType() { for (NestedTable nt : leaves) { if (nt.hasCoords()) return nt.getFeatureType(); } return null; }
StandardPointFeature(Cursor cursor, CalendarDateUnit timeUnit, double obsTime) { super(collectionDsg, timeUnit); this.cursor = cursor; cursor.currentIndex = 1; // LOOK ???? this.obsTime = obsTime; nomTime = ft.getNomTime( this.cursor); if (Double.isNaN(nomTime)) nomTime = obsTime; location = ft.getEarthLocation( this.cursor); }
public boolean featureTypeOk(FeatureType ftype, Formatter errlog) { for (NestedTable nt : leaves) { if (!nt.hasCoords()) errlog.format("Table %s featureType %s: lat/lon/time coord not found%n", nt.getName(), nt.getFeatureType()); if (!FeatureDatasetFactoryManager.featureTypeOk(ftype, nt.getFeatureType())) errlog.format("Table %s featureType %s doesnt match desired type %s%n", nt.getName(), nt.getFeatureType(), ftype); if (nt.hasCoords() && FeatureDatasetFactoryManager.featureTypeOk(ftype, nt.getFeatureType())) return true; } return false; }
StandardProfileFeature( Cursor cursor, double time) { super( ft.getFeatureName(cursor), ft.getLatitude(cursor), ft.getLongitude(cursor), time, -1); this.cursor = cursor; if (name.equalsIgnoreCase("unknown")) name = timeUnit.makeStandardDateString(time); // use time as the name if (Double.isNaN(time)) { // gotta read an obs to get the time try { PointFeatureIterator iter = getPointFeatureIterator(-1); if (iter.hasNext()) { PointFeature pf = iter.next(); this.time = pf.getObservationTime(); this.name = timeUnit.makeStandardDateString(this.time); } else { this.name = "empty"; } } catch (IOException e) { e.printStackTrace(); } } }
this.root = getRoot(); timeVE = findCoordinateAxis(Table.CoordName.Time, leaf, 0); latVE = findCoordinateAxis(Table.CoordName.Lat, leaf, 0); lonVE = findCoordinateAxis(Table.CoordName.Lon, leaf, 0); altVE = findCoordinateAxis(Table.CoordName.Elev, leaf, 0); nomTimeVE = findCoordinateAxis(Table.CoordName.TimeNominal, leaf, 0); stnVE = findCoordinateAxis(Table.CoordName.StnId, leaf, 0); stnDescVE = findCoordinateAxis(Table.CoordName.StnDesc, leaf, 0); wmoVE = findCoordinateAxis(Table.CoordName.WmoId, leaf, 0); stnAltVE = findCoordinateAxis(Table.CoordName.StnAlt, leaf, 0); missingVE = findCoordinateAxis(Table.CoordName.MissingVar, leaf, 0); idVE = findCoordinateAxis(Table.CoordName.FeatureId, root, nlevels - 1); // LOOK start at root ?? if (!isCoordinate(axis) && !isExtra(axis) && axis.getDimensionsAll().size() <= 1) // Only permit 0-D and 1-D axes as extra variables. addExtraVariable(axis);
public ProfileFeature next() throws IOException { Cursor cursor = new Cursor(ft.getNumberOfLevels()); cursor.tableData[1] = nextProfileData; cursor.recnum[1] = structIter.getCurrentRecno(); cursor.currentIndex = 1; ft.addParentJoin(cursor); // there may be parent joins return new StandardProfileFeature(cursor, ft.getObsTime(cursor), nextProfileData); }
@Override public PointFeatureIterator getPointFeatureIterator() throws IOException { Cursor cursor = new Cursor(ft.getNumberOfLevels()); cursor.recnum[1] = recnum; cursor.tableData[1] = stationData; cursor.currentIndex = 1; ft.addParentJoin(cursor); // there may be parent joins StructureDataIterator obsIter = ft.getLeafFeatureDataIterator(cursor); return new StandardPointFeatureIterator(this, ft, timeUnit, obsIter, cursor); }
timeUnit = flatTable.getTimeUnit(); } catch (Exception e) { if (null != errlog) errlog.format("%s%n", e.getMessage()); String altUnits = flatTable.getAltUnits(); dataVariables = new ArrayList<>(flatTable.getDataVariables()); featureType = flatTable.getFeatureType(); // hope they're all the same if (flatTable.getFeatureType() == FeatureType.POINT) featureCollections.add(new StandardPointCollectionImpl(flatTable, timeUnit, altUnits)); else if (flatTable.getFeatureType() == FeatureType.PROFILE) featureCollections.add(new StandardProfileCollectionImpl(flatTable, timeUnit, altUnits)); else if (flatTable.getFeatureType() == FeatureType.STATION) featureCollections.add(new StandardStationCollectionImpl(flatTable, timeUnit, altUnits)); else if (flatTable.getFeatureType() == FeatureType.STATION_PROFILE) featureCollections.add(new StandardStationProfileCollectionImpl(flatTable, timeUnit, altUnits)); else if (flatTable.getFeatureType() == FeatureType.TRAJECTORY_PROFILE) featureCollections.add(new StandardSectionCollectionImpl(flatTable, timeUnit, altUnits)); else if (flatTable.getFeatureType() == FeatureType.TRAJECTORY) featureCollections.add(new StandardTrajectoryCollectionImpl(flatTable, timeUnit, altUnits));
protected PointFeature makeFeature(int recnum, StructureData sdata) throws IOException { cursor.recnum[0] = recnum; cursor.tableData[0] = sdata; // always in the first position cursor.currentIndex = 0; ft.addParentJoin(cursor); // there may be parent joins if (isMissing()) return null; // missing data double obsTime = ft.getObsTime( this.cursor); // must send a copy, since sdata is changing each time, and StandardPointFeature may be stored return new StandardPointFeature(cursor.copy(), timeUnit, obsTime); }
@Override public StationProfileFeature next() throws IOException { Cursor cursor = new Cursor(ft.getNumberOfLevels()); cursor.recnum[2] = sdataIter.getCurrentRecno(); cursor.tableData[2] = stationProfileData; // obs(leaf) = 0, profile=1, section(root)=2 cursor.currentIndex = 2; ft.addParentJoin(cursor); // there may be parent joins StationProfileFeature result = new StandardStationProfileFeature(ft.makeStation(stationProfileData), cursor, stationProfileData, cursor.recnum[2]); prev = (DsgCollectionImpl) result; // common for Station and StationProfile return result; }
timeUnit = flatTable.getTimeUnit(); } catch (Exception e) { if (null != errlog) errlog.format("%s\n", e.getMessage()); dataVariables = new ArrayList<VariableSimpleIF>(flatTable.getDataVariables()); featureType = flatTable.getFeatureType(); // hope they're all the same if (flatTable.getFeatureType() == FeatureType.POINT) featureCollections.add(new StandardPointCollectionImpl(flatTable, timeUnit)); else if (flatTable.getFeatureType() == FeatureType.PROFILE) featureCollections.add(new StandardProfileCollectionImpl(flatTable, timeUnit)); else if (flatTable.getFeatureType() == FeatureType.STATION) featureCollections.add(new StandardStationCollectionImpl(flatTable, timeUnit)); else if (flatTable.getFeatureType() == FeatureType.STATION_PROFILE) featureCollections.add(new StandardStationProfileCollectionImpl(flatTable, timeUnit)); else if (flatTable.getFeatureType() == FeatureType.SECTION) featureCollections.add(new StandardSectionCollectionImpl(flatTable, timeUnit)); else if (flatTable.getFeatureType() == FeatureType.TRAJECTORY) featureCollections.add(new StandardTrajectoryCollectionImpl(flatTable, timeUnit));
public boolean hasNext() throws IOException { while (true) { if (!iter.hasNext()) { timeSeriesNpts = count; // field in StationProfileFeatureImpl return false; } //nextProfile = iter.next(); cursor.tableData[1] = iter.next(); cursor.recnum[1] = iter.getCurrentRecno(); cursor.currentIndex = 1; ft.addParentJoin(cursor); // there may be parent joins if (!ft.isMissing(cursor)) break; } return true; }
StandardTrajectoryFeature(Cursor cursor) { super(ft.getFeatureName(cursor), -1); this.cursor = cursor; }
StandardSectionProfileFeature(Cursor cursor, double time) { super( timeUnit.makeStandardDateString(time), ft.getLatitude(cursor), ft.getLongitude(cursor), time, -1); this.cursor = cursor; if (Double.isNaN(time)) { // gotta read an obs to get the time try { PointFeatureIterator iter = getPointFeatureIterator(-1); if (iter.hasNext()) { PointFeature pf = iter.next(); this.time = pf.getObservationTime(); this.name = timeUnit.makeStandardDateString(this.time); } else { this.name = "empty"; } } catch (IOException e) { e.printStackTrace(); } } }
/** Create an XML document from this info * @return netcdfDatasetInfo XML document */ private Document makeDocument() { Element rootElem = new Element("featureDataset"); Document doc = new Document(rootElem); rootElem.setAttribute("location", ds.getLocation()); if (tc != null) rootElem.addContent( new Element("analyser").setAttribute("class", tc.getClass().getName())); if (ft != null) rootElem.setAttribute("featureType", ft.toString()); for (NestedTable nt : leaves) { writeTable( rootElem, nt.getLeaf()); } return doc; }
NestedTable flatTable = new NestedTable(ds, config, errlog); leaves.add(flatTable);
return findCoordinateAxis(coordName, t.parent, nestingLevel + 1);