Data reader for German Weather Service DX product raw radar data files.
This product uses a simple algorithm to compress zero values to reduce data file size.
While the format appears to be well defined, there have been reports on DX- files that seem to produce errors. e.g. while one file usually contains a 360 degree by 128 1km range bins, there are files, that contain 361 beams. Also, while usually azimuths are stored monotonously in ascending order, this is not guaranteed by the format. This routine does not (yet) check for this and directly returns the data in the order found in the file. If you are in doubt, check the ‘azim’ attribute. Be aware that this function does no extensive checking on its output. If e.g. beams contain different numbers of range bins, the resulting data will not be a 2-D array but a 1-D array of objects, which will most probably break calling code. It was decided to leave the handling of these (hopefully) rare events to the user, who might still be able to retrieve some reasonable data, instead of raising an exception, making it impossible to get any data from a file containing errors.
Parameters: filename (string) – binary file of DX raw data Returns:
- data (
numpy.array) – of image data [dBZ]; shape (360,128)
- attributes (dict) – dictionary of attributes - currently implemented keys:
- ’azim’ - azimuths np.array of shape (360,)
- ’elev’ - elevations (1 per azimuth); np.array of shape (360,)
- ’clutter’ - clutter mask; boolean array of same shape as data; corresponds to bit 15 set in each dataset.
- ’bytes’- the total product length (including header). Apparently, this value may be off by one byte for unknown reasons
- ’version’- a product version string - use unknown
- ’cluttermap’ - number of the (DWD internal) cluttermap used
- ’dopplerfilter’ - number of the dopplerfilter used (DWD internal)
- ’statfilter’ - number of a statistical filter used (DWD internal)
- ’elevprofile’ - as stated in the format description, this list indicates the elevations in the eight 45 degree sectors. These sectors need not start at 0 degrees north, so it is advised to explicitly evaluate the elev attribute, if elevation information is needed.
- ’message’ - additional text stored in the header.
- data (