Java Code Examples for ucar.nc2.ft.FeatureDatasetPoint#getFeatureType()
The following examples show how to use
ucar.nc2.ft.FeatureDatasetPoint#getFeatureType() .
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: NcCollectionType.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 6 votes |
public static StationTimeSeriesFeatureCollection getStationFeatures(FeatureDatasetPoint fdPoint) { String datasetFileName = new File(fdPoint.getNetcdfFile().getLocation()).getName(); if (fdPoint.getFeatureType() != FeatureType.STATION) { throw new IllegalArgumentException(String.format("In %s, expected feature type to be STATION, not %s.", datasetFileName, fdPoint.getFeatureType())); } List<DsgFeatureCollection> featCollList = fdPoint.getPointFeatureCollectionList(); if (featCollList.size() != 1) { throw new IllegalArgumentException( String.format("Expected %s to contain 1 FeatureCollection, not %s.", datasetFileName, featCollList.size())); } else if (!(featCollList.get(0) instanceof StationTimeSeriesFeatureCollection)) { String expectedClassName = StationTimeSeriesFeatureCollection.class.getName(); String actualClassName = featCollList.get(0).getClass().getName(); throw new IllegalArgumentException(String.format("Expected %s's FeatureCollection to be a %s, not a %s.", datasetFileName, expectedClassName, actualClassName)); } return (StationTimeSeriesFeatureCollection) featCollList.get(0); }
Example 2
Source File: DsgSubsetWriterFactory.java From tds with BSD 3-Clause "New" or "Revised" License | 6 votes |
public static DsgSubsetWriter newInstance(FeatureDatasetPoint fdPoint, SubsetParams ncssParams, NcssDiskCache ncssDiskCache, OutputStream out, SupportedFormat format) throws NcssException, XMLStreamException, IOException { FeatureType featureType = fdPoint.getFeatureType(); if (!featureType.isPointFeatureType()) { throw new NcssException(String.format("Expected a point feature type, not %s", featureType)); } switch (featureType) { case POINT: return newPointInstance(fdPoint, ncssParams, ncssDiskCache, out, format); case STATION: return newStationInstance(fdPoint, ncssParams, ncssDiskCache, out, format); default: throw new UnsupportedOperationException(String.format("%s feature type is not yet supported.", featureType)); } }