static public BufrTableLookup factory(Message m) throws IOException { return new BufrTableLookup(m.is.getBufrEdition(), m.ids.getCenterId(), m.ids.getSubCenterId(), m.ids.getMasterTableId(), m.ids.getMasterTableVersion(), m.ids.getLocalTableVersion(), m.ids.getCategory(), m.ids.getSubCategory(), m.ids.getLocalSubCategory()); }
private ArrayStructure readMessage(Message m) throws IOException { ArrayStructure as; if (m.dds.isCompressed()) { MessageCompressedDataReader reader = new MessageCompressedDataReader(); as = reader.readEntireMessage(obsStructure, protoMessage, m, raf, null); } else { MessageUncompressedDataReader reader = new MessageUncompressedDataReader(); as = reader.readEntireMessage(obsStructure, protoMessage, m, raf, null); } return as; }
private void setStandardActions(FieldConverter fld) { fld.setAction(fld.makeAction()); if (fld.flds == null) return; for (FieldConverter child : fld.flds) setStandardActions(child); }
public void dumpHeader(Formatter out) { out.format(" BUFR edition %d time= %s wmoHeader=%s %n", is.getBufrEdition(), getReferenceTime(), getHeader()); out.format(" Category= %d %s %s %n", lookup.getCategory(), lookup.getCategoryName(), lookup.getCategoryNo()); out.format(" Center= %s %s %n", lookup.getCenterName(), lookup.getCenterNo()); out.format(" Table= %d.%d local= %d wmoTables= %s,%s localTables= %s,%s %n", ids.getMasterTableId(), ids.getMasterTableVersion(), ids.getLocalTableVersion(), lookup.getWmoTableBName(), lookup.getWmoTableDName(), lookup.getLocalTableBName(), lookup.getLocalTableDName()); out.format(" DDS nsubsets=%d type=0x%x isObs=%b isCompressed=%b%n", dds.getNumberDatasets(), dds.getDataType(), dds.isObserved(), dds.isCompressed()); }
public void dumpHeader(Formatter out) { out.format(" BUFR edition %d time= %s wmoHeader=%s %n", is.getBufrEdition(), getReferenceTime(), getHeader()); out.format(" Category= %d %s %s %n", ids.getCategory(), getCategoryName(), getCategoryNo()); out.format(" Center= %s %s %n", getCenterName(), getCenterNo()); out.format(" Table= %d.%d local= %d wmoTables= %s,%s localTables= %s,%s %n", ids.getMasterTableId(), ids.getMasterTableVersion(), ids.getLocalTableVersion(), lookup.getWmoTableBName(),lookup.getWmoTableDName(),lookup.getLocalTableBName(),lookup.getLocalTableDName()); out.format(" DDS nsubsets=%d type=0x%x isObs=%b isCompressed=%b\n", dds.getNumberDatasets(), dds.getDataType(), dds.isObserved(), dds.isCompressed()); }
private int readData(Message m, RandomAccessFile raf, Formatter f, Request req) throws IOException { BitReader reader = new BitReader(raf, m.dataSection.getDataPos() + 4); DataDescriptor root = m.getRootDataDescriptor(); if (root.isBad) return 0; DebugOut out = (f == null) ? null : new DebugOut(f); BitCounterCompressed[] counterFlds = new BitCounterCompressed[root.subKeys.size()]; // one for each field readData(out, reader, counterFlds, root, 0, m.getNumberDatasets(), req); m.msg_nbits = 0; for (BitCounterCompressed counter : counterFlds) if (counter != null) m.msg_nbits += counter.getTotalBits(); return m.msg_nbits; }
public void dumpHeaderShort(Formatter out) { out.format(" %s, Cat= %s, Center= %s (%s), Table= %d.%d.%d %n", getHeader(), lookup.getCategoryName(), lookup.getCenterName(), lookup.getCenterNo(), ids.getMasterTableId(), ids.getMasterTableVersion(), ids.getLocalTableVersion()); }
public int calcTotalBits(Formatter out) { try { if (!dds.isCompressed()) { MessageUncompressedDataReader reader = new MessageUncompressedDataReader(); reader.readData(null, this, raf, null, false, out); } else { MessageCompressedDataReader reader = new MessageCompressedDataReader(); reader.readData(null, this, raf, null, out); } } catch (IOException ioe) { return 0; } return msg_nbits; }
public Message getFirstDataMessage() throws IOException { while (hasNext()) { Message m = next(); if (m == null) continue; if (m.containsBufrTable()) continue; // not data if (m.getNumberDatasets() == 0) continue; // empty return m; } return null; }
public TableLookup getTableLookup() throws IOException { while (hasNext()) { next(); } return (embedTable != null) ? embedTable.getTableLookup() : null; }
private boolean usesLocalTable(DataDescriptor dds) throws IOException { for (DataDescriptor key : dds.getSubKeys()) { if (key.isLocal()) return true; if ((key.getSubKeys() != null) && usesLocalTable(key)) return true; } return false; }
private byte[] readCharData(DataDescriptor dkey, BitReader reader, Request req) throws IOException { int nchars = dkey.getByteWidthCDM(); byte[] b = new byte[nchars]; for (int i = 0; i < nchars; i++) b[i] = (byte) reader.bits2UInt(8); if (req.wantRow()) { for (int i = 0; i < nchars; i++) req.bb.put(b[i]); } return b; }
public int getDDShashcode() { root = getRootDataDescriptor(); return root.hashCode2(); }
/** * Check if this message contains a BUFR table * * @return true if message contains a BUFR table * @throws IOException on read error */ public boolean containsBufrTable() throws IOException { for (Short key : dds.getDataDescriptors()) { if (Descriptor.isBufrTable(key)) return true; } return false; }
public void showMissingFields(Formatter out) throws IOException { lookup.showMissingFields(dds.getDataDescriptors(), out); }
TableLookup getTableLookup() throws IOException { if (!tableRead) { read2(); tableRead = true; tlookup = new TableLookup(ids, b, d); } return tlookup; }
@Override public StructureDataIterator getStructureIterator(Structure s, int bufferSize) throws java.io.IOException { return isSingle ? new SeqIterSingle() : new SeqIter(); }
private int readData(Message m, RandomAccessFile raf, Formatter f, Request req) throws IOException { BitReader reader = new BitReader(raf, m.dataSection.getDataPos() + 4); DataDescriptor root = m.getRootDataDescriptor(); if (root.isBad) return 0; DebugOut out = (f == null) ? null : new DebugOut(f); BitCounterCompressed[] counterFlds = new BitCounterCompressed[root.subKeys.size()]; // one for each field LOOK why not m.counterFlds ? readData(out, reader, counterFlds, root, 0, m.getNumberDatasets(), req); m.msg_nbits = 0; for (BitCounterCompressed counter : counterFlds) if (counter != null) m.msg_nbits += counter.getTotalBits(); return m.msg_nbits; }
private StructureDataIterator readProtoMessage() throws IOException { Message m = protoMessage; ArrayStructure as; if (m.dds.isCompressed()) { MessageCompressedDataReader reader = new MessageCompressedDataReader(); as = reader.readEntireMessage(obsStructure, protoMessage, m, raf, null); } else { MessageUncompressedDataReader reader = new MessageUncompressedDataReader(); as = reader.readEntireMessage(obsStructure, protoMessage, m, raf, null); } return as.getStructureDataIterator(); }
private boolean usesLocalTable(DataDescriptor dds) throws IOException { for (DataDescriptor key : dds.getSubKeys()) { if (key.isLocal()) return true; if ((key.getSubKeys() != null) && usesLocalTable(key)) return true; } return false; }