@LcdService(priority=20000) public final class TLcdBUFRModelDecoder extends Object implements ILcdModelDecoder, ILcdStatusSource, ILcdInputStreamFactoryCapable
Headers | Weather Features |
---|---|
JUWE96 EGRR, JUWE96 KKCI, JUTE00 EGRR, JUTE00 KKCI | Jet-streams |
JUCE00 EGRR, JUCE00 KKCI, JUME00 EGRR, JUME00 KKCI | Clear Air Turbulence |
JUBE99 EGRR, JUBE99 KKCI, JUNE00 EGRR, JUNE00 KKCI | Clouds |
JUTE97 EGRR, JUTE97 KKCI, JUOE00 EGRR, JUOE00 KKCI | Tropopause heights |
JUVE00 EGRR, JUVE00 KKCI | Storms, volcanic clouds, radiation incidents |
JUFE00 EGRR, JUFE00 KKCI, JUJE00 EGRR, JUJE00 KKCI | No weather features |
File | Required | Entry point | Description |
---|---|---|---|
*.bufr, *.bin, no extension | x | x |
The BUFR file |
ILcdModelTreeNode
.ILcd2DBoundsIndexedModel
.TLcdSIGWXModelDescriptor
.
This descriptor will include the SIGWX header information like forecast data and height level boundaries.TLcdGeodeticReference
. This cannot be changed.ILcdDataObject
.TLcdSIGWXDataTypes
for the possible weather features and their properties.
ILcdModelDecoder decoder = new TLcdBUFRModelDecoder();
ILcdModel model = decoder.decode("file.bufr");
read lock
.The BUFR file has to adhere to the following requirements:
Modifier and Type | Field and Description |
---|---|
static String |
BUFR_TYPE_NAME
The type name for BUFR data.
|
Constructor and Description |
---|
TLcdBUFRModelDecoder()
Create a new decoder instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addStatusListener(ILcdStatusListener aListener)
Registers the given listener so it will receive status events from this source.
|
boolean |
canDecodeSource(String aSourceName)
Checks whether this model decoder can decode the specified data source.
|
ILcdModel |
decode(String aSourceName)
Creates a new model from the given data source.
|
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
ILcdInputStreamFactory |
getInputStreamFactory()
Returns the input stream factory that is used.
|
void |
removeStatusListener(ILcdStatusListener aListener)
Removes the specified listener so it is no longer notified.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory to be used.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public static final String BUFR_TYPE_NAME
The type name for BUFR data. The model descriptor of models decoded by this decoder will have the type name set to this value.
This constant can be used to check if a model has BUFR data. Note that an instanceof check on the model descriptor can be used to determine the specific data type
(e.g. SIGWX data will have a TLcdSIGWXModelDescriptor
as the model descriptor).
public TLcdBUFRModelDecoder()
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
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 this decoder can likely decode the data specified by the source name, false
otherwise.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)
public void addStatusListener(ILcdStatusListener aListener)
ILcdStatusSource
Registers the given listener so it will receive status events from this source.
In case you need to register a listener which keeps a reference to an object with a shorter life-time than this status source,
you can use a ALcdWeakStatusListener
instance as status listener.
addStatusListener
in interface ILcdStatusSource
aListener
- The listener to be notified when the status has changed.public void removeStatusListener(ILcdStatusListener aListener)
ILcdStatusSource
removeStatusListener
in interface ILcdStatusSource
aListener
- The listener to remove.public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
File.createTempFile(String, String)
in the OS temporary files directory.setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the input stream factory to be used.ILcdModel.dispose()
public ILcdInputStreamFactory getInputStreamFactory()
ILcdInputStreamFactoryCapable
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable