/** Set the list of member variables. * @param vars this is the list of member variables */ public void setMemberVariables( List<Variable> vars) { if (isImmutable()) throw new IllegalStateException("Cant modify"); members = new ArrayList<>(); memberHash = new HashMap<>(2*vars.size()); for (Variable v : vars) { addMemberVariable(v); } }
/** Set the list of member variables. * @param vars this is the list of member variables */ public void setMemberVariables( List<Variable> vars) { if (isImmutable()) throw new IllegalStateException("Cant modify"); members = new ArrayList<>(); memberHash = new HashMap<>(2*vars.size()); for (Variable v : vars) { addMemberVariable(v); } }
private void addMembersToStructure(Group g, Structure s, Vinfo parentVinfo, MessageDatatype mdt) throws IOException { for (StructureMember m : mdt.members) { Variable v = makeVariableMember(g, s, m.name, m.offset, m.mdt); if (v != null) { s.addMemberVariable(v); if (debug1) debugOut.println(" made Member Variable " + v.getFullName() + "\n" + v); } } }
private void addMembersToStructure(Group g, Structure s, Vinfo parentVinfo, MessageDatatype mdt) throws IOException { for (StructureMember m : mdt.members) { Variable v = makeVariableMember(g, s, m.name, m.offset, m.mdt); if (v != null) { s.addMemberVariable(v); if (debug1) debugOut.println(" made Member Variable " + v.getFullName() + "\n" + v); } } }
private void addMembersToStructure(Group g, Structure s, Vinfo parentVinfo, MessageDatatype mdt) throws IOException { for (StructureMember m : mdt.members) { Variable v = makeVariableMember(g, s, m.name, m.offset, m.mdt); if (v != null) { s.addMemberVariable(v); if (debug1) { log.debug(" made Member Variable " + v.getFullName() + "\n" + v); } } } }
public Variable addStructureMember(Structure s, String shortName, DataType dtype, String dims) { if (!defineMode) throw new UnsupportedOperationException("not in define mode"); shortName = makeValidObjectName(shortName); if (!version.isExtendedModel()) throw new IllegalArgumentException("Structure type only supported in extended model, version="+version); Variable m = new Variable(ncfile, null, s, shortName, dtype, dims); return s.addMemberVariable(m); }
private int makeInnerSequence(Structure reportVar, List<Record> records, int code, int obs_pos) throws InvalidRangeException { for (Record record : records) { if (record.code == code) { Entry first = record.entries[0]; Structure s = first.makeStructure(reportVar); s.setSPobject(new Vinfo(obs_pos)); obs_pos += 4; reportVar.addMemberVariable(s); catStructures.add(new StructureCode(s, code)); break; } } return obs_pos; }
private int makeInnerSequence(Structure reportVar, List<Record> records, int code, int obs_pos) throws InvalidRangeException { for (Record record : records) { if (record.code == code) { Entry first = record.entries[0]; Structure s = first.makeStructure(reportVar); s.setSPobject(new Vinfo(obs_pos)); obs_pos += 4; reportVar.addMemberVariable(s); catStructures.add(new StructureCode(s, code)); break; } } return obs_pos; }
public Variable addStructureMember(Structure s, String shortName, DataType dtype, String dims) { if (!defineMode) throw new UnsupportedOperationException("not in define mode"); shortName = makeValidObjectName(shortName); if (!version.isExtendedModel()) throw new IllegalArgumentException("Structure type only supported in extended model, version="+version); Variable m = new Variable(ncfile, null, s, shortName, dtype, dims); // LOOK: What if dtype == STRUCTURE? s.addMemberVariable(m); // We've added a member to s. Recalculate its size and all ancestor structure sizes. for (Structure struct = s; struct != null; struct = struct.getParentStructure()) { struct.calcElementSize(); } return m; }
private int makeInnerSequence(Structure reportVar, List<Record> records, int code, int obs_pos) throws InvalidRangeException { for (Record record : records) { if (record.code == code) { Entry first = record.entries[0]; Structure s = first.makeStructure(reportVar); s.setSPobject(new Vinfo(obs_pos)); obs_pos += 4; reportVar.addMemberVariable(s); catStructures.add(new StructureCode(s, code)); break; } } return obs_pos; }
private void addStructure(Structure parent, DataDescriptor dataDesc, int count) { String structName = "struct" + structNum; structNum++; Structure struct = new Structure(ncfile, null, parent, structName); try { struct.setDimensionsAnonymous(new int[]{count}); // anon vector } catch (InvalidRangeException e) { log.error("illegal count= " + count + " for " + dataDesc); } for (DataDescriptor subKey : dataDesc.getSubKeys()) addMember(struct, subKey); parent.addMemberVariable(struct); struct.setSPobject(dataDesc); dataDesc.name = structName; dataDesc.refersTo = struct; }
private void addSequence(Structure parent, DataDescriptor dataDesc) { //String seqName = ftype == (FeatureType.STATION_PROFILE) ? "profile" : "seq"; String seqName = "seq" + seqNum; seqNum++; Sequence seq = new Sequence(ncfile, null, parent, seqName); seq.setDimensions(""); // scalar for (DataDescriptor dkey : dataDesc.getSubKeys()) addMember(seq, dkey); parent.addMemberVariable(seq); seq.setSPobject(dataDesc); dataDesc.name = seqName; dataDesc.refersTo = seq; }
Variable addVariable(Group parentGroup, Structure parentStructure, DodsV dodsV) throws IOException { Variable v = makeVariable(parentGroup, parentStructure, dodsV); if (v != null) { addAttributes(v, dodsV); if (parentStructure != null) parentStructure.addMemberVariable(v); else { parentGroup = computeGroup(v.getDODSName(), v, parentGroup); parentGroup.addVariable(v); } dodsV.isDone = true; } return v; }
private void addSequence(Structure parent, BufrConfig.FieldConverter fld) { DataDescriptor dkey = fld.dds; String uname = findUniqueName(parent, fld.getName(), "seq"); dkey.name = uname; // name may need to be changed for uniqueness //String seqName = ftype == (FeatureType.STATION_PROFILE) ? "profile" : "seq"; //String seqName = dataDesc.name != null ? dataDesc.name : "seq" + seqNum++; Sequence seq = new Sequence(ncfile, null, parent, uname); seq.setDimensions(""); // scalar for (BufrConfig.FieldConverter subKey : fld.flds) addMember(seq, subKey); parent.addMemberVariable(seq); seq.setSPobject(fld); dkey.refersTo = seq; }
private Structure makeReportIndexStructure() throws IOException { Structure reportIndex = new Structure(ncfile, null, null, BufrIosp.obsIndex); ncfile.addVariable(null, reportIndex); reportIndex.setDimensions("record"); reportIndex.addAttribute(new Attribute("long_name", "index on report")); Variable v = reportIndex.addMemberVariable(new Variable(ncfile, null, reportIndex, "name", DataType.STRING, "")); v.addAttribute(new Attribute("long_name", "name of station")); v.addAttribute(new Attribute("standard_name", "station_name")); v = reportIndex.addMemberVariable(new Variable(ncfile, null, reportIndex, "time", DataType.LONG, "")); v.addAttribute(new Attribute("units", "msecs since 1970-01-01 00:00")); v.addAttribute(new Attribute("long_name", "observation time")); v.addAttribute(new Attribute(_Coordinate.AxisType, "Time")); return reportIndex; }
private Variable makeMember(Structure s, String shortName, DataType dataType, String dims, String longName, String units, String cfName, AxisType atype) { Variable v = new Variable(ncfile, null, s, shortName, dataType, dims); v.addAttribute(new Attribute(CDM.LONG_NAME, longName)); if (cfName != null) v.addAttribute(new Attribute(CF.STANDARD_NAME, cfName)); if (units != null) v.addAttribute(new Attribute(CDM.UNITS, units)); if (atype != null) v.addAttribute(new Attribute(_Coordinate.AxisType, atype.toString())); s.addMemberVariable(v); return v; }
private Variable makeMember(Structure s, String shortName, DataType dataType, String dims, String longName, String units, String cfName, AxisType atype) { Variable v = new Variable(ncfile, null, s, shortName, dataType, dims); v.addAttribute(new Attribute(CDM.LONG_NAME, longName)); if (cfName != null) v.addAttribute(new Attribute(CF.STANDARD_NAME, cfName)); if (units != null) v.addAttribute(new Attribute(CDM.UNITS, units)); if (atype != null) v.addAttribute(new Attribute(_Coordinate.AxisType, atype.toString())); s.addMemberVariable(v); return v; }
private Variable makeMember(Structure s, String shortName, DataType dataType, String dims, String longName, String units, String cfName, AxisType atype) { Variable v = new Variable(ncfile, null, s, shortName, dataType, dims); v.addAttribute(new Attribute(CDM.LONG_NAME, longName)); if (cfName != null) v.addAttribute(new Attribute(CF.STANDARD_NAME, cfName)); if (units != null) v.addAttribute(new Attribute(CDM.UNITS, units)); if (atype != null) v.addAttribute(new Attribute(_Coordinate.AxisType, atype.toString())); s.addMemberVariable(v); return v; }
private Structure makeReportIndexStructure() throws InvalidRangeException, IOException { Structure reportIndex = new Structure(ncfile, null, null, "reportIndex"); reportIndex.setDimensions("report"); reportIndex.addAttribute(new Attribute(CDM.LONG_NAME, "index on report - in memory")); int pos = 0; Variable v = reportIndex.addMemberVariable(new Variable(ncfile, null, reportIndex, "stationName", DataType.CHAR, "")); v.setDimensionsAnonymous(new int[]{6}); v.addAttribute(new Attribute(CDM.LONG_NAME, "name of station")); v.addAttribute(new Attribute("standard_name", "station_name")); v.setSPobject(new Vinfo(pos)); pos += 6; v = reportIndex.addMemberVariable(new Variable(ncfile, null, reportIndex, "time", DataType.INT, "")); v.addAttribute(new Attribute(CDM.UNITS, "secs since 1970-01-01 00:00")); v.addAttribute(new Attribute(CDM.LONG_NAME, "observation time")); v.setSPobject(new Vinfo(pos)); return reportIndex; }
private Structure makeReportIndexStructure() throws InvalidRangeException, IOException { Structure reportIndex = new Structure(ncfile, null, null, "reportIndex"); reportIndex.setDimensions("report"); reportIndex.addAttribute(new Attribute(CDM.LONG_NAME, "index on report - in memory")); int pos = 0; Variable v = reportIndex.addMemberVariable(new Variable(ncfile, null, reportIndex, "stationName", DataType.CHAR, "")); v.setDimensionsAnonymous(new int[]{6}); v.addAttribute(new Attribute(CDM.LONG_NAME, "name of station")); v.addAttribute(new Attribute("standard_name", "station_name")); v.setSPobject(new Vinfo(pos)); pos += 6; v = reportIndex.addMemberVariable(new Variable(ncfile, null, reportIndex, "time", DataType.INT, "")); v.addAttribute(new Attribute(CDM.UNITS, "secs since 1970-01-01 00:00")); v.addAttribute(new Attribute(CDM.LONG_NAME, "observation time")); v.setSPobject(new Vinfo(pos)); return reportIndex; }