@Deprecated public class TLcdGRIBModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
Each GRIB file contains the values of meteorological parameters (e.g., temperature, pressure...) at different grid points.
File | Required | Entry point | Description |
---|---|---|---|
*.grb *.grib *.dat *.grib2 *.grb2 |
x | x | GRIB file containing one or more meteorological rasters |
inputStreamFactory
of this decoder.collection of models
.
set behavior
, each model contains
either a single ILcdRaster instance or a single ILcdMultiValuedRaster instance.
A raster is a single tile with unsigned shorts that represent the internal values of
the parameter (or parameters). The GRIB format uses these internal values to eliminate redundancy
and negative or broken values. The actual value of a parameter can be calculated with the formula
Y * 10D = R + (X*2E)
where
TLcdGRIBModelDescriptor
or
TLcdGRIBBulletinModelDescriptor
. These descriptors can be used to
convert
the internal values to the actual values.
The type name of the model descriptor is the display name of this
decoder. The model references either implement ILcdGeodeticReference or ILcdGridReference.
override
the default
16-bits index color model that is attached to the decoded rasters, since
GRIB files don't contain any color information. Note that the indexing
must be based on the internal GRIB values, not on the actual values.setBulletinSupported(true)
to decode all messages of GRIB bulletin files.
By default, this decoder will only decode the first message of a GRIB bulletin file.TLcdGRIB1ModelDecoder
or the TLcdGRIB2ModelDecoder
depending on the grib version. Take a look into the documentation for more information on the specific model descriptors,
the known limitations, and code examples.Modifier and Type | Class and Description |
---|---|
static class |
TLcdGRIBModelDecoder.MultiValuedRasterCreation
Deprecated.
Determines when a multivalued raster should be created.
|
Modifier and Type | Field and Description |
---|---|
static int |
AVERAGE
Deprecated.
The sampling strategy that returns the average value of the corners of
each GRIB sample cell.
|
static int |
BILINEAR
Deprecated.
The sampling strategy that returns a bilinear interpolation of the values
of the corners of each GRIB sample cell.
|
static int |
MAXIMUM
Deprecated.
The sampling strategy that returns the maximum value of the corners of
each GRIB sample cell.
|
static int |
MINIMUM
Deprecated.
The sampling strategy that returns the minimum value of the corners of
each GRIB sample cell.
|
static int |
NORTH_EAST_CORNER
Deprecated.
The sampling strategy that returns the North-East corner of each GRIB
sample cell.
|
static int |
NORTH_WEST_CORNER
Deprecated.
The sampling strategy that returns the North-West corner of each GRIB
sample cell.
|
static int |
SOUTH_EAST_CORNER
Deprecated.
The sampling strategy that returns the South-East corner of each GRIB
sample cell.
|
static int |
SOUTH_WEST_CORNER
Deprecated.
The sampling strategy that returns the South-West corner of each GRIB
sample cell.
|
Constructor and Description |
---|
TLcdGRIBModelDecoder()
Deprecated.
Creates a new
TLcdGRIBModelDecoder , with a globally shared
buffer for caching tiles. |
TLcdGRIBModelDecoder(ILcdBuffer aBuffer)
Deprecated.
Creates a new
TLcdGRIBModelDecoder . |
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 aSource)
Deprecated.
Checks whether this model decoder can decode the specified data source.
|
ILcdModel |
decode(String aSource)
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 messages.
|
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 be used for creating input streams
given source names.
|
TLcdGRIBModelDecoder.MultiValuedRasterCreation |
getMultiValuedRasterCreation()
Deprecated.
Returns when multi-valued rasters are created.
|
int |
getSampleStrategy()
Deprecated.
Returns the sampling strategy that is used for displaying raster data.
|
boolean |
isBulletinSupported()
Deprecated.
Returns
true if all messages of bulletin files will be decoded. |
void |
removeParameterTable(ILcdGRIBParameterTable aParameterTable)
Deprecated.
Removes a parameter table.
|
void |
setBulletinSupported(boolean aBulletinSupported)
Deprecated.
Enable or disable decoding of all messages in a GRIB bulletin file.
|
void |
setColorModel(ColorModel aColorModel)
Deprecated.
Sets the color model that is attached by default to the decoded rasters.
|
void |
setGRIBBulletinFilter(ILcdGRIBBulletinFilter aFilter)
Deprecated.
Enables GRIB bulletin decoding with the given filter for filtering based on the contents of the GRIB messages.
|
void |
setGRIBBulletinHeaderFilter(ILcdGRIBBulletinHeaderFilter aFilter)
Deprecated.
Enables GRIB bulletin decoding with the given 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 |
setMultiValuedRasterCreation(TLcdGRIBModelDecoder.MultiValuedRasterCreation aMultiValuedRasterCreation)
Deprecated.
Configures the creation of multi-valued rasters.
|
void |
setSampleStrategy(int aSampleStrategy)
Deprecated.
Sets the sampling strategy that is used for displaying raster data.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public static final int NORTH_WEST_CORNER
public static final int SOUTH_WEST_CORNER
public static final int NORTH_EAST_CORNER
public static final int SOUTH_EAST_CORNER
public static final int MINIMUM
public static final int MAXIMUM
public static final int AVERAGE
public static final int BILINEAR
public TLcdGRIBModelDecoder()
TLcdGRIBModelDecoder
, with a globally shared
buffer for caching tiles.TLcdSharedBuffer.getBufferInstance()
public TLcdGRIBModelDecoder(ILcdBuffer aBuffer)
TLcdGRIBModelDecoder
.aBuffer
- the shared buffer that decoded models use.public boolean canDecodeSource(String aSource)
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
aSource
- the data source to be verified; typically a file name or a URL.true
if the given file name has extension "grb",
"grib", "dat", "grib2", or "grb2"
(possibly extended with ".gz" or ".zip").ILcdModelDecoder.decode(String)
,
ILcdModelDecoder.decodeModelMetadata(String)
public ILcdModel decode(String aSource) throws IOException
ILcdModelDecoder
decode
in interface ILcdModelDecoder
aSource
- 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)
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
public boolean isBulletinSupported()
true
if all messages of bulletin files will be decoded.
If bulletins are supported, the bulletin decoder is used to decode all messages.
If bulletins are not supported, the grib1 or grib2 decoder is used to decode the first message of the file.true
if all messages of bulletin files will be decodedTLcdGRIBBulletinModelDecoder
public void setBulletinSupported(boolean aBulletinSupported)
aBulletinSupported
- true
to enable decoding of all messages in GRIB bulletins,
false
to disable decoding of all messages in GRIB bulletins.public TLcdGRIBModelDecoder.MultiValuedRasterCreation getMultiValuedRasterCreation()
ALWAYS
, AUTO
, or NONE
setMultiValuedRasterCreation(com.luciad.format.grib.TLcdGRIBModelDecoder.MultiValuedRasterCreation)
public void setMultiValuedRasterCreation(TLcdGRIBModelDecoder.MultiValuedRasterCreation aMultiValuedRasterCreation)
aMultiValuedRasterCreation
- one of ALWAYS
, AUTO
, or NONE
ILcdRaster
,
ILcdMultivaluedRaster
,
getMultiValuedRasterCreation()
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 ILcdGRIBBulletinFilter getGRIBBulletinFilter()
.
public void setGRIBBulletinFilter(ILcdGRIBBulletinFilter aFilter)
null
.aFilter
- The filter for filtering based on the contents of the GRIB messages.getGRIBBulletinFilter()
public void addParameterTable(ILcdGRIBParameterTable aParameterTable)
The decoder first tries to use the parameter table with a matching table version, center ID, and subcenter ID. If it can't find it, the decoder falls back on the parameter table that only matches the table version.
aParameterTable
- the parameter table to add.addParameterTable(ILcdGRIBParameterTable,boolean)
public void addParameterTable(ILcdGRIBParameterTable aParameterTable, boolean aMatchCenter)
The decoder first tries to use the parameter table with a matching table version, center ID, and subcenter ID. If it can't find it, the decoder falls 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.public void removeParameterTable(ILcdGRIBParameterTable aParameterTable)
aParameterTable
- the parameter table to remove.public void setColorModel(ColorModel aColorModel)
null
.aColorModel
- an 8-bit or 16-bit IndexColorModel that is compatible
with the GRIB data to be decoded.getColorModel()
public ColorModel getColorModel()
setColorModel(java.awt.image.ColorModel)
public void setSampleStrategy(int aSampleStrategy)
aSampleStrategy
- one of
NORTH_WEST_CORNER
,
SOUTH_WEST_CORNER
,
NORTH_EAST_CORNER
,
SOUTH_EAST_CORNER
,
MINIMUM
,
MAXIMUM
,
AVERAGE
, or
BILINEAR
.getSampleStrategy()
public int getSampleStrategy()
setSampleStrategy(int)
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 String getDefaultExtension()