Rack - a weather radar data processing program

Introduction

Rack is a command-line program for processing weather radar data. It uses raw measurement data as input and generates Meteorological products as well as Cartesian conversions and composites . Rack also provides methods for Anomaly Detection and Removal (AnDRe) . Quality information is supported throughout the processing chain. Rack also supports Image processing , like applying colors and transparency.

Rack is based on code developed at the Finnish Meteorological Institute since 2001. Part of the development work has been supported by the BALTRAD project (2009-2014), see http://www.baltrad.eu . The program can be downloaded from https://github.com/fmidev/rack .

As input, Rack accepts azimuthal scans - volumes or separate sweeps - in HDF5 files using OPERA Information Model (ODIM, http://www.eumetnet.eu/opera).

After loading a volume file, a typical operation is to compute a single-radar product. The computation is carried out in polar coordinates. The result can be mapped to a Cartesian products. The projections are calculated using the Proj4 library (http://trac.osgeo.org/proj/). Output files can be written in HDF5 files, PNG image files or geo-referenced GeoTIFF files. In addition, metadata, resampled grid data and vertical profiles can be output as plain text files.

The overall data flow is illustrated below.

dot_inline_dotgraph_10.png

Usage

Command line arguments

A typical invocation of Rack looks like:

rack <input-files> <command> -o <file1> <command2> -o <file2> ...
Definition: DataSelector.cpp:44

The native format for data is HDF5, but data and be read or written partially using image and text format. See File input and output for details.

Specifically, Rack accepts three kinds of command line arguments:

  1. options without arguments, like –help
  2. options with arguments, like –outputFile product.h5
  3. plain arguments recognized as input filenames, like volume.h5 , serving as shorthand for –inputFile <file> .

The options are prefixed with double hyphen, "--". Some options have also a single hyphen "-", single-letter shorthand. (This argument syntax differs from POSIX and GNU conventions, e.g. -x -y cannot be grouped to -xy. ) All the arguments are handled in order; they can be thought as commands to be executed sequentially.

Usage info and a list of commands is dumped if –help or -h or no arguments are supplied:

rack --help

The list of commands is also listed in Section General commands.

Help is also available for invidual commands:

rack --help <command>

The version of the program is displayed with –version.
Other useful general commands are –verbose <level> and –status, which give debugging information of data flow and memory.

Meteorological products

Generation of a single-radar product is explained in section Meteorological products. The products are generated in polar coordinates, that is, in radar's native coordinate system.
A product may contain additional data arrays, typically quality indices or height information. As processing and using Doppler data involves special aspects, it is handled in it own section, Basic Doppler products.

A product can be further converted to Cartesian coordinate system, explained next.

Converting to Cartesian images

Data in polar coordinates can be mapped to a Cartesian product with –cCreate (abbreviated -c). The simplest possible command is

rack volume.h5 --cCreate -o cartesian.h5

which converts the first dataset (sweep) in volume.h5 to a Cartesian product. The default projection is azimuthal equidistant, centered at the radar. The projection can be changed with –cProj which uses Proj.4 syntax (http://trac.osgeo.org/proj/). The default size (bins x bins) can be changed with –cSize .

rack volume.h5 --cSize 400,400 --cProj '+proj=stere +lon_0=25.0 +lat_0=60.000' --cCreate -o cartesian-stere.h5
Data remapped with --cCreate , further coloured with --palette , displayed with a legend generated with --legendOut .

The above image contains some anomalies that can be detected and removed. See Anomaly Detection and Removal (AnDRe) for details.

Inside Rack , a single-radar Cartesian product is technically similar to a radar composite – it is a single-radar "composite". The related commands are prefixed with 'c'. Composite generation, projections, methods, and other options are explained in further detail in section Cartesian conversions and composites .

Selecting data

This command determines the data to be applied in subsequent input read or product generation commands.

In Rack, many operations implictly select a subset of available data instead of using it all. For example, in computing a Pseudo CAPPI image, DBZH data from single-PRF sweeps is used by default.

Synopsis

--select, -s <selector> (section: general)
Data selector for the next computation
selector=path,quantity,elangle,count,order,prf,timespan

Remarks on the options:

  • path argument defines a path segment to be matched, with desired index ranges (example: dataset2:4/data3:8 )
  • in path argument, a leading slash fixes the matching to the root (example: /dataset:/data: ), otherwise the tail part is matched
  • quantity argument accepts a list of strings separated by semicolon ':'
  • each item in a quantity argument list can be a literal string like DBZH or a regular experession like ^DBZ[HV]?$

See example sets below!

This option is useful in selecting data for:

The following command lines illustrate usage of –select in product generation and image output.

# For a Pseudo CAPPI product, change default input selection
rack volume.h5 --select 'quantity=^TH$,elangle=1.5:10,count=3' --pCappi 1500 -o pCappi-TH-1500m.h5
# For image output, select DBZH
rack volume.h5 --select elangle=1.5,quantity=DBZH -o volume-DBZH.png
# For image output, select VRAD of the lowest dual-PRF scan
rack volume.h5 --select quantity=VRAD:VRADH,order=ELANGLE:MIN,prf=DOUBLE -o volume-VRAD.png
# For image output, select ZDR of the highest single-PRF scan
rack volume.h5 --select quantity=ZDR,count=1,order=ELANGLE:MAX,prf=SINGLE -o volume-ZDR.png
# For single-image output, select DBZH of the lowest scan (from 90 6.5 2.4 1.8 1.2 0.59)
rack volume.h5 --select quantity=DBZH,order=ELANGLE:MIN -o volume-DBZH2.png
# For single-image output, select dBZ - preferably total dBZ - of the highest scan (from 90 6.5 2.4 1.8 1.2 0.59)
rack volume.h5 --select quantity=TH:TV:T:DBZH:DBZ,order=ELANGLE:MAX -o volume-DBZH3.png

The following examples are less realistic than those above, but are used in unit testing of the program code.

# Index range: select dataset3, including its subgroups.
rack volume.h5 --select /dataset3 -o volume-select.txt
# Index range: select DATASET groups with index 2...5, including subgroups.
rack volume.h5 --select /dataset2:5 -o volume-select.txt
# Index range test: select DATASET groups with index 3 at least.
rack volume.h5 --select /dataset3: -o volume-select.txt
# Index range test: select DATASET groups with index 3 at largest.
rack volume.h5 --select /dataset:3 -o volume-select.txt
# For text output, select paths ENDING with 'what', 'where', or 'how'.
rack volume.h5 --select 'what|where|how' -o volume-select.txt
# For text output, select paths of elevations of at least 6.0 degrees
rack volume.h5 --select elangle=6.0 -o volume-select.txt
# For text output, select paths of elevations up to 6.0 degrees
rack volume.h5 --select elangle=:6.0 -o volume-select.txt
# For text output, select 'where' groups of 3 lowest elevations from 0.5 degrees upwards
rack volume.h5 --select where,elangle=0.5:90.0,count=3 -o volume-select.txt
# For text output, select 'what' and 'where' groups of elevations from 0.5 to 6.0 degrees
rack volume.h5 --select 'what|where,elangle=0.5:6' -o volume-select.txt
# Select a unique quality field
rack volume.h5 --select quantity=CLASS-ETOP -o volume-select.txt
# Select all QIND fields
rack volume.h5 --select quantity=QIND -o volume-select.txt
# Select global (dataset-level) QIND fields
rack volume.h5 --select quantity=/QIND -o volume-select.txt
# Select quantity-specific (data-level) QIND fields
rack volume.h5 --select quantity=.+/QIND -o volume-select.txt
# Select quantity-specific (data-level) QIND field
rack volume.h5 --select quantity=DBZ-SLOPE-SMOOTH/QIND -o volume-select.txt
# Select non-existing quantity-specific QIND field
rack volume.h5 --select quantity=HGHT/QIND -o volume-select.txt
See also
CmdDelete
CmdKeep
CmdSetODIM
rack::CmdSelect (code)
rack::DataSelector (code)

Selecting by quantity only

Most commands apply implicit input data selection criteria, typically involving data paths, quantities and/or elevation angles.

Like in general in Rack, the parameters of –select are positional (ordered), meaning that they can be issued as a comma-separated string without explicit names (keywords), as long as they are given in order. The parameters are:

  • path is a string of path elements, separated by slash '/' and consisting of:
    • a leading single slash '/', if rooted matching is desired ie. leading parts of the paths are tested; otherwise trailing parts
    • what , where, how - ie. the groups containing attributes
    • dataset{min}:{max} , data{min}:{max} , quality{min}:{max} - indexed groups containing subgroups for actual data and attributes
    • data - unindexed groups containing actual data arrays
    • combined selection elements created by concatenating above elements with pipe '|' representing logical OR function (requires escaping on command line)
      • example: what|where|dataset1:3
    • in index ranges, values can be omitted, using invoking default minimum (1) and maximum (0xffff = 65535) as follows:
      • data: equals data1:65535; further the colon ':' can be omitted for dataset and quality (but not for data: , to bypass naming conflict inherent in ODIM )
      • data{index} equals data{index}:{index} (ie. exact match)
      • data{index}: equals data{index}:65535
      • data:{index} equals data1:{index}
    • in each combined selection element, only one index range can be given, referring to all indexed elements, and it must be given as the last segment
      • example: what|data|quality1:5 matches what, data1:5 and quality1:5
      • example: what|where|dataset1:3/what|data1:8 – index ranges can vary on different levels, ie. in slash-separated elements
  • quantity is a regular expression
    • example: ^DBZH$, accepting DBZH only
    • example: (DBZH|TH) accepts DBZH and TH , but also DBZHC and WIDTH ...
    • future option: two regular expressions separated by a slash, the latter regExp determining the desired quality quantities
  • elangle defines the range of antenna elevations accepted, range limits included
    • unlike with path selectors, elangle={angle} abbreviates elangle={angle}:90 (not elangle={angle}:{angle})
    • notice that metadata may contain floating point values like 1.000004723, use count=1 to pick a single one within a range
  • count is the upper limit of accepted indices of dataset ; typically used with elangle
  • order defines criteria (DATA|TIME|ELANGLE) and operation (MIN|MAX) in selecting data, applied with count. Note that the lowest elevations can be measured the latest, appearing as dataset 's with highest indices.
  • dualPRF determines if sweeps using dual pulse repetition frequency is required (1), accepted like single one (0), or excluded (-1).

The selection functionality is best explained with examples.

# For a Pseudo CAPPI product, change default input selection
rack volume.h5 --select 'quantity=^TH$,elangle=1.5:10,count=3' --pCappi 1500 -o pCappi-TH-1500m.h5
# For image output, select DBZH
rack volume.h5 --select elangle=1.5,quantity=DBZH -o volume-DBZH.png
# For image output, select VRAD of the lowest dual-PRF scan
rack volume.h5 --select quantity=VRAD:VRADH,order=ELANGLE:MIN,prf=DOUBLE -o volume-VRAD.png
# For image output, select ZDR of the highest single-PRF scan
rack volume.h5 --select quantity=ZDR,count=1,order=ELANGLE:MAX,prf=SINGLE -o volume-ZDR.png
# For single-image output, select DBZH of the lowest scan (from 90 6.5 2.4 1.8 1.2 0.59)
rack volume.h5 --select quantity=DBZH,order=ELANGLE:MIN -o volume-DBZH2.png
# For single-image output, select dBZ - preferably total dBZ - of the highest scan (from 90 6.5 2.4 1.8 1.2 0.59)
rack volume.h5 --select quantity=TH:TV:T:DBZH:DBZ,order=ELANGLE:MAX -o volume-DBZH3.png

Note that escaping special characters like '|' is often required on command line.

Often, the first data array matching the criteria are used.

One can explicitly change the criteria with –select (-s) command . For example, in data conversions one may wish to focus on certain quantity – like DBZH or VRAD – not all the data.

The selection command can be applied the most commands processing data. In computing meteorological products (Product generation) an compositing, it affects the following product only. In case of anomaly detectors (Anomaly Detection and Removal (AnDRe)), it applies to all subsequent operators.

Note that some processing commands may not support explicit data selection. Set selection criteria strictly to one quantity . Selecting quantities only is frequently needed, so there is a dedicated command –selectQuantity (-Q ) which accepts comma-separated simple patterns (with * and ?) instead of regular expressions. For example, -Q DBZH*,QIND is equal to –select quantity='^(DBZH.*|QIND)$' .

Data selected with -Q RHOHV and coloured with --palette.

Defining target data properties

The desired output storage type, scaling, and encoding can be set with –encoding command. Depending on the following command, a varying set of properties will be supported. The general form of –encoding command is

rack <input> --encoding <type>,<gain>,<offset>,<undetect>,<nodata> <commands>

and for polar products and conversions, the extended form is:

rack <input> --encoding <type>,<gain>,<offset>,<undetect>,<nodata>,<rscale>,<nrays>,<nbins> <commands>

One may set one or more properties by giving only N first ones. Also key=value forms are supported.
The typical choices for storage type are 'C' (unsigned char), 'S' (unsigned short int) and 'd' (double precision float). The next parameters gain and offset define the mapping between bit values and the physical quantity: f = gain * x + offset .
In ODIM standard, undetect marks the data where a measurement value falls under a sensitivity limit and nodata marks areas where no measurement at all is available. Also grid geometry (nbins , nrays and rscale ) can be set when applicable. For example, producing a polar product (here 500m CAPPI, see Meteorological products) with some desired properties is given by:

rack volume.h5 --encoding C,0.4,-20,rscale=1000,nbins=250 --pCappi 500 -o cappi-500.h5

Rack provides default encodings for some quantities. The configuration can be listed and changed with –quantityConf command.

As to hierarchical structure of resulting products, the default location of computed meteorological products and Composites is /dataset1/data1 . Any previous results are overwritten. This can be changed by means of –append command: one can combine several products in same dataset group, adding a new data group, or append a new dataset group.

For modifying existing data, see Modifying data .

Default encoding of quantities

Measurement parameters in radar have a varying scale. For example, DBZH is typically between -32dBZ and 50dBZ whereas RHOHV ranges between 0.0 and 1.0. Further, different storage types can be used, and the resulting value range should be compatible with the encoding. In some cases, like in creating radar image composites, Rack can use predefined storage types and encoding. The following examples illustrate the usage

rack --quantityConf DBZH:S # for encoding dBZ, use unsigned short int, with default scaling
rack --quantityConf DBZH:C,0.6,-30 # for encoding dBZ, use unsigned char, with gain=0.5 and offset=-32

The arguments can be named explicitly, as in the case of –select and –encoding . The encoding of a given quantity is displayed if the quantity is issued without type specifier character. A quantity can be also assigned zero, a "virtual" physical small value to be applied instead of undetect marker.

rack --quantityConf 'DBZH'

yelding

DBZH
*C,"what:gain"=0.5,"what:nodata"=255,"what:offset"=-32,"what:type"="C","what:undetect"=0 (min=-31.5)
S,"what:gain"=0.01,"what:nodata"=65535,"what:offset"=-327.68,"what:type"="S","what:undetect"=0 (min=-327.67)
virtual zero=-32

where asterisk * marks the current default storage type and scaling.

The full list of predefined quantity encodings are listed with

rack --quantityConf ''

One may freely add encodings simply by setting them with –quantityConf

Author
Markus Peura, Seppo Pulkkinen (HDF5 support), Joonas Karjalainen