@Test
public void testNcml() throws IOException, InvalidRangeException {
String catalog = "/catalog/hioos/model/wav/swan/oahu/catalog.xml";
Catalog cat = TdsLocalCatalog.open(catalog);
String id = "hioos/model/wav/swan/oahu/SWAN_Oahu_Regional_Wave_Model_(500m)_best.ncd";
Dataset ds = cat.findDatasetByID(id);
assert (ds != null) : "cant find dataset id="+id;
assert ds.getFeatureType() == FeatureType.GRID;
DataFactory fac = new DataFactory();
try (DataFactory.Result dataResult = fac.openFeatureDataset( ds, null)) {
assert !dataResult.fatalError;
assert dataResult.featureDataset != null;
FeatureDatasetCoverage gds = (FeatureDatasetCoverage) dataResult.featureDataset;
String gridName = "salt";
VariableSimpleIF vs = gds.getDataVariable(gridName);
Assert.assertNotNull(gridName, vs);
Assert.assertEquals(1, gds.getCoverageCollections().size());
CoverageCollection cc = gds.getCoverageCollections().get(0);
Coverage grid = cc.findCoverage(gridName);
Assert.assertNotNull(gridName, grid);
CoverageCoordSys gcs = grid.getCoordSys();
Assert.assertNotNull(gcs);
int[] expectShape = new int[] {65, 30, 194, 294};
Assert.assertArrayEquals(expectShape, grid.getShape());
Attribute att = grid.findAttributeIgnoreCase("_FillValue");
assert att != null;
assert att.getDataType() == DataType.FLOAT;
assert Float.isNaN((Float) att.getNumericValue());
}
}