@Test
public void TestGribCurvilinearSubset() throws IOException, InvalidRangeException {
String endpoint = TestDir.cdmUnitTestDir + "ft/fmrc/rtofs/ofs.20091122/ofs_atl.t00z.F024.grb.grib2";
logger.debug("open {}", endpoint);
try (FeatureDatasetCoverage cc = CoverageDatasetFactory.open(endpoint)) {
assert cc != null;
Assert.assertEquals(1, cc.getCoverageCollections().size());
CoverageCollection gds = cc.getCoverageCollections().get(0);
Assert.assertNotNull(endpoint, gds);
Assert.assertEquals(FeatureType.CURVILINEAR, gds.getCoverageType());
Assert.assertEquals(7, gds.getCoverageCount());
HorizCoordSys hcs = gds.getHorizCoordSys();
Assert.assertNotNull(endpoint, hcs);
Assert.assertTrue(endpoint, !hcs.isProjection());
Assert.assertNull(endpoint, hcs.getTransform());
String covName = "Mixed_layer_depth_surface";
Coverage coverage = gds.findCoverage(covName);
Assert.assertNotNull(covName, coverage);
LatLonRect bbox = new LatLonRect(new LatLonPointImpl(64.0, -61.), new LatLonPointImpl(59.0, -52.));
SubsetParams params = new SubsetParams().set(SubsetParams.timePresent, true).set(SubsetParams.latlonBB, bbox);
GeoReferencedArray geo = coverage.readData(params);
logger.debug("csys shape={}", Misc.showInts(geo.getCoordSysForData().getShape()));
Array data = geo.getData();
logger.debug("data shape={}", Misc.showInts(data.getShape()));
Assert.assertArrayEquals(geo.getCoordSysForData().getShape(), data.getShape());
int[] expectedShape = new int[] {1, 165, 161};
Assert.assertArrayEquals(expectedShape, data.getShape());
}
}