Transcript Document
Extending WDSS-II
C++
Valliappa Lakshmanan
National Severe Storms Laboratory &
University of Oklahoma
[email protected]
7/21/2015
http://www.wdssii.org/
1
Meant to be extended
WDSS-II is meant to be extended
Few things are set in stone
We use factories every where
You can introduce your implementation
objects into those factories
Plug in your own writers, readers, builders,
data formats, etc.
Existing algorithms will transparently pick up
your changes.
7/21/2015
http://www.wdssii.org/
2
New algorithm
Adding a new algorithm or tool
Is the most common extension
Write a new executable that links to the WDSS-II libraries
Will automatically be pluggable into a WDSS-II deployment
system
Can ingest data from an existing system
Can provide products instead of products already being used.
Use w2algcreator – don’t need to be a C++ expert to do this
You need to know C++ very well in order to extend the
WDSS-II framework in any other way
7/21/2015
http://www.wdssii.org/
3
Adding functionality to WDSS-II
Use the factories to extend WDSS-II
Make sure that your introduceSelf() function
is called by Baseline::initialize()
For example, this is how gzip files are read
Factory<Reader>::introduce(“gz”, new
GzipReader() );
GzipReader implements the Reader
interface
7/21/2015
http://www.wdssii.org/
4
Available factories
These are some of the available factories in the infrastructure
Reader
Writer
To write formats other than netcdf,xml,awipsnc
Builder/Formatter
To notify to something other than LB (such as SQL data base or CORBA)
DataEncoder
To write to something other than file, gz, bz2
IndexRecordNotifier
To read from something other than file, gz, bz2
To read formats other than netcdf, xml, level-III
Factories at the algorithm level
FilterFactory (w2imgproc)
VolumeCreatorFactory (w2merger)
7/21/2015
New Kernel filters for smoothing, etc.
New strategies for blending
http://www.wdssii.org/
5
Adding to factory
Write a class that implements the appropriate
interface (Reader,Writer, etc)
Create a static introduceSelf() method that
adds itself the factory with a name
Call this from a static initialize() method
common to the shared library
Directly call this initialize() method from
Baseline::initialize() to add directly to WDSS-II
Use a static initializer if not every body needs it or if
you don’t have access to the code of
Baseline::initialize()
7/21/2015
More on this later
http://www.wdssii.org/
6
Writing ingest programs
To read a new data format, write an ingest
program
Use DataDirectoryManager
Create a DataHandler
7/21/2015
Implement processData
Data will be handed to you in chunks
Use BOIStream if your data are binary
http://cimms.ou.edu/~lakshman/WDSSII/software/doc/w2dox/html/classcode_1_1D
ataDirectoryManager.html
Does byteswapping
Use AsciiLineReader if your data are textual
Look at example ingest programs in w2algs/ftptonc
and w2algs/ldm2netcdf
http://www.wdssii.org/
7
Writing native readers
You can make algorithms read your new
data format natively
Ingest programs take the input data and
convert it into netcdf/XML
The Level-III format is read in this manner
Use w2ext/w2nexrad as an example
Some what more complex; choose whether
you really want to do this.
7/21/2015
http://www.wdssii.org/
8
ExtensionLoader
Use a static intializer if you can not
modify Baseline::initialize()
Look at documentation of ExtensionLoader
Look at w2ext/w2nexrad for examples
Populate WDSS-II factories in this initializer
Package up all your classes into a
shared library
Add library to environment variable
W2_EXTENSION_LIBS at run-time
7/21/2015
http://www.wdssii.org/
9
Using the documentation
When writing new algorithms
Consider if the functionality already exists
Start with the data type documentation
7/21/2015
Can you link together existing tools to get your
functionality?
Experiment, then use those algorithm classes to form your
new algorithm (see the algorithm documentation)
LatLonGrid, etc.
Process your data
Use DataEncoder::writeData to write all your
intermediate outputs
http://www.wdssii.org/
10