Reading FURUNO Data

FURUNO data are HDF5 or SCN/SCNX files. In order to access the functions of WRaINfo, you have to import wrainfo in your Python environment.

import wrainfo as wrf

Note

For the examples, data of the WR2120 from the Weather Radar FURUNO are used.

Import packages

For reading the SCN/SCNX files xarray backend was implemented in \(\omega radlib\). To begin with the following packages have to be imported.

[2]:
import wradlib as wrl
import xarray as xr
import datetime as dt

Load FURUNO HDF5 Data

Furuno HDF5 single data can be loaded as xarray dataset. If the keyword argument “reindex_angle” is False, then the original azimuth angles are loaded. Here is an example with original azimuth angles.

[3]:
file_path="/tests/data/raw/2022/02/16/2006_20220216_134500.h5"
[4]:
file_hdf5=xr.open_dataset(file_path,
                          engine="odim",
                          group="dataset1",
                          backend_kwargs=dict(reindex_angle=False))
display(file_hdf5)
<xarray.Dataset>
Dimensions:     (azimuth: 721, range: 936)
Coordinates:
  * azimuth     (azimuth) float64 0.545 1.05 1.535 2.04 ... 359.0 359.5 0.04
    elevation   (azimuth) float64 0.5 0.5 0.5 0.5 0.5 ... 0.5 0.5 0.5 0.5 0.5
    rtime       (azimuth) datetime64[ns] 2022-02-16T13:45:28.980652544 ... 20...
  * range       (range) float32 37.5 112.5 187.5 ... 7.009e+04 7.016e+04
    time        datetime64[ns] 2022-02-16T13:45:01
    sweep_mode  <U20 'azimuth_surveillance'
    longitude   float64 13.24
    latitude    float64 53.55
    altitude    float64 38.0
Data variables:
    RATE        (azimuth, range) float32 ...
    DBZH        (azimuth, range) float32 ...
    VRAD        (azimuth, range) float32 ...
    ZDR         (azimuth, range) float32 ...
    KDP         (azimuth, range) float32 ...
    PHIDP       (azimuth, range) float32 ...
    RHOHV       (azimuth, range) float32 ...
    WRAD        (azimuth, range) float32 ...
    QC_INFO     (azimuth, range) float32 ...
Attributes:
    fixed_angle:  0.5

Note

Due to the jitter of the azimuth angles we read the data with a reindex angle of 1.0.

The group argument sets the elevation angle that is read.

We can also load multiple HDF5 datasets as one xarray dataset. For this we create a file list with WRaINfo. Then we load all files by linking them over time.

[5]:
flist=wrf.create_filelist(starttime=dt.datetime(2022,2,16,13,40),
                          endtime=dt.datetime(2022,2,16,14,45),
                          path="/tests/data/test_settings_wrainfo.json",
                          pattern='_000.scnx.gz')
[6]:
ds_hdf5 = xr.open_mfdataset(flist,
                            engine="odim",
                            combine ="nested",
                            concat_dim="time",
                            group="dataset1",
                            backend_kwargs=dict(reindex_angle=1.0))
display(ds_hdf5)
<xarray.Dataset>
Dimensions:     (azimuth: 720, time: 3, range: 936)
Coordinates:
  * azimuth     (azimuth) float64 0.25 0.75 1.25 1.75 ... 358.8 359.2 359.8
    elevation   (azimuth) float64 dask.array<chunksize=(720,), meta=np.ndarray>
    rtime       (time, azimuth) datetime64[ns] dask.array<chunksize=(1, 720), meta=np.ndarray>
  * range       (range) float32 37.5 112.5 187.5 ... 7.009e+04 7.016e+04
  * time        (time) datetime64[ns] 2022-02-16T13:45:01 ... 2022-02-16T13:5...
    sweep_mode  <U20 'azimuth_surveillance'
    longitude   float64 13.24
    latitude    float64 53.55
    altitude    float64 38.0
