@Test public void testReaderPolygonsMultiPolygons() throws IOException { double err = 0.01; SimpleGeometryReader rdr = openReaderOverFile("hru_soil_moist_3hru_5timestep.nc"); Polygon poly = rdr.readPolygon("hru_soil_moist", 0); Polygon poly2 = rdr.readPolygon("hru_soil_moist", 1); Polygon poly3 = rdr.readPolygon("hru_soil_moist", 2); Assert.assertEquals(6233, poly.getPoints().size()); Assert.assertEquals(5, poly2.getPoints().size()); Assert.assertEquals(6033, poly2.getNext().getPoints().size()); Assert.assertEquals(5135, poly3.getPoints().size()); Assert.assertEquals(1.28, poly.getData().getDouble(2), err); Assert.assertEquals(1.52, poly2.getData().getDouble(3), err); Assert.assertEquals(1.36, poly3.getData().getDouble(0), err); }
public Polygon readPolygon(String name, int index) { Variable polyvar = ds.findVariable(name); if (polyvar == null) return null; Polygon poly = null; if (ds.findGlobalAttribute(CF.CONVENTIONS) != null) if (CF1Convention.getVersion(ds.findGlobalAttribute(CF.CONVENTIONS).getStringValue()) >= 8) poly = new CFPolygon(); if (poly == null) return null; else return poly.setupPolygon(ds, polyvar, index); }
SimpleGeometryReader { public Polygon readPolygon(String name, int index) { Variable polyvar = ds.findVariable(name); if (polyvar == null) return null; Polygon poly = null; if (ds.findGlobalAttribute(CF.CONVENTIONS) != null) if (CF1Convention.getVersion(ds.findGlobalAttribute(CF.CONVENTIONS).getStringValue()) >= 8) poly = new CFPolygon(); if (poly == null) return null; else return poly.setupPolygon(ds, polyvar, index); } }
SimpleGeometryReader { public Polygon readPolygon(String name, int index) { Variable polyvar = ds.findVariable(name); if (polyvar == null) return null; Polygon poly = null; if (ds.findGlobalAttribute(CF.CONVENTIONS) != null) if (CF1Convention.getVersion(ds.findGlobalAttribute(CF.CONVENTIONS).getStringValue()) >= 8) poly = new CFPolygon(); if (poly == null) return null; else return poly.setupPolygon(ds, polyvar, index); } SimpleGeometryReader(NetcdfDataset ds); }
SimpleGeometryReader { public Polygon readPolygon(String name, int index) { Variable polyvar = ds.findVariable(name); if (polyvar == null) return null; Polygon poly = null; if (ds.findGlobalAttribute(CF.CONVENTIONS) != null) if (CF1Convention.getVersion(ds.findGlobalAttribute(CF.CONVENTIONS).getStringValue()) >= 8) poly = new CFPolygon(); if (poly == null) return null; else return poly.setupPolygon(ds, polyvar, index); } SimpleGeometryReader(NetcdfDataset ds); Polygon readPolygon(String name, int index); Line readLine(String name, int index); Point readPoint(String name, int index); GeometryType getGeometryType(String name); }
SimpleGeometryReader { public Polygon readPolygon(String name, int index) { Variable polyvar = ds.findVariable(name); if (polyvar == null) return null; Polygon poly = null; if (ds.findGlobalAttribute(CF.CONVENTIONS) != null) if (CF1Convention.getVersion(ds.findGlobalAttribute(CF.CONVENTIONS).getStringValue()) >= 8) poly = new CFPolygon(); if (poly == null) return null; else return poly.setupPolygon(ds, polyvar, index); } SimpleGeometryReader(NetcdfDataset ds); Polygon readPolygon(String name, int index); Line readLine(String name, int index); Point readPoint(String name, int index); GeometryType getGeometryType(String name);  }