public void addAll(File datasetFile) throws NoFactoryFoundException, IOException { try (FeatureDatasetPoint fdPoint = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open( FeatureType.STATION, datasetFile.getAbsolutePath(), null, new Formatter())) { addAll(fdPoint); } }
/** * @deprecated use open(FeatureType wantFeatureType, String location, ucar.nc2.util.CancelTask task, Formatter errlog) */ public static FeatureDataset open(FeatureType wantFeatureType, String location, ucar.nc2.util.CancelTask task) throws IOException, NoFactoryFoundException { Formatter errlog = new Formatter(); FeatureDataset fd = FeatureDatasetFactoryManager.open(wantFeatureType, location, task, errlog); if (fd == null) { throw new NoFactoryFoundException(errlog.toString()); } else { return fd; } }
public static void doOne(String location, String path, String result) throws IOException { FeatureDataset fd = FeatureDatasetFactoryManager.open(FeatureType.ANY_POINT, location, null, new Formatter(System.out)); FeatureDatasetPointXML xml = new FeatureDatasetPointXML((FeatureDatasetPoint) fd, path); xml.getCapabilities(System.out); File f = new File(result); FileOutputStream fos = new FileOutputStream(f); xml.getCapabilities(fos); fos.close(); System.out.printf("%s written%n", f.getPath()); }
public static void doOne(String location, String path, String result) throws IOException { FeatureDataset fd = FeatureDatasetFactoryManager.open(FeatureType.ANY_POINT, location, null, new Formatter(System.out)); FeatureDatasetPointXML xml = new FeatureDatasetPointXML((FeatureDatasetPoint) fd, path); xml.getCapabilities(System.out); File f = new File(result); FileOutputStream fos = new FileOutputStream(f); xml.getCapabilities(fos); fos.close(); System.out.printf("%s written%n", f.getPath()); }
private RadialDatasetSweep arrayLatLonData() throws IOException { String filename = TestDir.cdmUnitTestDir + "conventions/cfradial/cfrad.20171127_202111.203_to_20171127_202123.085_DOW7_v275_s04_el7.00_SUR.nc"; Formatter buf = new Formatter(); return (RadialDatasetSweep) FeatureDatasetFactoryManager.open( FeatureType.RADIAL, filename, null, buf); }
private RadialDatasetSweep testData() throws IOException { String filename = TestDir.cdmUnitTestDir + "conventions/cfradial/cfrad.20080604_002217_000_SPOL_v36_SUR.nc"; Formatter buf = new Formatter(); return (RadialDatasetSweep) FeatureDatasetFactoryManager.open( FeatureType.RADIAL, filename, null, buf); }
private PointFeatureIterator getNextIterator() throws IOException { if (!iter.hasNext()) return null; TimedCollection.Dataset td = iter.next(); Formatter errlog = new Formatter(); currentDataset = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(FeatureType.POINT, td.getLocation(), null, errlog); if (CompositeDatasetFactory.debug) System.out.printf("CompositePointFeatureIterator open dataset %s%n", td.getLocation()); List<FeatureCollection> fcList = currentDataset.getPointFeatureCollectionList(); PointFeatureCollection pc = (PointFeatureCollection) fcList.get(0); return pc.getPointFeatureIterator(bufferSize); }
private RadialDatasetSweep oneDData() throws IOException { String filename = TestDir.cdmUnitTestDir + "conventions/cfradial/cfrad.20140608_220305.809_to_20140608_220710.630_KFTG_v348_Surveillance_SUR.nc"; Formatter buf = new Formatter(); return (RadialDatasetSweep) FeatureDatasetFactoryManager.open( FeatureType.RADIAL, filename, null, buf); }
private RadialDatasetSweep rhiData() throws IOException { String filename = TestDir.cdmUnitTestDir + "conventions/cfradial/cfrad.20140717_003008.286_to_20140717_003049.699_SPOL_v140_rhi_sim_RHI.nc"; Formatter buf = new Formatter(); return (RadialDatasetSweep) FeatureDatasetFactoryManager.open( FeatureType.RADIAL, filename, null, buf); }
private PointFeatureIterator getNextIterator() throws IOException { if (!iter.hasNext()) return null; TimedCollection.Dataset td = iter.next(); Formatter errlog = new Formatter(); currentDataset = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(FeatureType.POINT, td.getLocation(), null, errlog); if (CompositeDatasetFactory.debug) System.out.printf("CompositePointFeatureIterator open dataset %s%n", td.getLocation()); List<FeatureCollection> fcList = currentDataset.getPointFeatureCollectionList(); PointFeatureCollection pc = (PointFeatureCollection) fcList.get(0); return pc.getPointFeatureIterator(bufferSize); }
private PointFeatureIterator getNextIterator() throws IOException { if (!iter.hasNext()) return null; TimedCollection.Dataset td = iter.next(); Formatter errlog = new Formatter(); currentDataset = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(FeatureType.POINT, td.getLocation(), null, errlog); if (CompositeDatasetFactory.debug) System.out.printf("CompositePointFeatureIterator open dataset %s%n", td.getLocation()); List<FeatureCollection> fcList = currentDataset.getPointFeatureCollectionList(); PointFeatureCollection pc = (PointFeatureCollection) fcList.get(0); return pc.getPointFeatureIterator(bufferSize); }
private PointFeatureIterator getNextIterator() throws IOException { if (!iter.hasNext()) return null; TimedCollection.Dataset td = iter.next(); Formatter errlog = new Formatter(); currentDataset = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(FeatureType.POINT, td.getLocation(), null, errlog); if (CompositeDatasetFactory.debug) System.out.printf("CompositePointFeatureIterator open dataset %s%n", td.getLocation()); List<FeatureCollection> fcList = currentDataset.getPointFeatureCollectionList(); PointFeatureCollection pc = (PointFeatureCollection) fcList.get(0); return pc.getPointFeatureIterator(bufferSize); }
private PointFeatureIterator getNextIterator() throws IOException { if (!iter.hasNext()) return null; TimedCollection.Dataset td = iter.next(); Formatter errlog = new Formatter(); currentDataset = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(FeatureType.POINT, td.getLocation(), null, errlog); if (currentDataset == null) throw new IllegalStateException("Cant open FeatureDatasetPoint " + td.getLocation()); if (CompositeDatasetFactory.debug) System.out.printf("CompositePointFeatureIterator open dataset %s%n", td.getLocation()); List<DsgFeatureCollection> fcList = currentDataset.getPointFeatureCollectionList(); PointFeatureCollection pc = (PointFeatureCollection) fcList.get(0); return pc.getPointFeatureIterator(); }
public static FeatureDatasetPoint openPointDataset(String resource) throws IOException, NoFactoryFoundException, URISyntaxException { File file = new File(PointTestUtil.class.getResource(resource).toURI()); return (FeatureDatasetPoint) FeatureDatasetFactoryManager.open( FeatureType.ANY_POINT, file.getAbsolutePath(), null); }
@Test public void testTryWith() throws IOException { String location = TestDir.cdmLocalTestDataDir + "testWrite.nc"; Formatter errlog = new Formatter(); try (FeatureDataset fdataset = FeatureDatasetFactoryManager.open(null, location, null, errlog)) { assert (fdataset == null); } }
@Test public void testDataVars() throws Exception { String file = TestDir.cdmLocalTestDataDir + "point/stationSingle.ncml"; Formatter buf = new Formatter(); try (FeatureDatasetPoint pods = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(ucar.nc2.constants.FeatureType.STATION, file, null, buf)) { List<VariableSimpleIF> dataVars = pods.getDataVariables(); for (VariableSimpleIF dv : dataVars) System.out.printf(" %s%n", dv ); assert (dataVars.size() == 1) : "Should only be one data var"; VariableSimpleIF data = dataVars.get(0); assert data.getShortName().equalsIgnoreCase("data"); } }
@Test public void testAltUnits() throws Exception { String file = TestDir.cdmLocalTestDataDir + "point/stationRaggedContig.ncml"; Formatter buf = new Formatter(); try (FeatureDatasetPoint pods = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(ucar.nc2.constants.FeatureType.STATION, file, null, buf)) { List<DsgFeatureCollection> collectionList = pods.getPointFeatureCollectionList(); assert (collectionList.size() == 1) : "Can't handle point data with multiple collections"; DsgFeatureCollection fc = collectionList.get(0); assert fc.getAltUnits() != null : "no Alt Units"; assert fc.getAltUnits().equalsIgnoreCase("m") : "Alt Units should be 'm'"; } }
@Test public void testOpen() throws IOException, InvalidRangeException { System.out.printf("FeatureDatasetFactoryManager.open %s%n", ds); Formatter errlog = new Formatter(); try (FeatureDataset fd = FeatureDatasetFactoryManager.open(what, ds, null, errlog)) { Assert.assertNotNull(errlog.toString()+" "+ds, fd); if (fd.getFeatureType().isCoverageFeatureType()) testCoverage(ds); } }
@Test public void testFeatureDatasets() throws IOException { for (File f : getAllFilesInDirectoryStandardFilter(dir)) { logger.debug("Open FeatureDataset {}", f.getPath()); try (FeatureDataset fd = FeatureDatasetFactoryManager.open(type, f.getPath(), null, new Formatter())) { Assert.assertNotNull(f.getPath(), fd); if (type == FeatureType.GRID) Assert.assertTrue(f.getPath(), fd.getFeatureType().isCoverageFeatureType()); else if (type == FeatureType.POINT) Assert.assertTrue(f.getPath(), fd.getFeatureType().isPointFeatureType()); } } }
@Test public void testDates() throws IOException { String fullpath = TestDir.cdmUnitTestDir + filename; Formatter errlog = new Formatter(); RadialDatasetSweep rds = (RadialDatasetSweep) FeatureDatasetFactoryManager.open(FeatureType.RADIAL, fullpath, null, errlog); Assert.assertEquals(start, rds.getCalendarDateStart()); Assert.assertEquals(end, rds.getCalendarDateEnd()); } }