@Test @Category(NeedsCdmUnitTest.class) public void testCrossLongitudeSeamGrib() throws Exception { String filename = TestDir.cdmUnitTestDir + "tds/ncep/GFS_Global_0p5deg_20100913_0000.grib2"; System.out.printf("open %s%n", filename); try (FeatureDatasetCoverage cc = CoverageDatasetFactory.open(filename)) { Assert.assertNotNull(filename, cc); CoverageCollection gcs = cc.findCoverageDataset(FeatureType.GRID); Assert.assertNotNull("gcs", gcs); String gribId = "VAR_2-0-0_L1"; Coverage coverage = gcs.findCoverageByAttribute(Grib.VARIABLE_ID_ATTNAME, gribId); // Land_cover_0__sea_1__land_surface Assert.assertNotNull(gribId, coverage); CoverageCoordSys cs = coverage.getCoordSys(); Assert.assertNotNull("coordSys", cs); System.out.printf(" org coverage shape=%s%n", Misc.showInts(cs.getShape())); HorizCoordSys hcs = cs.getHorizCoordSys(); Assert.assertNotNull("HorizCoordSys", hcs); Assert.assertEquals("rank", 3, cs.getShape().length); LatLonRect bbox = new LatLonRect(new LatLonPointImpl(40.0, -100.0), 10.0, 120.0); writeTestFile(gcs, coverage, bbox, new int[]{1, 21, 241}); } }
@Test @Category(NeedsCdmUnitTest.class) public void testCrossLongitudeSeam() throws Exception { String filename = TestDir.cdmUnitTestDir + "tds/ncep/GFS_Global_0p5deg_20100913_0000.grib2"; System.out.printf("open %s%n", filename); try (FeatureDatasetCoverage cc = CoverageDatasetFactory.open(filename)) { Assert.assertNotNull(filename, cc); CoverageCollection gcs = cc.findCoverageDataset(FeatureType.GRID); Assert.assertNotNull("gcs", gcs); String gribId = "VAR_2-0-0_L1"; Coverage coverage = gcs.findCoverageByAttribute(Grib.VARIABLE_ID_ATTNAME, gribId); // Land_cover_0__sea_1__land_surface Assert.assertNotNull(gribId, coverage); CoverageCoordSys cs = coverage.getCoordSys(); Assert.assertNotNull("coordSys", cs); System.out.printf(" org coverage shape=%s%n", Misc.showInts(cs.getShape())); HorizCoordSys hcs = cs.getHorizCoordSys(); Assert.assertNotNull("HorizCoordSys", hcs); Assert.assertEquals("rank", 3, cs.getShape().length); LatLonRect bbox = new LatLonRect(new LatLonPointImpl(40.0, -100.0), 10.0, 120.0); checkLatLonSubset(gcs, coverage, bbox, new int[]{1, 21, 241}); } }
@Test @Category(NeedsCdmUnitTest.class) public void testLongitudeSubset() throws Exception { String filename = TestDir.cdmUnitTestDir + "tds/ncep/GFS_Global_onedeg_20100913_0000.grib2"; System.out.printf("open %s%n", filename); try (FeatureDatasetCoverage cc = CoverageDatasetFactory.open(filename)) { Assert.assertNotNull(filename, cc); CoverageCollection gcs = cc.findCoverageDataset(FeatureType.GRID); Assert.assertNotNull("gcs", gcs); String gribId = "VAR_0-3-0_L1"; Coverage coverage = gcs.findCoverageByAttribute(Grib.VARIABLE_ID_ATTNAME, gribId); // "Pressure_Surface"); Assert.assertNotNull(gribId, coverage); CoverageCoordSys cs = coverage.getCoordSys(); Assert.assertNotNull("coordSys", cs); HorizCoordSys hcs = cs.getHorizCoordSys(); Assert.assertNotNull("HorizCoordSys", hcs); Assert.assertEquals("rank", 3, cs.getShape().length); LatLonRect bbox = new LatLonRect(new LatLonPointImpl(40.0, -100.0), 10.0, 20.0); checkLatLonSubset(gcs, coverage, bbox, new int[]{1, 11, 21}); } }
Assert.assertNotNull("gcs", gcs); String gribId = "VAR_3-0-8"; Coverage coverage = gcs.findCoverageByAttribute(Grib.VARIABLE_ID_ATTNAME, gribId); // "Pixel_scene_type"); Assert.assertNotNull(gribId, coverage);