Class TLcdGRIBBulletinModelDecoder

java.lang.Object
com.luciad.format.grib.TLcdGRIBBulletinModelDecoder
All Implemented Interfaces:
ILcdInputStreamFactoryCapable, ILcdModelDecoder

@Deprecated public class TLcdGRIBBulletinModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
Deprecated.
TLcdNetCDFModelDecoder can be used instead.
This ILcdModelDecoder decodes GRIB bulletin files containing multiple GRIB messages.

The GRIB messages in GRIB bulletins can optionally have headers, as defined by the WMO. A WMO header contains the following information about its corresponding message:

  • a GRIB indicator (always 'H' for GRIB data),
  • a component indicator (wind, temperature, humidity,...),
  • an area indicator (octant of the world),
  • a forecast indicator (number of hours in the future), and
  • a pressure level indicator (between 850 and 100 hPa, corresponding to FL 50 and 530).

Individual GRIB messages can be filtered before being decoded, based on their WMO headers, or after having been decoded, based on the decoded GRIB model descriptors; see setGRIBBulletinHeaderFilter(ILcdGRIBBulletinHeaderFilter) and setGRIBBulletinFilter(ILcdGRIBBulletinFilter).

The decoded model is a TLcd2DBoundsIndexedModelList (or optionally an ILcdModelTreeNode) containing an ILcdModel for each GRIB message in the bulletin. The contained GRIB messages are decoded with the TLcdGRIBModelDecoder. Each message is therefore represented by an ILcdModel with a TLcdGRIBModelDescriptor. In the case of GRIB2 messages containing multiple datasets, this model will be an ILcdModelContainer that contains multiple models. For messages containing a single dataset, the model will contain one ILcdRaster with one ILcdTile.

The ILcdModelDescriptor of the decoded model is a TLcdGRIBBulletinModelDescriptor.

