geoArrayAxes.add(subsetCoordSys.getYAxis()); geoArrayAxes.add(subsetCoordSys.getXAxis()); List<RangeIterator> yxRange = subsetCoordSys.getHorizCoordSys().getRanges(); // may be 2D
@Test @Category(NeedsCdmUnitTest.class) public void testSubsetDt() throws Exception { // try a subset without crossing the seam String filename = TestDir.cdmUnitTestDir + "ft/grid/GFS_Global_onedeg_20081229_1800.grib2.nc"; 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 covName = "Pressure_surface"; Coverage coverage = gcs.findCoverage(covName); Assert.assertNotNull(covName, 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); LatLonRect bbox = new LatLonRect(new LatLonPointImpl(10.0, 40.0), 50.0, 120.0); writeTestFile(gcs, coverage, bbox, new int[]{1, 51, 121}); } }
@Test @Category(NeedsCdmUnitTest.class) public void testCrossLongitudeSeamDt() throws Exception { String filename = TestDir.cdmUnitTestDir + "ft/grid/GFS_Global_onedeg_20081229_1800.grib2.nc"; 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 covName = "Pressure_surface"; Coverage coverage = gcs.findCoverage(covName); Assert.assertNotNull(covName, 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); LatLonRect bbox = new LatLonRect(new LatLonPointImpl(40.0, -100.0), 10.0, 120.0); writeTestFile(gcs, coverage, bbox, new int[]{1, 11, 121}); } }
@Test @Category(NeedsExternalResource.class) public void testCdmRemoteSubset() throws Exception { String filename = "cdmremote:http://thredds-dev.unidata.ucar.edu/thredds/cdmremote/grib/NCEP/NAM/CONUS_40km/conduit/best"; 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 = "Pressure_hybrid"; Coverage coverage = gcs.findCoverage(gribId); Assert.assertNotNull(gribId, coverage); CoverageCoordSys cs = coverage.getCoordSys(); Assert.assertNotNull("coordSys", cs); HorizCoordSys hcs = cs.getHorizCoordSys(); Assert.assertNotNull("HorizCoordSys", hcs); Assert.assertEquals("rank", 4, cs.getShape().length); LatLonRect llbb_subset = new LatLonRect(new LatLonPointImpl(-15, -140), new LatLonPointImpl(55, 30)); System.out.println("subset lat/lon bbox= " + llbb_subset); checkLatLonSubset(gcs, coverage, llbb_subset, new int[]{1, 1, 129, 185}); } }
@Test @Category(NeedsExternalResource.class) public void testDodsSubset() throws Exception { String filename = "dods://thredds.ucar.edu/thredds/dodsC/grib/NCEP/GFS/CONUS_80km/best"; 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 = "Pressure_surface"; Coverage coverage = gcs.findCoverage(gribId); Assert.assertNotNull(gribId, coverage); CoverageCoordSys cs = coverage.getCoordSys(); Assert.assertNotNull("coordSys", cs); HorizCoordSys hcs = cs.getHorizCoordSys(); Assert.assertNotNull("HorizCoordSys", hcs); // Assert.assertArrayEquals(new int[]{65, 361, 720}, cs.getShape()); LatLonRect llbb = gcs.getLatlonBoundingBox(); LatLonRect llbb_subset = new LatLonRect(llbb.getLowerLeftPoint(), 20.0, llbb.getWidth() / 2); checkLatLonSubset(gcs, coverage, llbb_subset, new int[]{1, 35, 46}); } }
@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}); } }
HorizCoordSys hcs = cs.getHorizCoordSys(); Assert.assertNotNull("HorizCoordSys", hcs);
@Test @Category(NeedsCdmUnitTest.class) public void testLatLonSubset() throws Exception { String filename = TestDir.cdmUnitTestDir + "conventions/cf/SUPER-NATIONAL_latlon_IR_20070222_1600.nc"; 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 = "micron11"; Coverage coverage = gcs.findCoverage(gribId); Assert.assertNotNull(gribId, coverage); CoverageCoordSys cs = coverage.getCoordSys(); Assert.assertNotNull("coordSys", cs); HorizCoordSys hcs = cs.getHorizCoordSys(); Assert.assertNotNull("HorizCoordSys", hcs); Assert.assertEquals("rank", 2, cs.getShape().length); LatLonRect bbox = new LatLonRect(new LatLonPointImpl(40.0, -100.0), 10.0, 20.0); checkLatLonSubset(gcs, coverage, bbox, new int[]{141, 281}); bbox = new LatLonRect(new LatLonPointImpl(-40.0, -180.0), 120.0, 300.0); checkLatLonSubset(gcs, coverage, bbox, new int[]{800, 1300}); } }
HorizCoordSys hcs = cs.getHorizCoordSys(); Assert.assertNotNull("HorizCoordSys", hcs);
HorizCoordSys hcs = cs.getHorizCoordSys(); Assert.assertNotNull("HorizCoordSys", hcs); Assert.assertEquals("coordSys", 3, cs.getShape().length);
HorizCoordSys hcs = gridCoordSys.getHorizCoordSys(); Assert.assertNotNull("HorizCoordSys", hcs);
Assert.assertEquals(expected, date); HorizCoordSys hcs = csys.getHorizCoordSys(); CoverageCoordAxis1D xaxis = hcs.getXAxis(); Assert.assertEquals(291, xaxis.getNcoords());