Loading...
Searching...
No Matches
Compositing schemes

Compositing schemes

Direct compositing

Creating composites in a direct mode involves the following steps:

  1. Initialising a composite to apply projection, geographical scope, size, and compositing method
  2. For each radar, reading and processing volume data and projecting them on the array
  3. Extracting the final product from the array

The process is illustrated in the graph below.

dot_inline_dotgraph_1.png

The following command creates a composite of 12 radars using the direct scheme:

rack \
--cSize '640,768' \
--cProj '3067' \
--cBBox '-208000.0,6390000.0,1072000.0,7926000.0' \
--gStyle '.IMAGE_BORDER=stroke:gray;width:1px' \
--select quantity=DBZH \
--cInit \
--cMethod 'WAVG,1,8' \
--script '--pCappi "500" --cAdd' \
--inputPrefix 'data/' \
'202609261800_radar.polar.fikan.h5' \
'202609261800_radar.polar.fikau.h5' \
'202609261800_radar.polar.fikes.h5' \
'202609261800_radar.polar.fikor.h5' \
'202609261800_radar.polar.fikuo.h5' \
--cExtract channels=DATA,WEIGHT:bbox= \
--outputPrefix 'out/' \
--outputConf 'svg:paths=RELATIVE' \
--gLinkImage 'out/map-composite-fi.png' \
--gAlign 'HORZ_FILL:VERT_FILL' \
--paletteDefault \
--imageTransp 'nodata=1,undetect=0' \
--outputFile 'composite-fi-direct_DATA.png' \
--select 'quantity=QIND' \
--outputFile 'composite-fi-direct_WEIGHT.png' \
--outputFile 'composite-fi-direct.svg'
Note
The above command line can be generated also with Python code composite-fi_direct_rack.py or the respective command line composite-fi_direct_py.sh Keywords are the same as the command line options, which can be listed with:
python3 -m rack.composite --help
A radar composite image – Finnish (FMI) radars, Pseudo CAPPI 600m, weighted-average compositing method: main product (left) and quality field (right).
rack \
--cSize '640,768' \
--cProj '3067' \
--cBBox '-208000.0,6390000.0,1072000.0,7926000.0' \
--outputPrefix 'tiles/' \
--script '--select quantity=DBZH --pCappi "500" --cCreateTile --outputFile "tile-${NOD}.h5"' \
--inputPrefix 'data/' \
'202609261800_radar.polar.fikan.h5' \
'202609261800_radar.polar.fikau.h5' \
'202609261800_radar.polar.fikes.h5' \
'202609261800_radar.polar.fikor.h5' \
'202609261800_radar.polar.fikuo.h5'
Note
The above command line can be generated also with Python code composite-fi_tiles_rack.py or the respective command line composite-fi_tiles_py.sh
In output file naming, one should use syntax that is distinctive in recollecting them for a composite. For example, if t A generally distinguishive output file name could be:
${what:date}${what:time}-GEOCONF=FINLAND_${NOD}-${what:product}-${what:prodpar}-${what:quantity}.h5
but

The tiles are used as input to a composite just like in direct compositing:

rack \
--cSize '640,768' \
--cProj '3067' \
--cBBox '-208000.0,6390000.0,1072000.0,7926000.0' \
--gStyle '.IMAGE_BORDER=stroke:gray;width:1px' \
--select quantity=DBZH \
--cInit \
--cMethod 'WAVG,1,8' \
--script '--cAdd' \
--inputPrefix 'tiles/' \
'tile-fikan.h5' \
'tile-fikau.h5' \
'tile-fikes.h5' \
'tile-fikor.h5' \
'tile-fikuo.h5' \
--cExtract channels=DATA,WEIGHT:bbox= \
--outputPrefix 'out/' \
--outputConf 'svg:paths=RELATIVE' \
--gLinkImage 'out/map-composite-fi.png' \
--gAlign 'HORZ_FILL:VERT_FILL' \
--paletteDefault \
--imageTransp 'nodata=1,undetect=0' \
--outputFile 'composite-fi-tiled_DATA.png' \
--select 'quantity=QIND' \
--outputFile 'composite-fi-tiled_WEIGHT.png' \
--outputFile 'composite-fi-tiled.svg'

Notice that the geographic configuration (cBBox, cProj, cSize) has to be given explicitly again. The metadata in the tile files does contain geo-locating but no information on the "intended" radar composite, as a tile is compatible with any composite using the same projection and spatial resolution.

