featureType = featureDataset.getFeatureType(); if (featureType != null) ftype = featureType.toString();
featureType = featureDataset.getFeatureType(); if (featureType != null) ftype = featureType.toString();
featureType = featureDataset.getFeatureType(); if (featureType != null) ftype = featureType.toString();
/** * Tests a non-CF compliant trajectory file * * This tests a non-CF compliant trajectory file * which is read in using the ucar.nc2.ft.point.standard.plug.SimpleTrajectory * plug. */ @Test public void testSimpleTrajectory() throws IOException { FeatureType type = FeatureType.ANY; Path location_path = Paths.get(TestDir.cdmLocalTestDataDir, "trajectory", "aircraft", "uw_kingair-2005-01-19-113957.nc"); FeatureDataset featureDataset = FeatureDatasetFactoryManager.open(type, location_path.toString(), null, null); assert featureDataset != null; assert featureDataset.getFeatureType() == FeatureType.TRAJECTORY; }
@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()); } } }
public static int checkPointFeatureDataset(String location, FeatureType type, boolean show) throws IOException { File fileIn = new File(location); String absIn = fileIn.getCanonicalPath(); absIn = StringUtil2.replace(absIn, "\\", "/"); System.out.printf("================ TestPointFeatureCollection read %s %n", absIn); Formatter out = new Formatter(); try (FeatureDataset fdataset = FeatureDatasetFactoryManager.open(type, location, null, out)) { if (fdataset == null) { System.out.printf("**failed on %s %n --> %s %n", location, out); assert false; } // FeatureDataset if (showAll) { System.out.printf("----------- testPointDataset getDetailInfo -----------------%n"); fdataset.getDetailInfo(out); System.out.printf("%s %n", out); } else { System.out.printf(" Feature Type %s %n", fdataset.getFeatureType()); } return checkPointFeatureDataset(fdataset, show); } }
@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 testOpenFromDataFactory() throws IOException { DataFactory fac = new DataFactory(); try (DataFactory.Result result = fac.openFeatureDataset(path, null)) { if (result.fatalError) { logger.debug("Dataset fatalError = {}", result.errLog); assert false; } else { logger.debug("Dataset '{}' opened as type = {}", path, result.featureDataset.getFeatureType()); Assert.assertEquals(expectService, result.accessUsed.getService().getType()); Assert.assertEquals(expectFeature, result.featureDataset.getFeatureType()); } } } }
c.failFc++; } else { pw.format(" Dataset '%s' opened as type=%s%n", dd.getName(), result.featureDataset.getFeatureType()); c.openFc++; if (cmdLine.readRandom && result.featureDataset instanceof FeatureDatasetCoverage) {
else { result.location = result.featureDataset.getLocation(); result.featureType = result.featureDataset.getFeatureType();
else { result.location = result.featureDataset.getLocation(); result.featureType = result.featureDataset.getFeatureType();
private ThreddsDataFactory.Result openFeatureDataset(FeatureType wantFeatureType, InvAccess access, ucar.nc2.util.CancelTask task, Result result) throws IOException { result.featureType = wantFeatureType; result.accessUsed = access; // special handling for IMAGE if (result.featureType == FeatureType.IMAGE) { result.imageURL = access.getStandardUrlName(); result.location = result.imageURL; return result; } if (access.getService().getServiceType() == ServiceType.CdmrFeature) { result.featureDataset = CdmrFeatureDataset.factory(wantFeatureType, access.getStandardUrlName()); } else { // all other datatypes NetcdfDataset ncd = openDataset(access, true, task, result); if (null != ncd) { result.featureDataset = FeatureDatasetFactoryManager.wrap(result.featureType, ncd, task, result.errLog); } } if (null == result.featureDataset) result.fatalError = true; else { result.location = result.featureDataset.getLocation(); if ((result.featureType == null) && (result.featureDataset != null)) result.featureType = result.featureDataset.getFeatureType(); } return result; }
private ThreddsDataFactory.Result openFeatureDataset(FeatureType wantFeatureType, InvAccess access, ucar.nc2.util.CancelTask task, Result result) throws IOException { result.featureType = wantFeatureType; result.accessUsed = access; // special handling for IMAGE if (result.featureType == FeatureType.IMAGE) { result.imageURL = access.getStandardUrlName(); result.location = result.imageURL; return result; } if (access.getService().getServiceType() == ServiceType.CdmrFeature) { result.featureDataset = CdmrFeatureDataset.factory(wantFeatureType, access.getStandardUrlName()); } else { // all other datatypes NetcdfDataset ncd = openDataset(access, true, task, result); if (null != ncd) { result.featureDataset = FeatureDatasetFactoryManager.wrap(result.featureType, ncd, task, result.errLog); } } if (null == result.featureDataset) result.fatalError = true; else { result.location = result.featureDataset.getLocation(); if ((result.featureType == null) && (result.featureDataset != null)) result.featureType = result.featureDataset.getFeatureType(); } return result; }
result.location = result.featureDataset.getLocation(); if (result.featureType == null) result.featureType = result.featureDataset.getFeatureType();
result.location = result.featureDataset.getLocation(); if ((result.featureType == null) && (result.featureDataset != null)) result.featureType = result.featureDataset.getFeatureType();
result.location = result.featureDataset.getLocation(); if ((result.featureType == null) && (result.featureDataset != null)) result.featureType = result.featureDataset.getFeatureType();
result.location = result.featureDataset.getLocation(); if ((result.featureType == null) && (result.featureDataset != null)) result.featureType = result.featureDataset.getFeatureType();
try (FeatureDataset fd = FeatureDatasetFactoryManager.open(FeatureType.ANY_POINT, tempFile.getPath(), null, errlog)) { Assert.assertNotNull(tempFile.getPath(), fd); Assert.assertEquals(FeatureType.STATION, fd.getFeatureType());