/** * Create a GridDataset from a NetcdfDataset. * * @param ds underlying NetcdfDataset, will do Enhance.CoordSystems if not already done. * @param parseInfo put parse info here, may be null * @throws java.io.IOException on read error */ public GridDataset(NetcdfDataset ds, Formatter parseInfo) throws IOException { this.ds = ds; // ds.enhance(EnumSet.of(NetcdfDataset.Enhance.CoordSystems)); Set<Enhance> enhance = ds.getEnhanceMode(); if(enhance == null || enhance.isEmpty()) enhance = NetcdfDataset.getDefaultEnhanceMode(); ds.enhance(enhance); // look for geoGrids if (parseInfo != null) parseInfo.format("GridDataset look for GeoGrids%n"); List<Variable> vars = ds.getVariables(); for (Variable var : vars) { VariableEnhanced varDS = (VariableEnhanced) var; constructCoordinateSystems(ds, varDS, parseInfo); } }
/** * Create a GridDataset from a NetcdfDataset. * * @param ds underlying NetcdfDataset, will do Enhance.CoordSystems if not already done. * @param parseInfo put parse info here, may be null * @throws java.io.IOException on read error */ public GridDataset(NetcdfDataset ds, Formatter parseInfo) throws IOException { this.ds = ds; // ds.enhance(EnumSet.of(NetcdfDataset.Enhance.CoordSystems)); Set<Enhance> enhance = ds.getEnhanceMode(); if(enhance == null || enhance.isEmpty()) enhance = NetcdfDataset.getDefaultEnhanceMode(); ds.enhance(enhance); // look for geoGrids if (parseInfo != null) parseInfo.format("GridDataset look for GeoGrids\n"); List<Variable> vars = ds.getVariables(); for (Variable var : vars) { VariableEnhanced varDS = (VariableEnhanced) var; constructCoordinateSystems(ds, varDS, parseInfo); } }
/** * Create a GridDataset from a NetcdfDataset. * * @param ncd underlying NetcdfDataset, will do Enhance.CoordSystems if not already done. * @param parseInfo put parse info here, may be null * @throws java.io.IOException on read error */ public GridDataset(NetcdfDataset ncd, Formatter parseInfo) throws IOException { this.ncd = ncd; // ds.enhance(EnumSet.of(NetcdfDataset.Enhance.CoordSystems)); Set<Enhance> enhance = ncd.getEnhanceMode(); if(enhance == null || enhance.isEmpty()) enhance = NetcdfDataset.getDefaultEnhanceMode(); ncd.enhance(enhance); // look for geoGrids if (parseInfo != null) parseInfo.format("GridDataset look for GeoGrids%n"); List<Variable> vars = ncd.getVariables(); for (Variable var : vars) { VariableEnhanced varDS = (VariableEnhanced) var; constructCoordinateSystems(ncd, varDS, parseInfo); } }
private void constructCoordinateSystems(NetcdfDataset ds, VariableEnhanced v, Formatter parseInfo) { if (v instanceof StructureDS) { StructureDS s = (StructureDS) v; List<Variable> members = s.getVariables(); for (Variable nested : members) { // LOOK flatten here ?? constructCoordinateSystems(ds, (VariableEnhanced) nested, parseInfo); } } else { // see if it has a GridCS // LOOK: should add geogrid it multiple times if there are multiple geoCS ?? GridCoordSys gcs = null; List<CoordinateSystem> csys = v.getCoordinateSystems(); for (CoordinateSystem cs : csys) { GridCoordSys gcsTry = GridCoordSys.makeGridCoordSys(parseInfo, cs, v); if (gcsTry != null) { gcs = gcsTry; if (gcsTry.isProductSet()) break; } } if (gcs != null) addGeoGrid((VariableDS) v, gcs, parseInfo); } }
private void constructCoordinateSystems(NetcdfDataset ds, VariableEnhanced v, Formatter parseInfo) { if (v instanceof StructureDS) { StructureDS s = (StructureDS) v; List<Variable> members = s.getVariables(); for (Variable nested : members) { // LOOK flatten here ?? constructCoordinateSystems(ds, (VariableEnhanced) nested, parseInfo); } } else { // see if it has a GridCS // LOOK: should add geogrid it multiple times if there are multiple geoCS ?? GridCoordSys gcs = null; List<CoordinateSystem> csys = v.getCoordinateSystems(); for (CoordinateSystem cs : csys) { GridCoordSys gcsTry = GridCoordSys.makeGridCoordSys(parseInfo, cs, v); if (gcsTry != null) { gcs = gcsTry; if (gcsTry.isProductSet()) break; } } if (gcs != null) addGeoGrid((VariableDS) v, gcs, parseInfo); } }
private void constructCoordinateSystems(NetcdfDataset ds, VariableEnhanced v, Formatter parseInfo) { if (v instanceof StructureDS) { StructureDS s = (StructureDS) v; List<Variable> members = s.getVariables(); for (Variable nested : members) { // LOOK flatten here ?? constructCoordinateSystems(ds, (VariableEnhanced) nested, parseInfo); } } else { // see if it has a GridCS // LOOK: should add geogrid it multiple times if there are multiple geoCS ?? GridCoordSys gcs = null; List<CoordinateSystem> csys = v.getCoordinateSystems(); for (CoordinateSystem cs : csys) { GridCoordSys gcsTry = GridCoordSys.makeGridCoordSys(parseInfo, cs, v); if (gcsTry != null) { gcs = gcsTry; if (gcsTry.isProductSet()) break; } } if (gcs != null) addGeoGrid((VariableDS) v, gcs, parseInfo); } }