Note
The above command line can be generated also with Python code composite-fi_tiled_rack.py or the respective command line composite-fi_tiled_py.sh
A radar composite image – Finnish (FMI) radars, Pseudo CAPPI 600m, weighted-average compositing method: main product (left) and quality field (right).

The extraction command --cExtract extracts one or more data layers out of the compositing (accumulation array):

  • DATA - the actual composited data, like reflectivity (DBZH )
  • WEIGHT - quality (confidence) of the data value
  • COUNT - number of radars contributed
  • DEVIATION - difference or discrepancy of data (if more than one radar contributed)

The desired combination is given as a comma-separated list of above keywords. Notice that the command –cCreate for creating single radar "composite" is equivalent to --cAdd cExtract DATA,WEIGHT . For example:

Upon initialisation of the compositing array, Rack stores the encoding parameters – storage type, scaling and marker values (undetect , nodata) – given explicitly or adopted from the first input. Then, in extraction stage, that encoding is applied by default. The internal compositing array itself is floating point data, so encoding of the output can be also set upon extraction. Reusing the above single-radar example, as follows:

The encoding is applied to the first field (like DATA ) listed; the remaining field (typically quality fields) use their default encodings. But if desired, encoding of each field can be set, for example as follows:

For now, the old syntax is also supported: a string composed of single letters (d ), weight, (w ), deviation (std.dev., s ) and count of radars (c ).

Cropping is supported by a new optional parameter: the desired bounding box can be given explicitly LLx,LLy,URx,URy or DATA (automatic bounding box) or OVERLAP (overlapping area).

--cExtract <channels>:<bbox> (section: cart, separator: ':')
Extract (export) data from the internal accumulation array
- channels (DATA,WEIGHT) [DATA,WEIGHT,WEIGHT_GLOBAL,COUNT,DEVIATION]
- bbox () [Optional cropping: ...:<LLx>,<LLy>,<URx>,<URy> or INPUT or OVERLAP]
See also: cAdd,cAddWeighted
Layers extracted from the accumulation array: the composite, quality field, deviation and count of radars.

Rack makes composites of any selected quantity or polar product. Examples are shown in the image below.

Composites of CAPPI, max echo, echo top, rhoHV, and HydroClass.

Hint. Command lines may get lengthy in compositing. You can shorten file arguments by using general options --inputPrefix and --outputPrefix .

Tiled compositing

In a Tiled (distributed) mode, the composite is initialized as in direct mode but the tile generated is with --cCreateTile and then saved with --outputFile command. In the accumulation stage, the composite is loaded and then copied to the internal compositing array with --cAdd. The stages are illustrated in the diagrams below.

dot_inline_dotgraph_2.png

For example, a tile can be created as follows:

rack \
--cSize '512,614' \
--cProj '3067' \
--cBBox '-208000.0,6390000.0,1072000.0,7926000.0' \
--outputPrefix 'tiles/' \
--script '--select quantity=DBZH --cCreateTile --outputFile "tile-fikor.h5"' \
--inputPrefix 'data-20140525/' \
'201405251200_radar.polar.fikor.h5'

Experimental: the above command line can also be generated using Python utility rack.composite :

python3 -m rack.composite \
--BBOX -208000.0,6390000.0,1072000.0,7926000.0 \
--PROJ 3067 \
--SIZE 512,614 \
--GEOCONF WRAPTEST \
--SCHEME TILE \
201405251200_radar.polar.fikor.h5 \
--INDIR data-20140525/ \
--OUTDIR '' \
--OUTFILE tile-fikor.h5 \
--QUANTITY DBZH \
--log_level INFO --print ' \\n ' # or --exec

Or using Python API, as follows:

# Initialize command line generator.
composer = rack.cmdline.Composer(rack.composite)
# Set parameters
composer.set(SCHEME="TILE")
composer.set(INDIR='data-20140525/')
composer.set(INFILE=f'201405251200_radar.polar.{SITE}.h5')
composer.set(SCHEME="TILE")
composer.set(OUTFILE=f'tile-{SITE}.h5')
# Several options can be set at once
# composer.set(SIZE="512,614", PROJ=3067, BBOX="-208000,6390000,1072000,7926000")
# Alternatively, reads BBOX, SIZE and PROJ from geoconf/geoconf-WRAPTEST.json :
composer.set(GEOCONF='WRAPTEST')
# Extract command sequence
prog = composer.get_prog()
# Apply formatting
fmt = rack.cmdline.RackFormatter(params_format="'{params}'")
# Extract as a single string (suited to os.system call).
rack_cmd = prog.to_string(fmt)
os.system(rack_cmd)

