/** Get String with name and attributes. Used in short descriptions like tooltips. * @return name and attributes String */ public String getNameAndAttributes() { Formatter sbuff = new Formatter(); sbuff.format("Structure "); getNameAndDimensions(sbuff, false, true); sbuff.format("%n"); for (Attribute att : attributes) { sbuff.format(" %s:%s;%n",getShortName(), att.toString()); } return sbuff.toString(); }
/** Get String with name and attributes. Used in short descriptions like tooltips. * @return name and attributes String */ public String getNameAndAttributes() { Formatter sbuff = new Formatter(); sbuff.format("Structure "); getNameAndDimensions(sbuff, false, true); sbuff.format("\n"); for (Attribute att : attributes) { sbuff.format(" %s:%s;\n",getShortName(), att.toString()); } return sbuff.toString(); }
/** Get String with name and attributes. Used in short descriptions like tooltips. * @return name and attributes String */ public String getNameAndAttributes() { Formatter sbuff = new Formatter(); sbuff.format("Structure "); getNameAndDimensions(sbuff, false, true); sbuff.format("%n"); for (Attribute att : attributes.getAttributes()) { sbuff.format(" %s:%s;%n",getShortName(), att.toString()); } return sbuff.toString(); }
@Override protected void writeCDL(Formatter buf, Indent indent, boolean useFullName, boolean strict) { buf.format("%n%s%s {%n", indent, dataType); indent.incr(); for (Variable v : members) v.writeCDL(buf, indent, useFullName, strict); indent.decr(); buf.format("%s} ", indent); getNameAndDimensions(buf, useFullName, strict); buf.format(";%s%n", extraInfo()); for (Attribute att : getAttributes()) { buf.format("%s ", indent); if (strict) buf.format( NetcdfFile.makeValidCDLName(getShortName())); buf.format(":"); att.writeCDL(buf, strict); buf.format(";"); if (!strict && (att.getDataType() != DataType.STRING)) buf.format(" // %s", att.getDataType()); buf.format("\n"); } buf.format("\n"); }
@Override protected void writeCDL(Formatter buf, Indent indent, boolean useFullName, boolean strict) { buf.format("%n%s%s {%n", indent, dataType); indent.incr(); for (Variable v : members) v.writeCDL(buf, indent, useFullName, strict); indent.decr(); buf.format("%s} ", indent); getNameAndDimensions(buf, useFullName, strict); buf.format(";%s%n", extraInfo()); for (Attribute att : getAttributes()) { buf.format("%s ", indent); if (strict) buf.format( NetcdfFile.makeValidCDLName(getShortName())); buf.format(":"); att.writeCDL(buf, strict); buf.format(";"); if (!strict && (att.getDataType() != DataType.STRING)) buf.format(" // %s", att.getDataType()); buf.format("%n"); } buf.format("%n"); }
@Override protected void writeCDL(Formatter buf, Indent indent, boolean useFullName, boolean strict) { buf.format("%n%s%s {%n", indent, dataType); indent.incr(); for (Variable v : members) v.writeCDL(buf, indent, useFullName, strict); indent.decr(); buf.format("%s} ", indent); getNameAndDimensions(buf, useFullName, strict); buf.format(";%s%n", extraInfo()); for (Attribute att : getAttributes()) { if(Attribute.isspecial(att)) continue; buf.format(" ", indent); att.writeCDL(buf, strict, getShortName()); buf.format(";"); if(!strict && (att.getDataType() != DataType.STRING)) buf.format(" // %s", att.getDataType()); buf.format("%n"); } buf.format("%n"); }
static private void writeNcMLStructure( Structure s, PrintStream out, Indent indent) throws IOException { out.print(indent); out.print("<structure name='"+ StringUtil2.quoteXmlAttribute(s.getShortName())); // any dimensions? if (s.getRank() > 0) { writeNcMLDimension( s, out); } out.print(">\n"); indent.incr(); List<Attribute> attList = s.getAttributes(); for (Attribute att : attList) { writeNcMLAtt(att, out, indent); } if (attList.size() > 0) out.print("\n"); List<Variable> varList = s.getVariables(); for (Variable v : varList) { writeNcMLVariable(v, out, indent, false); } indent.decr(); out.print(indent); out.print("</structure>\n"); }
private void makeStructureInfo(TableConfig tableConfig, NetcdfDataset ds, Structure parent, Dimension dim) { tableConfig.dimName = dim.getShortName(); if (parent != null) { tableConfig.structureType = TableConfig.StructureType.Structure; tableConfig.structName = parent.getShortName(); } else { boolean hasNetcdf3Struct = Evaluator.hasNetcdf3RecordStructure(ds) && dim.isUnlimited(); tableConfig.structureType = hasNetcdf3Struct ? TableConfig.StructureType.Structure : TableConfig.StructureType.PsuedoStructure; tableConfig.structName = hasNetcdf3Struct ? "record" : dim.getShortName(); } }
private void makeStructureInfo(TableConfig tableConfig, NetcdfDataset ds, Structure parent, Dimension dim) { tableConfig.dimName = dim.getShortName(); if (parent != null) { tableConfig.structureType = TableConfig.StructureType.Structure; tableConfig.structName = parent.getShortName(); } else { boolean hasNetcdf3Struct = Evaluator.hasNetcdf3RecordStructure(ds) && dim.isUnlimited(); tableConfig.structureType = hasNetcdf3Struct ? TableConfig.StructureType.Structure : TableConfig.StructureType.PsuedoStructure; tableConfig.structName = hasNetcdf3Struct ? "record" : dim.getShortName(); } }
static private void writeNcMLStructure(Structure s, Formatter out, Indent indent, WantValues showValues) throws IOException { out.format("%s<structure name='%s", indent, StringUtil2.quoteXmlAttribute(s.getShortName())); // any dimensions? if (s.getRank() > 0) { writeNcMLDimension(s, out); } out.format(">%n"); indent.incr(); List<Attribute> attList = s.getAttributes(); for (Attribute att : attList) { writeNcMLAtt(att, out, indent); } if (attList.size() > 0) out.format("%n"); List<Variable> varList = s.getVariables(); for (Variable v : varList) { writeNcMLVariable(v, out, indent, showValues); } indent.decr(); out.format("%s</structure>%n", indent); }
static private void writeNcMLStructure(Structure s, Formatter out, Indent indent, WantValues showValues) throws IOException { out.format("%s<structure name='%s", indent, StringUtil2.quoteXmlAttribute(s.getShortName())); // any dimensions? if (s.getRank() > 0) { writeNcMLDimension(s, out); } out.format(">%n"); indent.incr(); List<Attribute> attList = s.getAttributes(); for (Attribute att : attList) { writeNcMLAtt(att, out, indent); } if (attList.size() > 0) out.format("%n"); List<Variable> varList = s.getVariables(); for (Variable v : varList) { writeNcMLVariable(v, out, indent, showValues); } indent.decr(); out.format("%s</structure>%n", indent); }
protected TableConfig getPointConfig(NetcdfDataset ds, Formatter errlog) { // the profile values are the inner sequence TableConfig obsTable = new TableConfig(Table.Type.Structure, BufrIosp.obsRecord); Structure obsStruct = (Structure) ds.findVariable(BufrIosp.obsRecord); obsTable.structName = obsStruct.getName(); obsTable.nestedTableName = obsStruct.getShortName(); obsTable.lat = Evaluator.getNameOfVariableWithAttribute(obsStruct, _Coordinate.AxisType, AxisType.Lat.toString()); obsTable.lon = Evaluator.getNameOfVariableWithAttribute(obsStruct, _Coordinate.AxisType, AxisType.Lon.toString()); obsTable.elev = Evaluator.getNameOfVariableWithAttribute(obsStruct, _Coordinate.AxisType, AxisType.Height.toString()); obsTable.time = Evaluator.getNameOfVariableWithAttribute(obsStruct, _Coordinate.AxisType, AxisType.Time.toString()); return obsTable; }
/** * Create a StructureMembers object that describes this Structure. * CAUTION: Do not use for iterating over a StructureData or ArrayStructure - get the StructureMembers object * directly from the StructureData or ArrayStructure. * * @return a StructureMembers object that describes this Structure. */ public StructureMembers makeStructureMembers() { StructureMembers smembers = new StructureMembers( getShortName()); for (Variable v2 : getVariables()) { StructureMembers.Member m = smembers.addMember( v2.getShortName(), v2.getDescription(), v2.getUnitsString(), v2.getDataType(), v2.getShape()); if (v2 instanceof Structure) m.setStructureMembers( ((Structure)v2).makeStructureMembers()); } return smembers; } //protected StructureMembers smembers = null;
/** * Create a StructureMembers object that describes this Structure. * CAUTION: Do not use for iterating over a StructureData or ArrayStructure - get the StructureMembers object * directly from the StructureData or ArrayStructure. * * @return a StructureMembers object that describes this Structure. */ public StructureMembers makeStructureMembers() { StructureMembers smembers = new StructureMembers( getShortName()); for (Variable v2 : getVariables()) { StructureMembers.Member m = smembers.addMember( v2.getShortName(), v2.getDescription(), v2.getUnitsString(), v2.getDataType(), v2.getShape()); if (v2 instanceof Structure) m.setStructureMembers( ((Structure)v2).makeStructureMembers()); } return smembers; } //protected StructureMembers smembers = null;
/** * Create a StructureMembers object that describes this Structure. * CAUTION: Do not use for iterating over a StructureData or ArrayStructure - get the StructureMembers object * directly from the StructureData or ArrayStructure. * * @return a StructureMembers object that describes this Structure. */ public StructureMembers makeStructureMembers() { StructureMembers smembers = new StructureMembers( getShortName()); for (Variable v2 : getVariables()) { StructureMembers.Member m = smembers.addMember( v2.getShortName(), v2.getDescription(), v2.getUnitsString(), v2.getDataType(), v2.getShape()); if (v2 instanceof Structure) m.setStructureMembers( ((Structure)v2).makeStructureMembers()); } return smembers; } //protected StructureMembers smembers = null;
protected TableConfig getTrajectoryConfig(NetcdfDataset ds, Formatter errlog) { TableConfig topTable = new TableConfig(Table.Type.Top, "singleTrajectory"); // the profile values are the inner sequence TableConfig obsTable = new TableConfig(Table.Type.Structure, BufrIosp.obsRecord); Structure obsStruct = (Structure) ds.findVariable(BufrIosp.obsRecord); obsTable.structName = obsStruct.getName(); obsTable.nestedTableName = obsStruct.getShortName(); obsTable.lat = Evaluator.getNameOfVariableWithAttribute(obsStruct, _Coordinate.AxisType, AxisType.Lat.toString()); obsTable.lon = Evaluator.getNameOfVariableWithAttribute(obsStruct, _Coordinate.AxisType, AxisType.Lon.toString()); obsTable.elev = Evaluator.getNameOfVariableWithAttribute(obsStruct, _Coordinate.AxisType, AxisType.Height.toString()); obsTable.time = Evaluator.getNameOfVariableWithAttribute(obsStruct, _Coordinate.AxisType, AxisType.Time.toString()); topTable.addChild(obsTable); return topTable; }
protected TableConfig getProfileConfig(NetcdfDataset ds, Formatter errlog) { // construct the station table by reading through the timeseries TableConfig profileTable = new TableConfig(Table.Type.Structure, "profile"); profileTable.featureType = FeatureType.PROFILE; profileTable.structName = BufrIosp.obsRecord; Structure profileStruct = (Structure) ds.findVariable(BufrIosp.obsRecord); profileTable.lat = Evaluator.getNameOfVariableWithAttribute(profileStruct, _Coordinate.AxisType, AxisType.Lat.toString()); profileTable.lon = Evaluator.getNameOfVariableWithAttribute(profileStruct, _Coordinate.AxisType, AxisType.Lon.toString()); profileTable.time = Evaluator.getNameOfVariableWithAttribute(profileStruct, _Coordinate.AxisType, AxisType.Time.toString()); // the time series is just the outer structure TableConfig obsTable = new TableConfig(Table.Type.NestedStructure, "struct5"); Structure obsStruct = (Structure) profileStruct.findVariable("struct5"); obsTable.structName = obsStruct.getName(); obsTable.nestedTableName = obsStruct.getShortName(); obsTable.elev = Evaluator.getNameOfVariableWithAttribute(obsStruct, _Coordinate.AxisType, AxisType.Pressure.toString()); // HEY not height profileTable.addChild(obsTable); return profileTable; }
static NcStreamProto.Structure.Builder encodeStructure(Structure s) throws IOException { NcStreamProto.Structure.Builder builder = NcStreamProto.Structure.newBuilder(); builder.setName(s.getShortName()); builder.setDataType(encodeDataType(s.getDataType())); for (Dimension dim : s.getDimensions()) builder.addShape(encodeDim(dim)); for (Attribute att : s.getAttributes()) builder.addAtts(encodeAtt(att)); for (Variable v : s.getVariables()) { if (v instanceof Structure) builder.addStructs(NcStream.encodeStructure((Structure) v)); else builder.addVars(NcStream.encodeVar(v, -1)); } return builder; }
static NcStreamProto.Structure.Builder encodeStructure(Structure s) throws IOException { NcStreamProto.Structure.Builder builder = NcStreamProto.Structure.newBuilder(); builder.setName(s.getShortName()); builder.setDataType(encodeDataType(s.getDataType())); for (Dimension dim : s.getDimensions()) builder.addShape(encodeDim(dim)); for (Attribute att : s.getAttributes()) builder.addAtts(encodeAtt(att)); for (Variable v : s.getVariables()) { if (v instanceof Structure) builder.addStructs(NcStream.encodeStructure((Structure) v)); else builder.addVars(NcStream.encodeVar(v, -1)); } return builder; }
static NcStreamProto.Structure.Builder encodeStructure(Structure s) throws IOException { NcStreamProto.Structure.Builder builder = NcStreamProto.Structure.newBuilder(); builder.setName(s.getShortName()); builder.setDataType(convertDataType(s.getDataType())); for (Dimension dim : s.getDimensions()) builder.addShape(encodeDim(dim)); for (Attribute att : s.getAttributes()) builder.addAtts(encodeAtt(att)); for (Variable v : s.getVariables()) { if (v instanceof Structure) builder.addStructs(NcStream.encodeStructure((Structure) v)); else builder.addVars(NcStream.encodeVar(v, -1)); } return builder; }