Data variables:
    RATE        (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    DBZH        (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    VRAD        (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    ZDR         (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    KDP         (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    PHIDP       (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    RHOHV       (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    WRAD        (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    QC_INFO     (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
Attributes:
    fixed_angle:  0.5

Load FURUNO SCN/SCNX raw data

When we load SCN/SCNX data, there are small differences. First we load a single file again.

[7]:
file_path="/tests/data/raw/2022/04/05/2006_20220405_123000_000.scnx.gz"
[8]:
file_scnx = xr.open_dataset(file_path,
                            engine="furuno",
                            group="group1",
                            backend_kwargs=dict(reindex_angle=1.0))
display(file_scnx)
<xarray.Dataset>
Dimensions:     (azimuth: 720, range: 936)
Coordinates:
  * azimuth     (azimuth) float32 0.25 0.75 1.25 1.75 ... 358.8 359.2 359.8
    elevation   (azimuth) float32 0.5 0.5 0.5 0.5 0.5 ... 0.5 0.5 0.5 0.5 0.5
  * range       (range) float32 37.5 112.5 187.5 ... 7.009e+04 7.016e+04
    time        datetime64[ns] 2022-04-05T12:30:01
    rtime       (azimuth) datetime64[ns] 2022-04-05T12:30:09.601952500 ... 20...
    longitude   float64 13.24
    latitude    float64 53.55
    altitude    float64 38.0
    sweep_mode  <U20 'azimuth_surveillance'
Data variables:
    RATE        (azimuth, range) float32 ...
    DBZH        (azimuth, range) float32 ...
    VRADH       (azimuth, range) float32 ...
    ZDR         (azimuth, range) float32 ...
    KDP         (azimuth, range) float32 ...
    PHIDP       (azimuth, range) float32 ...
    RHOHV       (azimuth, range) float32 ...
    WRADH       (azimuth, range) float32 ...
    QUAL        (azimuth, range) uint16 ...
Attributes:
    fixed_angle:  0.5

Note

For each elevation angle there exists an SCN/SCNX file, reason why we do not choose the “group”. The “group” argument is default to “group1”.

We can load multiple files as follows. At first we have to create a file list again.

[9]:
flist=wrf.create_filelist(starttime=dt.datetime(2022,4,5,12,30),
                          endtime=dt.datetime(2022,4,5,12,50),
                          path="/tests/data/test_settings_wrainfo.json",
                          pattern='_000.scnx.gz')
[10]:
ds_scnx = xr.open_mfdataset(flist,
                            engine="furuno",
                            combine ="nested",
                            concat_dim="time",
                            group="group1",
                            backend_kwargs=dict(reindex_angle=1.0))
display(ds_scnx)
<xarray.Dataset>
Dimensions:     (azimuth: 720, time: 3, range: 936)
Coordinates:
  * azimuth     (azimuth) float32 0.25 0.75 1.25 1.75 ... 358.8 359.2 359.8
    elevation   (azimuth) float32 dask.array<chunksize=(720,), meta=np.ndarray>
  * range       (range) float32 37.5 112.5 187.5 ... 7.009e+04 7.016e+04
  * time        (time) datetime64[ns] 2022-04-05T12:30:01 ... 2022-04-05T12:4...
    rtime       (time, azimuth) datetime64[ns] dask.array<chunksize=(1, 720), meta=np.ndarray>
    longitude   float64 13.24
    latitude    float64 53.55
    altitude    float64 38.0
    sweep_mode  <U20 'azimuth_surveillance'
Data variables:
    RATE        (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    DBZH        (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    VRADH       (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    ZDR         (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    KDP         (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    PHIDP       (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    RHOHV       (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    WRADH       (time, azimuth, range) float32 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
    QUAL        (time, azimuth, range) uint16 dask.array<chunksize=(1, 720, 936), meta=np.ndarray>
Attributes:
    fixed_angle:  0.5

Rename a variable

For further processing steps we have to rename the variable “VRADH” because this is called “VRAD” by default in the other functions.

[11]:
# rename VRADH to VRAD
file_scnx['VRAD'] = file_scnx['VRADH']

# remove the variable VRADH
file_scnx_new = file_scnx.drop(['VRADH'])

display(file_scnx_new)
<xarray.Dataset>
Dimensions:     (azimuth: 720, range: 936)
Coordinates:
  * azimuth     (azimuth) float32 0.25 0.75 1.25 1.75 ... 358.8 359.2 359.8
    elevation   (azimuth) float32 0.5 0.5 0.5 0.5 0.5 ... 0.5 0.5 0.5 0.5 0.5
  * range       (range) float32 37.5 112.5 187.5 ... 7.009e+04 7.016e+04
    time        datetime64[ns] 2022-04-05T12:30:01
    rtime       (azimuth) datetime64[ns] 2022-04-05T12:30:09.601952500 ... 20...
    longitude   float64 13.24
    latitude    float64 53.55
    altitude    float64 38.0
    sweep_mode  <U20 'azimuth_surveillance'
Data variables:
    RATE        (azimuth, range) float32 ...
    DBZH        (azimuth, range) float32 ...
    ZDR         (azimuth, range) float32 ...
    KDP         (azimuth, range) float32 ...
    PHIDP       (azimuth, range) float32 ...
    RHOHV       (azimuth, range) float32 ...
    WRADH       (azimuth, range) float32 ...
    QUAL        (azimuth, range) uint16 ...
    VRAD        (azimuth, range) float32 ...
Attributes:
    fixed_angle:  0.5

Fix bugs of elevation angles

In the example dataset above there exists maybe an incorrect value in the data array “elevation”. We fix this error as follows:

[12]:
# median over the elevation dataset
elev  = file_scnx_new.elevation.median(dim="azimuth")

# set the median to the dataset
file_scnx_new["elevation"][:] = elev

Plot FURUNO raw data

If you want to plot some raw data, you can do it as under. Here a plot of the raw reflectivity “DBZH”.

[13]:
import matplotlib.pyplot as plt
[14]:
file_scnx_new.DBZH.plot(cmap="jet")
[14]:
<matplotlib.collections.QuadMesh at 0x1475317a9af0>
../_images/jupyter_notebooks_read_furuno_data_31_1.png

Note

In this plot you see the raw reflectivity of the weather radar FURUNO. In the reflectivity there are some artefacts, which we will correct with the WRaINfo package on the following pages.

With the \(\omega radlib\) package it is possible to georeference the dataset for a plot. For this we use:

[15]:
# georeferencing the dataset
ds_georef = file_scnx_new.pipe(wrl.georef.georeference_dataset)

# plot the data with x and y coordinates
file_scnx_new.DBZH.plot(x="x", y="y", cmap="jet")
[15]:
<matplotlib.collections.QuadMesh at 0x147531956910>
../_images/jupyter_notebooks_read_furuno_data_34_1.png