Then, tiles are collectively added to composite with a single command. Notice that the composite definitions should be exactly the same as in the tile creation:

rack \
--cProj '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' \
--cSize 500,750 --cBBox 17,57.7,33,69.5 --cInit --cMethod WAVG,2,2,-32 \
--script '--cAdd' \
tiles/201405251200_radar.polar.fianj-tile.h5 \
tiles/201405251200_radar.polar.fiika-tile.h5 \
tiles/201405251200_radar.polar.fikor-tile.h5 \
tiles/201405251200_radar.polar.fikuo-tile.h5 \
tiles/201405251200_radar.polar.filuo-tile.h5 \
tiles/201405251200_radar.polar.fiuta-tile.h5 \
tiles/201405251200_radar.polar.fivan-tile.h5 \
tiles/201405251200_radar.polar.fivim-tile.h5 \
--cExtract DATA,WEIGHT,COUNT \
--gTitle 'Rack Composite - ${what:date|%Y/%m}' -o composite-fi-cappi.h5

(The above commands have been generated using make-composite.sh with SCHEME=TILE and SCHEME=TILED .)

Tiles containing several radars

By default, each tile contains data from a single radar. Alternatively, for a large composite, one can construct a tile containing data from several radars by calling --cBBoxTile command immediately after --cBBox and --cSize . The latter commands are equal to those of the large composite. A multi-radar tile is otherwise generated like any composite, that is, --cAdd and --cExtract commands are needed (unlike in constructing a single-radar tile).

For example, consider receiving a precomputed the OPERA composite, to which the Russian and Belarussian radars are added. First, the latter data is composited to a tile cropped with --cBBoxTile under OPERA geometry:

rack \
--cProj '+proj=laea +lat_0=55.0 +lon_0=10.0 +x_0=1950000.0 +y_0=2300000.0 +units=m +ellps=WGS84' \
--cSize 1900,2200 --cBBox -10.4346,31.7462,57.812,67.621 --cBBoxTile 24.4357,51.754,47.9115,65.4706 --cInit --cMethod MAXIMUM \
\
--script ' -Q DBZH --cAdd' \
data-east/201703071200_radar.polar.bymin.h5 \
data-east/201703071200_radar.polar.ruavn.h5 \
data-east/201703071200_radar.polar.ruudb.h5 \
data-east/201703071200_radar.polar.ruudk.h5 \
data-east/201703071200_radar.polar.ruudl.h5 \
data-east/201703071200_radar.polar.ruudp.h5 \
data-east/201703071200_radar.polar.ruudv.h5 \
data-east/201703071200_radar.polar.ruudx.h5 \
data-east/201703071200_radar.polar.ruuwj.h5 \
--cExtract DATA,WEIGHT,COUNT \
--gTitle 'Rack Composite - ${what:date|%Y/%m}' -o tile-east.h5

Finally, the two composites are combined

rack 201703071200_radar.opera.h5 --cAdd tile-east.h5 --cAdd --cExtract dw -o composite-combined.h5
Definition AltitudeOp.cpp:42

Notice that the geometry is implicitly determined by the first composite data read (or projected).

Continuous compositing

It is also possible to continuously update a composite. It means that a previous composite is loaded as a "warm start" and --cAddWeighted command. The size and geometrical scope are set to those of the composite file. Fading with a low weight value is motivated by substituting missing radars with older measurements with however lower confidence.

rack composite.h5 --cAddWeighted 0.5 volume.h5 --cAdd --cExtract dwsc -o composite-new.h5
dot_inline_dotgraph_4.png

Utilities

Bounding box of input data

Minimal bounding box of input data, cropped by the bounding box of the composite, is stored in how:dataBBOX variable.

Adding lat-lon grid to Cartesian images

A grid of latitudes and longitudes can be added onto Cartesiand products with --cGrid. The following command creates a grid with 5 degree spacing in latitudes and longitudes, using width of 0.9 pixels and 50% gray intensity:

rack composite.h5 --palette default --cGrid 5,5,0.9,0.5 -o composite-grid.png

The input data – a Cartesian product – can be read as a file as in this example or generated from polar data with --cCreate .