Java Code Examples for ucar.nc2.constants.FeatureType#STATION_PROFILE
The following examples show how to use
ucar.nc2.constants.FeatureType#STATION_PROFILE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Madis.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
public boolean isMine(FeatureType wantFeatureType, NetcdfDataset ds) { if ((wantFeatureType != FeatureType.ANY_POINT) && (wantFeatureType != FeatureType.STATION) && (wantFeatureType != FeatureType.POINT) && (wantFeatureType != FeatureType.STATION_PROFILE)) return false; if (!ds.hasUnlimitedDimension()) return false; if (ds.findDimension("recNum") == null) return false; if (ds.findVariable("staticIds") == null) return false; if (ds.findVariable("nStaticIds") == null) return false; if (ds.findVariable("lastRecord") == null) return false; if (ds.findVariable("prevRecord") == null) return false; VNames vn = getVariableNames(ds, null); if (ds.findVariable(vn.lat) == null) return false; if (ds.findVariable(vn.lon) == null) return false; return ds.findVariable(vn.obsTime) != null; }
Example 2
Source File: CdmDirect.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
protected TableConfig getStationProfileConfig(NetcdfDataset ds, Formatter errlog) { TableConfig stnTable = getStationConfig(ds, errlog); if (stnTable == null) return null; stnTable.featureType = FeatureType.STATION_PROFILE; TableConfig timeSeries = stnTable.children.get(0); Structure obsv = (Structure) ds.findVariable(timeSeries.name); Structure profile = null; for (Variable v : obsv.getVariables()) { if (v.getDataType() == DataType.SEQUENCE) profile = (Structure) v; } if (profile == null) { errlog.format("getStationProfileConfig: must have Sequence varibale for profile%n"); return null; } TableConfig profileTc = new TableConfig(Table.Type.NestedStructure, profile.getFullName()); profileTc.nestedTableName = profile.getShortName(); Variable elev = findZAxisNotStationAlt(ds); if (elev == null) { errlog.format("getStationProfileConfig: must have ZAxis that is not the StationAlt%n"); return null; } profileTc.elev = elev.getShortName(); if (profileTc.elev == null) { errlog.format("Must have a level coordinate%n"); return null; } timeSeries.addChild(profileTc); return stnTable; }
Example 3
Source File: PointDatasetStandardFactory.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
PointDatasetStandard(FeatureType wantFeatureType, TableAnalyzer analyser, NetcdfDataset ds, Formatter errlog) { super(ds, null); parseInfo.format(" PointFeatureDatasetImpl=%s%n", getClass().getName()); this.analyser = analyser; List<DsgFeatureCollection> featureCollections = new ArrayList<>(); for (NestedTable flatTable : analyser.getFlatTables()) { // each flat table becomes a "feature collection" CalendarDateUnit timeUnit; try { timeUnit = flatTable.getTimeUnit(); } catch (Exception e) { if (null != errlog) errlog.format("%s%n", e.getMessage()); timeUnit = CalendarDateUnit.unixDateUnit; } String altUnits = flatTable.getAltUnits(); // create member variables 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)); } if (featureCollections.isEmpty()) throw new IllegalStateException("No feature collections found"); setPointFeatureCollection(featureCollections); }
Example 4
Source File: NestedTable.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
NestedTable(NetcdfDataset ds, TableConfig config, Formatter errlog) { this.ds = ds; this.errlog = errlog; this.leaf = Table.factory(ds, config); this.root = getRoot(); // use the featureType from the highest level table nlevels = 0; Table t = leaf; while (t != null) { if (t.getFeatureType() != null) featureType = t.getFeatureType(); t = t.parent; // if (!(t instanceof Table.TableTop)) // LOOK using nlevels is fishy nlevels++; } if (featureType == null) featureType = FeatureDatasetFactoryManager.findFeatureType(ds); /* * find joins with extra variables * t = leaf; * while (t != null) { * if (t.extraJoins != null) { * for (Join j : t.extraJoins) { * addExtraVariable(j.getExtraVariable()); * } * } * t = t.parent; // recurse upwards * } */ // will find the first one, starting at the leaf and going up 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); // search for station info 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 ?? // LOOK: Major kludge if (featureType == null) { if (nlevels == 1) featureType = FeatureType.POINT; if (nlevels == 2) featureType = FeatureType.STATION; if (nlevels == 3) featureType = FeatureType.STATION_PROFILE; } // find coordinates that are not part of the extras for (CoordinateAxis axis : ds.getCoordinateAxes()) { if (!isCoordinate(axis) && !isExtra(axis) && axis.getDimensionsAll().size() <= 1) // Only permit 0-D and 1-D axes // as extra variables. addExtraVariable(axis); } /* * check for singleton * if (((nlevels == 1) && (featureType == FeatureType.STATION) || (featureType == FeatureType.PROFILE) || * (featureType == FeatureType.TRAJECTORY)) || * ((nlevels == 2) && (featureType == FeatureType.STATION_PROFILE) || (featureType == * FeatureType.TRAJECTORY_PROFILE))) { * * // singleton. use file name as feature name, so aggregation will work * StructureData sdata = StructureDataFactory.make(featureVariableName, ds.getLocation()); * TableConfig parentConfig = new TableConfig(Table.Type.Singleton, featureType.toString()); * parentConfig.sdata = sdata; * root = Table.factory(ds, parentConfig); * * nlevels++; * } // */ }
Example 5
Source File: GempakCdm.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
protected TableConfig getStationProfileConfig(NetcdfDataset ds, Formatter errlog) { TableConfig stnTable = makeStationTable(ds, errlog); if (stnTable == null) return null; Dimension stationDim = ds.findDimension(stnTable.dimName); stnTable.featureType = FeatureType.STATION_PROFILE; // obs table VariableDS time = CoordSysEvaluator.findCoordByType(ds, AxisType.Time); if (time == null) { errlog.format("GempakCdm: Must have a Time coordinate"); return null; } Dimension obsDim = time.getDimension(time.getRank() - 1); // may be time(time) or time(stn, obs) Structure multidimStruct = Evaluator.findStructureWithDimensions(ds, stationDim, obsDim); if (multidimStruct == null) { errlog.format("GempakCdm: Cannot figure out Station/obs table structure"); return null; } TableConfig timeTable = new TableConfig(Table.Type.MultidimStructure, obsDim.getShortName()); timeTable.missingVar = "_isMissing"; timeTable.structName = multidimStruct.getFullName(); timeTable.structureType = TableConfig.StructureType.Structure; timeTable.addJoin(new JoinArray(time, JoinArray.Type.level, 1)); timeTable.time = time.getFullName(); timeTable.feature_id = time.getFullName(); stnTable.addChild(timeTable); TableConfig obsTable = new TableConfig(Table.Type.NestedStructure, obsDim.getShortName()); Structure nestedStruct = Evaluator.findNestedStructure(multidimStruct); if (nestedStruct == null) { errlog.format("GempakCdm: Cannot find nested Structure for profile"); return null; } obsTable.structName = nestedStruct.getFullName(); obsTable.nestedTableName = nestedStruct.getShortName(); Variable elev = findZAxisNotStationAlt(ds); if (elev == null) { errlog.format("GempakCdm: Cannot find profile elevation variable"); return null; } obsTable.elev = elev.getShortName(); timeTable.addChild(obsTable); return stnTable; }
Example 6
Source File: StationProfileCollectionImpl.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
public StationProfileCollectionImpl(String name, CalendarDateUnit timeUnit, String altUnits) { super(name, timeUnit, altUnits, FeatureType.STATION_PROFILE); }
Example 7
Source File: StationProfileFeatureImpl.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
public StationProfileFeatureImpl(String name, String desc, String wmoId, double lat, double lon, double alt, CalendarDateUnit timeUnit, String altUnits, int npts) { super(name, timeUnit, altUnits, FeatureType.STATION_PROFILE); station = new StationImpl(name, desc, wmoId, lat, lon, alt, npts); this.timeSeriesNpts = npts; }
Example 8
Source File: StationProfileFeatureImpl.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
public StationProfileFeatureImpl(Station s, CalendarDateUnit timeUnit, String altUnits, int npts) { super(s.getName(), timeUnit, altUnits, FeatureType.STATION_PROFILE); this.station = s; this.timeSeriesNpts = npts; }