@Deprecated public class TLcdGRIBBulletinModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
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:
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
.
Each message is therefore represented by an TLcdGRIBModelDecoder
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
Constructor and Description |
---|
TLcdGRIBBulletinModelDecoder()
Deprecated.
Creates a new
TLcdGRIBBulletinModelDecoder , with a globally
shared buffer for caching tiles. |
TLcdGRIBBulletinModelDecoder(ILcdBuffer aBuffer)
Deprecated.
Creates a new
TLcdGRIBBulletinModelDecoder . |
Modifier and Type | Method and Description |
---|---|
void |
addParameterTable(ILcdGRIBParameterTable aParameterTable)
Deprecated.
Adds a parameter table.
|
void |
addParameterTable(ILcdGRIBParameterTable aParameterTable,
boolean aMatchCenter)
Deprecated.
Adds a parameter table.
|
boolean |
canDecodeSource(String aSourceName)
Deprecated.
Checks whether this model decoder can decode the specified data source.
|
ILcdModel |
decode(String aSourceName)
Deprecated.
Creates a new model from the given data source.
|
ColorModel |
getColorModel()
Deprecated.
Returns the color model that is attached by default to the decoded rasters.
|
String |
getDefaultExtension()
Deprecated.
Gets the default file extension of GRIB bulletins.
|
String |
getDisplayName()
Deprecated.
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
ILcdGRIBBulletinFilter |
getGRIBBulletinFilter()
Deprecated.
Returns the filter that is used for filtering data based on the contents
of the GRIB messages.
|
ILcdGRIBBulletinHeaderFilter |
getGRIBBulletinHeaderFilter()
Deprecated.
Returns the filter that is used for for filtering based on the GRIB
bulletin headers.
|
ILcdInputStreamFactory |
getInputStreamFactory()
Deprecated.
Returns the input stream factory that is used for creating input streams
given source names.
|
int |
getSampleStrategy()
Deprecated.
Returns the sampling strategy that is used for displaying raster data.
|
boolean |
isCreateModelTreeNodes()
Deprecated.
Returns whether an
ILcdModelTreeNode or a TLcdModelList is
created when decoding a bulletin. |
boolean |
isTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
removeParameterTable(ILcdGRIBParameterTable aParameterTable)
Deprecated.
Removes a parameter table.
|
static void |
setClassTraceOn(boolean aClassTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
setColorModel(ColorModel aColorModel)
Deprecated.
Sets the color model that is attached by default to the decoded rasters.
|
void |
setCreateModelTreeNodes(boolean aCreateModelTreeNodes)
Deprecated.
Specifies whether an
ILcdModelTreeNode or a TLcdModelList
should be created when decoding a bulletin. |
void |
setGRIBBulletinFilter(ILcdGRIBBulletinFilter aFilter)
Deprecated.
Sets the filter for filtering based on the contents of the GRIB messages.
|
void |
setGRIBBulletinHeaderFilter(ILcdGRIBBulletinHeaderFilter aFilter)
Deprecated.
Sets the filter for filtering based on the GRIB bulletin headers.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Deprecated.
Sets the input stream factory that is used for creating input streams
given source names.
|
void |
setSampleStrategy(int aSampleStrategy)
Deprecated.
Sets the sampling strategy that is used for displaying raster data.
|
void |
setTraceOn(boolean aTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public TLcdGRIBBulletinModelDecoder()
TLcdGRIBBulletinModelDecoder
, with a globally
shared buffer for caching tiles.public TLcdGRIBBulletinModelDecoder(ILcdBuffer aBuffer)
TLcdGRIBBulletinModelDecoder
.aBuffer
- the shared buffer that decoded GRIB models will use.TLcdGRIBModelDecoder
public static void setClassTraceOn(boolean aClassTraceOn)
true
then all log messages are recorded, otherwise only
the informative, warning and error messages are recorded.aClassTraceOn
- if true then all log messages are recorded,
otherwise only the informative, warning and error messages are recorded.public void setTraceOn(boolean aTraceOn)
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.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.public boolean isTraceOn()
true
if tracing is enabled for this class.public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- The input stream factory to be used.getInputStreamFactory()
public ILcdInputStreamFactory getInputStreamFactory()
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
setInputStreamFactory(com.luciad.io.ILcdInputStreamFactory)
public void addParameterTable(ILcdGRIBParameterTable aParameterTable)
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.
aParameterTable
- the parameter table to add.TLcdGRIBModelDecoder.addParameterTable(ILcdGRIBParameterTable)
public void addParameterTable(ILcdGRIBParameterTable aParameterTable, boolean aMatchCenter)
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.
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.TLcdGRIBModelDecoder.addParameterTable(ILcdGRIBParameterTable,boolean)
public void removeParameterTable(ILcdGRIBParameterTable aParameterTable)
aParameterTable
- the parameter table to remove.TLcdGRIBModelDecoder.removeParameterTable(ILcdGRIBParameterTable)
public void setColorModel(ColorModel aColorModel)
null
.aColorModel
- an 8-bit or 16-bit IndexColorModel that is compatible
with the GRIB data to be decoded.TLcdGRIBModelDecoder.setColorModel(ColorModel)
,
getColorModel()
public ColorModel getColorModel()
TLcdGRIBModelDecoder.getColorModel()
,
setColorModel(java.awt.image.ColorModel)
public void setSampleStrategy(int aSampleStrategy)
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
.getSampleStrategy()
public int getSampleStrategy()
setSampleStrategy(int)
public void setCreateModelTreeNodes(boolean aCreateModelTreeNodes)
ILcdModelTreeNode
or a TLcdModelList
should be created when decoding a bulletin.aCreateModelTreeNodes
- true
if an ILcdModelTreeNode
should be created,
false
if a TLcdModelList
should be created.isCreateModelTreeNodes()
public boolean isCreateModelTreeNodes()
ILcdModelTreeNode
or a TLcdModelList
is
created when decoding a bulletin. The default is false
, for
a TLcdModelList
.true
if an ILcdModelTreeNode
is created when
decoding a source, false
if a TLcdModelList
is be created.setCreateModelTreeNodes(boolean)
public void setGRIBBulletinHeaderFilter(ILcdGRIBBulletinHeaderFilter aFilter)
null
aFilter
- The filter for filtering based on the header of the GRIB messages.getGRIBBulletinHeaderFilter()
public ILcdGRIBBulletinHeaderFilter getGRIBBulletinHeaderFilter()
setGRIBBulletinHeaderFilter(ILcdGRIBBulletinHeaderFilter)
public void setGRIBBulletinFilter(ILcdGRIBBulletinFilter aFilter)
null
.aFilter
- The filter for filtering based on the contents of the GRIB messages.getGRIBBulletinFilter()
public ILcdGRIBBulletinFilter getGRIBBulletinFilter()
.
public String getDefaultExtension()
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
public boolean canDecodeSource(String aSourceName)
ILcdModelDecoder
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.
canDecodeSource
in interface ILcdModelDecoder
aSourceName
- the data source to be verified; typically a file name or a URL.true
if the source name has extension "grb",
"grib", "dat", "grb2" or "grib2"
(possibly extended with ".gz" or ".zip").ILcdModelDecoder.decode(String)
,
ILcdModelDecoder.decodeModelMetadata(String)
public ILcdModel decode(String aSourceName) throws IOException
ILcdModelDecoder
decode
in interface ILcdModelDecoder
aSourceName
- the data source to be decoded; typically a file name or a URL.null
is allowed, implementors are advised to throw an error instead.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);
}
}
InterruptedIOException
- When the thread on which this method is called is interrupted: it is recommended to stop the decoding
and throw an InterruptedIOException
.
This same exception can also be used if the decoder shows UI to the user, and the user cancels the decoding
through the UI.ILcdModelDecoder.canDecodeSource(String)