The BUFR format allows multiple messages in a single file. In this case the TLcdBUFRModelDecoder creates a data model for each message and returns a TLcdModelTreeNode that contains all of the data models that were created. You can iterate over all of the data models in the model tree node and find the specific ones you are looking for by inspecting each model’s element types, through the getModelElementTypes method on the model’s ILcdDataModelDescriptor.

Program: Finding a specific data model in a BUFR file that contains multiple messages
String source = "Data/Bufr/sigwx.bufr";

// decode the model
TLcdBUFRModelDecoder decoder = new TLcdBUFRModelDecoder();
ILcdModel model = decoder.decode(source);
if (model instanceof TLcdModelTreeNode) {
  // find a child model of type cloud
  TLcdModelTreeNode treeModel = (TLcdModelTreeNode)model;
  Enumeration treeModelEnumeration = treeModel.models();
  while(treeModelEnumeration.hasMoreElements()) {
    ILcdModel childModel = (ILcdModel)treeModelEnumeration.nextElement();
    Set<TLcdDataType> modelElementTypes = ((ILcdDataModelDescriptor) childModel.getModelDescriptor()).getModelElementTypes();
    if (modelElementTypes.contains(SIGWX_CLOUD_TYPE)) {
      return childModel;
return model;