Since:
7.0.17
  • Constructor Details

    • TLcdGRIBBulletinModelDecoder

      public TLcdGRIBBulletinModelDecoder()
      Deprecated.
      Creates a new TLcdGRIBBulletinModelDecoder, with a globally shared buffer for caching tiles.
      See Also:
    • TLcdGRIBBulletinModelDecoder

      public TLcdGRIBBulletinModelDecoder(ILcdBuffer aBuffer)
      Deprecated.
      Creates a new TLcdGRIBBulletinModelDecoder.
      Parameters:
      aBuffer - the shared buffer that decoded GRIB models will use.
      See Also:
  • Method Details

    • setClassTraceOn

      public static void setClassTraceOn(boolean aClassTraceOn)
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Enables tracing for all instances of this class. If the argument is true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
      Parameters:
      aClassTraceOn - if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
    • setTraceOn

      public void setTraceOn(boolean aTraceOn)
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Enables tracing for this class instance. Calling this method with either true or false as argument automatically turns off tracing for all other class instances for which setTraceOn has not been called. If the argument is false then only the informative, warning and error log messages are recorded.
      Parameters:
      aTraceOn - if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
    • isTraceOn

      public boolean isTraceOn()
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Returns true if tracing is enabled for this class.
      Returns:
      true if tracing is enabled for this class, false otherwise.
    • setInputStreamFactory

      public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
      Deprecated.
      Sets the input stream factory that is used for creating input streams given source names.
      Specified by:
      setInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Parameters:
      aInputStreamFactory - The input stream factory to be used.
      See Also:
    • getInputStreamFactory

      public ILcdInputStreamFactory getInputStreamFactory()
      Deprecated.
      Returns the input stream factory that is used for creating input streams given source names.
      Specified by:
      getInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Returns:
      The input stream factory to be used.
      See Also:
    • addParameterTable

      public void addParameterTable(ILcdGRIBParameterTable aParameterTable)
      Deprecated.
      Adds a parameter table. If a table with the same version, center ID, and subcenter ID already exists, it will be replaced.

      The decoder will first try to use the parameter table with a matching table version, center ID, and subcenter ID. If it can't find it, it it will fall back on the parameter table that only matches the table version.

      Parameters:
      aParameterTable - the parameter table to add.
      See Also:
    • addParameterTable

      public void addParameterTable(ILcdGRIBParameterTable aParameterTable, boolean aMatchCenter)
      Deprecated.
      Adds a parameter table. If a table with the same version, center ID, and subcenter ID already exists, it will be replaced.

      The decoder will first try to use the parameter table with a matching table version, center ID, and subcenter ID. If it can't find it, it it will fall back on the parameter table that only matches the table version, if non-exact matches are allowed.

      Parameters:
      aParameterTable - the parameter table to add.
      aMatchCenter - a boolean flag that indicates if the center ID and subcenter ID have to match in order for this table to be used.
      See Also:
    • removeParameterTable

      public void removeParameterTable(ILcdGRIBParameterTable aParameterTable)
      Deprecated.
      Removes a parameter table.
      Parameters:
      aParameterTable - the parameter table to remove.
      See Also:
    • setColorModel

      public void setColorModel(ColorModel aColorModel)
      Deprecated.
      Sets the color model that is attached by default to the decoded rasters. The default is null.
      Parameters:
      aColorModel - an 8-bit or 16-bit IndexColorModel that is compatible with the GRIB data to be decoded.
      See Also:
    • getColorModel

      public ColorModel getColorModel()
      Deprecated.
      Returns the color model that is attached by default to the decoded rasters.
      Returns:
      The default color model used for decoded rasters.
      See Also:
    • setSampleStrategy

      public void setSampleStrategy(int aSampleStrategy)
      Deprecated.
      Sets the sampling strategy that is used for displaying raster data.
      Parameters:
      aSampleStrategy - one of TLcdGRIBModelDecoder.NORTH_WEST_CORNER, TLcdGRIBModelDecoder.SOUTH_WEST_CORNER, TLcdGRIBModelDecoder.NORTH_EAST_CORNER, TLcdGRIBModelDecoder.SOUTH_EAST_CORNER, TLcdGRIBModelDecoder.MINIMUM, TLcdGRIBModelDecoder.MAXIMUM, TLcdGRIBModelDecoder.AVERAGE, or TLcdGRIBModelDecoder.BILINEAR.
      See Also:
    • getSampleStrategy

      public int getSampleStrategy()
      Deprecated.
      Returns the sampling strategy that is used for displaying raster data.
      Returns:
      The sampling strategy that is used for displaying raster data.
      See Also:
    • setCreateModelTreeNodes

      public void setCreateModelTreeNodes(boolean aCreateModelTreeNodes)
      Deprecated.
      Specifies whether an ILcdModelTreeNode or a TLcdModelList should be created when decoding a bulletin.
      Parameters:
      aCreateModelTreeNodes - true if an ILcdModelTreeNode should be created, false if a TLcdModelList should be created.
      See Also:
    • isCreateModelTreeNodes

      public boolean isCreateModelTreeNodes()
      Deprecated.
      Returns whether an ILcdModelTreeNode or a TLcdModelList is created when decoding a bulletin. The default is false, for a TLcdModelList.
      Returns:
      true if an ILcdModelTreeNode is created when decoding a source, false if a TLcdModelList is be created.
      See Also:
    • setGRIBBulletinHeaderFilter

      public void setGRIBBulletinHeaderFilter(ILcdGRIBBulletinHeaderFilter aFilter)
      Deprecated.
      Sets the filter for filtering based on the GRIB bulletin headers. Only GRIB messages that are accepted are added to the decoded model. The default is null
      Parameters:
      aFilter - The filter for filtering based on the header of the GRIB messages.
      See Also:
    • getGRIBBulletinHeaderFilter

      public ILcdGRIBBulletinHeaderFilter getGRIBBulletinHeaderFilter()
      Deprecated.
      Returns the filter that is used for for filtering based on the GRIB bulletin headers.
      Returns:
      The filter for filtering based on the contents of the GRIB messages.
      See Also:
    • setGRIBBulletinFilter

      public void setGRIBBulletinFilter(ILcdGRIBBulletinFilter aFilter)
      Deprecated.
      Sets the filter for filtering based on the contents of the GRIB messages. Only GRIB messages that are accepted are added to the decoded model. The default is null.
      Parameters:
      aFilter - The filter for filtering based on the contents of the GRIB messages.
      See Also:
    • getGRIBBulletinFilter

      public ILcdGRIBBulletinFilter getGRIBBulletinFilter()
      Deprecated.
      Returns the filter that is used for filtering data based on the contents of the GRIB messages.
      Returns:
      The filter for filtering based on the contents of the GRIB messages.
      See Also:
    • getDefaultExtension

      public String getDefaultExtension()
      Deprecated.
      Gets the default file extension of GRIB bulletins.
      Returns:
      the default extension "grb".
    • getDisplayName

      public String getDisplayName()
      Deprecated.
      Description copied from interface: ILcdModelDecoder
      Returns a short, displayable name for the format that is decoded by this ILcdModelDecoder.
      Specified by:
      getDisplayName in interface ILcdModelDecoder
      Returns:
      "WMO GRIB bulletin".
    • canDecodeSource

      public boolean canDecodeSource(String aSourceName)
      Deprecated.
      Description copied from interface: ILcdModelDecoder
      Checks whether this model decoder can decode the specified data source. It is acceptable for this method to return true for a source name while decode throws an exception for that same source name.

      For performance reasons, we strongly recommend that this will only be a simple test. For example: check the file extension of a file, but not that the file exists or contains expected content.

      Specified by:
      canDecodeSource in interface ILcdModelDecoder
      Parameters:
      aSourceName - the data source to be verified; typically a file name or a URL.
      Returns:
      true if the source name has extension "grb", "grib", "dat", "grb2" or "grib2" (possibly extended with ".gz" or ".zip").
      See Also:
    • decode

      public ILcdModel decode(String aSourceName) throws IOException
      Deprecated.
      Description copied from interface: ILcdModelDecoder
      Creates a new model from the given data source.
      Specified by:
      decode in interface ILcdModelDecoder
      Parameters:
      aSourceName - the data source to be decoded; typically a file name or a URL.
      Returns:
      A model containing the decoded data. While null is allowed, implementors are advised to throw an error instead.
      Throws:
      IOException - for any exceptions caused by IO problems or invalid data. Since decoding invalid data almost always results in RunTimeExceptions (NullPointerException, IndexOutOfBoundsException, IllegalArgumentException, ...) on unexpected places, implementations are advised to catch RuntimeExceptions in their decode() method, and wrap them into an IOException, as illustrated in the code snippet below.
      
         public ILcdModel decode( String aSourceName ) throws IOException {
            try (InputStream input = fInputStreamFactory.createInputStream(aSourceName)) {
               // Perform decoding ...
            } catch (RuntimeException e) {
               throw new IOException(e);
            }
         }
       
      See Also: