@Test public void testGetPolygonGeometryType() throws IOException { SimpleGeometryReader rdr = openReaderOverFile("hru_soil_moist_3hru_5timestep.nc"); Assert.assertEquals(GeometryType.POLYGON, rdr.getGeometryType("hru_soil_moist")); }
public GeometryType getGeometryType(String name) { Variable geometryVar = ds.findVariable(name); if (geometryVar == null) return null; if (ds.findGlobalAttribute(CF.CONVENTIONS) != null) if (CF1Convention.getVersion(ds.findGlobalAttribute(CF.CONVENTIONS).getStringValue()) >= 8) { Attribute geometryTypeAttr; String geometry_type; geometryTypeAttr = geometryVar.findAttribute(CF.GEOMETRY_TYPE); if (geometryTypeAttr == null) return null; geometry_type = geometryTypeAttr.getStringValue(); switch (geometry_type) { case CF.POLYGON: return GeometryType.POLYGON; case CF.LINE: return GeometryType.LINE; case CF.POINT: return GeometryType.POINT; default: return null; } } return null; }
SimpleGeometryReader { public GeometryType getGeometryType(String name) { Variable geometryVar = ds.findVariable(name); if (geometryVar == null) return null; if (ds.findGlobalAttribute(CF.CONVENTIONS) != null) if (CF1Convention.getVersion(ds.findGlobalAttribute(CF.CONVENTIONS).getStringValue()) >= 8) { Attribute geometryTypeAttr; String geometry_type; geometryTypeAttr = geometryVar.findAttribute(CF.GEOMETRY_TYPE); if (geometryTypeAttr == null) return null; geometry_type = geometryTypeAttr.getStringValue(); switch (geometry_type) { case CF.POLYGON: return GeometryType.POLYGON; case CF.LINE: return GeometryType.LINE; case CF.POINT: return GeometryType.POINT; default: return null; } } return null; } }
SimpleGeometryReader { public GeometryType getGeometryType(String name) { Variable geometryVar = ds.findVariable(name); if (geometryVar == null) return null; if (ds.findGlobalAttribute(CF.CONVENTIONS) != null) if (CF1Convention.getVersion(ds.findGlobalAttribute(CF.CONVENTIONS).getStringValue()) >= 8) { Attribute geometryTypeAttr; String geometry_type; geometryTypeAttr = geometryVar.findAttribute(CF.GEOMETRY_TYPE); if (geometryTypeAttr == null) return null; geometry_type = geometryTypeAttr.getStringValue(); switch (geometry_type) { case CF.POLYGON: return GeometryType.POLYGON; case CF.LINE: return GeometryType.LINE; case CF.POINT: return GeometryType.POINT; default: return null; } } return null; } SimpleGeometryReader(NetcdfDataset ds); }
SimpleGeometryReader { public GeometryType getGeometryType(String name) { Variable geometryVar = ds.findVariable(name); if (geometryVar == null) return null; if (ds.findGlobalAttribute(CF.CONVENTIONS) != null) if (CF1Convention.getVersion(ds.findGlobalAttribute(CF.CONVENTIONS).getStringValue()) >= 8) { Attribute geometryTypeAttr; String geometry_type; geometryTypeAttr = geometryVar.findAttribute(CF.GEOMETRY_TYPE); if (geometryTypeAttr == null) return null; geometry_type = geometryTypeAttr.getStringValue(); switch (geometry_type) { case CF.POLYGON: return GeometryType.POLYGON; case CF.LINE: return GeometryType.LINE; case CF.POINT: return GeometryType.POINT; default: return null; } } return null; } 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 GeometryType getGeometryType(String name) { Variable geometryVar = ds.findVariable(name); if (geometryVar == null) return null; if (ds.findGlobalAttribute(CF.CONVENTIONS) != null) if (CF1Convention.getVersion(ds.findGlobalAttribute(CF.CONVENTIONS).getStringValue()) >= 8) { Attribute geometryTypeAttr; String geometry_type; geometryTypeAttr = geometryVar.findAttribute(CF.GEOMETRY_TYPE); if (geometryTypeAttr == null) return null; geometry_type = geometryTypeAttr.getStringValue(); switch (geometry_type) { case CF.POLYGON: return GeometryType.POLYGON; case CF.LINE: return GeometryType.LINE; case CF.POINT: return GeometryType.POINT; default: return null; } } return null; } 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);  }