![]() |
|
This section handles image processing. See also a separate section for Reading and writing image files .
As mentioned in Reading and writing image files, data can be extracted and stored as image files simply by selecting data and issuing --outputFile ( -o ) command:
If a user wishes to rescale intensities, The scaling and special codes are defined with --encoding .
Notice that this command will not affect the actual radar data (HDF5 structure) in memory. (The one --image command required in earlier versions of rack is called implicitly.) For converting the actual data, use --convert as explained in Data conversions .
Initially gray-level data can be couloured with a preferred palette. The user may apply built-in palettes or design them as external files. The following examples illustrate the usage of --palette command:
Notes on the argument of --palette command:
DBZH ) as argument, Rack primarily searches for built-in palette associated with the quanity, and then palette/palette-QUANTITY.txt palette-QUANTITY.txt start a file load from current dir, and if that fails, a retry from palette/palette-QUANTITY.txt 'default', Rack automatically replaces the argument with current ${what:quantity} retrieved from metadata, and starts a search as defined above.A palette file consisting of lines that contain a threshold followed by red, green and blue values. The format is compatible with that of color-relief command used by gdaldem (https://gdal.org/programs/gdaldem.html) The file may contain comments escaped by a hash. For example, a file containing
can be applied for colouring a sweep using the following command:
The resulting image is stored in the HDF5 structure in parallel with the source data, in the next available data{i} group. (In earlier versions: in a separate image object.) The resulting quantity – what:quantity – is by default composed by appending /Palette , so DBZH/Palette for example. The coloured image data is internally marked temporary and will not be saved in a HDF5 files by default. If one wishes to save a color image in the HDF5 structure, a quantity has to be given explicitly:
Another possibility is to remove the temporary marker with –keep dataset:/data: command.
Note that colouring is implemented by data conversion; Rack does not currently support actual palette (lookup) objects in HDF5.
The comment lines starting with '#' are handled as well:
Entries associated with special data codes undetect and nodata – the actual values of which may vary – are prefixed with '@', and the preceding comment must contain the code key only in the short form (without leading what: ).
The palette information can be also converted to a graphic legend file using --legendOut command. The output is in Scalable Vector Graphics (SVG) format, displaying titles and labels described above.
The comment before each colour entry in the palette file will be displayed as lower limits in the legend. The SVG file can be converted to a pixel image using convert program, for example. Also special formats .inc and .cpp are supported for C++ code export and respectively .py and .PY for Python code export.
--palette command.The palette command can be applied to practically all the data objects: sweeps, polar products and Cartesian images, including composites.
The palette can be also provided in JSON (https://www.json.org/) format which is not as compact as the native syntax shown above but increases portability towards other languages like Python and JavaScript. The current naming and hierarchy is experimental, containing color definitions in entries , each entry essentially containing RGB color vector , minimum intensity index , and a description in English (en) .
Adding transparency to radar images is useful in applications involving layered data viewing. Transparency can be added to gray or colour images with --imageTransp .
The first parameter, threshold defines the values to be transparent in the image. It can be one of the following
{min}:{max} inside which full transparency (at {min} ) will linearly change to opaque (at {max} ).By default or explicitly issued –iPhysical true, it is handled as a physical values, like +5 (dBZ). This can be changed with –iPhysical false which uses interval [0,1] normalized by actual range of the current storage type, like [0,255] or [0,65535]. Instead of a threshold, a colon-separated range (eg. 5:15) can be given, yielding a smooth transition from transparent to opaque. By default, undetect is transparent and nodata is opaque. The following command creates a Cartesian image, adds palette and transparency to the image and stores the results in image files
The older command --imageAlpha uses linear scaling of data: either the original gain, offset, undetect, nodata or values overridden with --encoding. (The storage type cannot be changed.) The following command creates a Cartesian image, adds palette and transparency to the image and stores the results in image files:
In addition to the commands listed above, Rack provides several general image processing commands that can be used for smoothing, thresholding and rescaling image data - typically Cartesian products.
By default, the result is written in a new data array with a "new" what:quantity which is initially set to ${what:quantity}_${command}, to be expanded as DBZH_RESIZE for example. Alternatively, a new quantity may be explicitly set with quantity parameter of --encoding command. To override source data, give an empty quantity attribute with --encoding quantity= which equals --encoding 'quantity=${what:quantity}' .
The image processing commands have form --i(Command) . The List of image operators is attached at the end of this page. Some selected examples are shown below.
Thresholding data can be done as follows:
Setting LIMIT=true prevents from underflow and overflow – especially when using char and short integers as storage types. By default, thresholding applies to physical intensity values. This can be changed with --iPhysical , to handle intensities as as raw (0) or physical (1) values. Hence, to threshold data with +10 dBZ, setting values below it to -32 dBZ, is done with:
Radar data can fuzzified ie. mapped to interval [0.0,1.0] using various fuzzy operators. (See example of using --iFuzzyStep in Application: creating clutter maps ). In some cases, probability (PROB ) can be a suitable target quantity, set within --encoding .
Resizing of all the data arrays in the first dataset<1> (typically dataset1) can be done as follows:
Like with many other commands, the data can be selected with --select or, for quantities only, more compactly with -Q :
Smoothing an image can performed with sliding window based averaging. Rectangular, Gaussian and magnitude-saving "flow" averaging is supported:
These method use weighted averaging is quality data (QIND) is associated. The last method (flow average) is suited to averaging vector fields, esp. if opposite vector components should not be simply cancelled. For the resulting vector, the direction of the sum vector is chosen and rescaled to the average magnitude.
Also distance transform yields blurred image data.
Repeated blurring is compactly produced with BlenderOp which mixes the blurred image with the original image. It employs the abovementioned blurring methods. For mixing, it uses maximum or linear mixture. Respectively, if quality data (QIND) is available, it uses maximum-quality or quality-weighted methods.
In Rack, the data sets of a HDF structure are implemented directly as image objects. Copies of images are needed only if the intensities are rescaled or coloured.
Rack has two memory arrays in which images can be extracted: grayImage and colorImage. In addition, there are two pointers: grayImagePtr and imagePtr . The flow of image data is illustrated below. grayImagePtr points to the latest HDF5 object processed or grayImage . imagePtr points to the latest HDF5 object processed, grayImage or colorImage. To be specific, these pointers point to the first HDF5 dataset matching the path selector --select , for example /dataset1/data1/data . The pointers are updated automatically by appropriate commands like --image or --palette . The flows implemented using pointers are illustrated with dotted lines.
1.9.8