Furuno#

import xarray as xr
from open_radar_data import DATASETS

import xradar as xd

Download#

Fetching Furuno radar data file from open-radar-data repository.

filename_scnx = DATASETS.fetch("2006_20220324_000000_000.scnx.gz")
filename_scn = DATASETS.fetch("0080_20210730_160000_01_02.scn.gz")
Downloading file '2006_20220324_000000_000.scnx.gz' from 'https://github.com/openradar/open-radar-data/raw/main/data/2006_20220324_000000_000.scnx.gz' to '/home/docs/.cache/open-radar-data'.
Downloading file '0080_20210730_160000_01_02.scn.gz' from 'https://github.com/openradar/open-radar-data/raw/main/data/0080_20210730_160000_01_02.scn.gz' to '/home/docs/.cache/open-radar-data'.

xr.open_dataset#

Making use of the xarray furuno backend.

scn format#

ds = xr.open_dataset(filename_scn, engine="furuno")
display(ds)
<xarray.Dataset> Size: 55MB
Dimensions:            (azimuth: 1376, range: 602)
Coordinates:
  * azimuth            (azimuth) float64 11kB 0.21 0.47 0.74 ... 359.7 359.9
    elevation          (azimuth) float64 11kB ...
    time               (azimuth) datetime64[ns] 11kB ...
  * range              (range) float32 2kB 25.0 75.0 ... 3.002e+04 3.008e+04
    longitude          float64 8B ...
    latitude           float64 8B ...
    altitude           float64 8B ...
Data variables: (12/14)
    RATE               (azimuth, range) float64 7MB ...
    DBZH               (azimuth, range) float64 7MB ...
    VRADH              (azimuth, range) float64 7MB ...
    ZDR                (azimuth, range) float64 7MB ...
    KDP                (azimuth, range) float64 7MB ...
    PHIDP              (azimuth, range) float64 7MB ...
    ...                 ...
    QUAL               (azimuth, range) uint16 2MB ...
    sweep_mode         <U20 80B ...
    sweep_number       int64 8B ...
    prt_mode           <U7 28B ...
    follow_mode        <U7 28B ...
    sweep_fixed_angle  float64 8B ...
Attributes:
    source:            Furuno
    version:           3
    radar_constant_h:  9.575470000000001e-17
    radar_constant_v:  9.144499999999999e-17

Plot Time vs. Azimuth#

ds.azimuth.plot(y="time")
[<matplotlib.lines.Line2D at 0x7d3074ca2900>]
../_images/2be1670d8a53b8f7693919de399a53cf24c3dd9f73accc7e1c68c9c231a24e6c.png

Plot Range vs. Time#

We need to sort by time and specify the y-coordinate.

ds.DBZH.sortby("time").plot(y="time")
<matplotlib.collections.QuadMesh at 0x7d3074d02cf0>
../_images/dacb8f5284bd1c9ef4885b59cacad231bf8c3ec20fb17464b41e73cb9ced69b4.png

Plot Range vs. Azimuth#

ds.DBZH.sortby("azimuth").plot(y="azimuth")
<matplotlib.collections.QuadMesh at 0x7d3074bb5f90>
../_images/426a0f3685f88e3ec737a65b7bb7b51a7ecf88bfa79bc4abdec33d297c43b23b.png

scnx format#

ds = xr.open_dataset(filename_scnx, engine="furuno")
display(ds)
<xarray.Dataset> Size: 45MB
Dimensions:            (azimuth: 722, range: 936)
Coordinates:
  * azimuth            (azimuth) float64 6kB 0.19 0.68 1.16 ... 359.2 359.7
    elevation          (azimuth) float64 6kB ...
    time               (azimuth) datetime64[ns] 6kB ...
  * range              (range) float32 4kB 37.5 112.5 ... 7.009e+04 7.016e+04
    longitude          float64 8B ...
    latitude           float64 8B ...
    altitude           float64 8B ...
Data variables: (12/14)
    RATE               (azimuth, range) float64 5MB ...
    DBZH               (azimuth, range) float64 5MB ...
    VRADH              (azimuth, range) float64 5MB ...
    ZDR                (azimuth, range) float64 5MB ...
    KDP                (azimuth, range) float64 5MB ...
    PHIDP              (azimuth, range) float64 5MB ...
    ...                 ...
    QUAL               (azimuth, range) uint16 1MB ...
    sweep_mode         <U20 80B ...
    sweep_number       int64 8B ...
    prt_mode           <U7 28B ...
    follow_mode        <U7 28B ...
    sweep_fixed_angle  float64 8B ...
Attributes:
    source:                     Furuno
    version:                    10
    antenna_gain_h:             33.7
    antenna_gain_v:             33.8
    radar_constant_h:           -129.4
    radar_constant_v:           -129.6
    noise_power_short_pulse_h:  -60.4
    xmit_power_h:               48.59738566197147
    xmit_power_v:               48.50033257689769
    half_power_beam_width_h:    2.75
    half_power_beam_width_v:    2.76

Plot Time vs. Azimuth#

ds.azimuth.plot(y="time")
[<matplotlib.lines.Line2D at 0x7d306b9ad940>]
../_images/186170b8c8a76719e746743949e8b61a638d21f803ae75ff4969471f5fea442a.png

Plot Range vs. Time#

We need to sort by time and specify the y-coordinate.

ds.DBZH.sortby("time").plot(y="time")
<matplotlib.collections.QuadMesh at 0x7d3076502710>
../_images/e43f6d3100c79d5d87aaa138ff7b1f723b09a6eab8b9ab7c2a47037bc4bcb1c5.png

Plot Range vs. Azimuth#

ds.DBZH.sortby("azimuth").plot(y="azimuth")
<matplotlib.collections.QuadMesh at 0x7d30763ec7d0>
../_images/7bd4a84984067bf9cd91dae724cc4e85d13c9f50f3cfe38727cd6a54e6269e4b.png

open_furuno_datatree#

Furuno scn/scnx files consist only of one sweep. But we might load and combine several sweeps into one DataTree.

dtree = xd.open_datatree(filename_scn, engine="furuno")
display(dtree)
<xarray.DataTree>
Group: /
│   Dimensions:              (sweep: 1)
│   Coordinates:
│       longitude            float64 8B ...
│       altitude             float64 8B ...
│       latitude             float64 8B ...
│   Dimensions without coordinates: sweep
│   Data variables:
│       volume_number        int64 8B ...
│       platform_type        <U5 20B ...
│       instrument_type      <U5 20B ...
│       time_coverage_start  <U20 80B ...
│       time_coverage_end    <U20 80B ...
│       sweep_fixed_angle    (sweep) float64 8B ...
│       sweep_group_name     (sweep) int64 8B ...
│   Attributes:
│       Conventions:      None
│       instrument_name:  None
│       version:          3
│       title:            None
│       institution:      None
│       references:       None
│       source:           Furuno
│       history:          None
│       comment:          im/exported using xradar
└── Group: /sweep_0
        Dimensions:            (azimuth: 1376, range: 602)
        Coordinates:
          * azimuth            (azimuth) float64 11kB 0.21 0.47 0.74 ... 359.7 359.9
            elevation          (azimuth) float64 11kB ...
            time               (azimuth) datetime64[ns] 11kB ...
          * range              (range) float32 2kB 25.0 75.0 ... 3.002e+04 3.008e+04
        Data variables: (12/14)
            RATE               (azimuth, range) float64 7MB ...
            DBZH               (azimuth, range) float64 7MB ...
            VRADH              (azimuth, range) float64 7MB ...
            ZDR                (azimuth, range) float64 7MB ...
            KDP                (azimuth, range) float64 7MB ...
            PHIDP              (azimuth, range) float64 7MB ...
            ...                 ...
            QUAL               (azimuth, range) uint16 2MB ...
            sweep_mode         <U20 80B ...
            sweep_number       int64 8B ...
            prt_mode           <U7 28B ...
            follow_mode        <U7 28B ...
            sweep_fixed_angle  float64 8B ...

Plot Sweep Range vs. Time#

dtree["sweep_0"].dataset.DBZH.plot()
<matplotlib.collections.QuadMesh at 0x7d307648bd90>
../_images/586784f8eeae93a45f92b3a9dd32eb43f1dcb38ae267071c75654b0e9fdf5868.png

Plot Sweep Range vs. Azimuth#

dtree["sweep_0"].dataset.DBZH.sortby("azimuth").plot(y="azimuth")
<matplotlib.collections.QuadMesh at 0x7d307638df90>
../_images/586784f8eeae93a45f92b3a9dd32eb43f1dcb38ae267071c75654b0e9fdf5868.png

Optional groups: radar_parameters#

With optional_groups=True the datatree also has the metadata groups. The Furuno reader fills radar_parameters with the half-power beam widths of the file header (the scn sample file has none).

dtree = xd.open_datatree(filename_scnx, engine="furuno", optional_groups=True)
display(dtree["radar_parameters"].dataset)
<xarray.DatasetView> Size: 16B
Dimensions:             ()
Data variables:
    radar_beam_width_h  float64 8B ...
    radar_beam_width_v  float64 8B ...
import numpy as np

np.testing.assert_almost_equal(dtree["radar_parameters"].radar_beam_width_h, 2.75)
np.testing.assert_almost_equal(dtree["radar_parameters"].radar_beam_width_v, 2.76)

Calibration of scnx files#

With optional_groups=True the datatree has the group radar_calibration. The scnx header gives the antenna gain, the transmit power, the radar constant and the noise power in tenths (Furuno WR2120 manual, data file type 3); xradar scales the values and sets units. The transmit power is given in W in the file, the group has it as xmit_power_h/xmit_power_v in dBm, the unit of CfRadial.

calib = dtree["radar_calibration"].dataset
display(calib)
<xarray.DatasetView> Size: 56B
Dimensions:                    ()
Data variables:
    antenna_gain_h             float64 8B ...
    antenna_gain_v             float64 8B ...
    noise_power_short_pulse_h  float64 8B ...
    radar_constant_h           float64 8B ...
    radar_constant_v           float64 8B ...
    xmit_power_h               float64 8B ...
    xmit_power_v               float64 8B ...
for name, var in calib.data_vars.items():
    print(f"{name:28s} {float(var):9.2f} {var.attrs['units']}")

# inside the ranges of the manual: antenna gain 30 to 40 dBi, transmit power 50 to 150 W
assert 30 <= calib.antenna_gain_h <= 40
transmit_power_w = 10 ** (float(calib.xmit_power_h) / 10) / 1e3
print(f"transmit power {transmit_power_w:.1f} W")
assert 50 <= transmit_power_w <= 150
antenna_gain_h                   33.70 dBi
antenna_gain_v                   33.80 dBi
noise_power_short_pulse_h       -60.40 dBZ
radar_constant_h               -129.40 dB
radar_constant_v               -129.60 dB
xmit_power_h                     48.60 dBm
xmit_power_v                     48.50 dBm
transmit power 72.4 W

The values are written to CfRadial1 files with these names.

xd.io.to_cfradial1(dtree, "furuno_scnx_cfradial1.nc", calibs=True)
with xr.open_dataset("furuno_scnx_cfradial1.nc") as ds:
    print(ds.r_calib_xmit_power_h.values, ds.r_calib_xmit_power_h.attrs["units"])
[48.59738566] dBm

The older scn format has no antenna gain or transmit power in its header and keeps the radar constant as it is in the file (mantissa and exponent), without units:

dtree_scn = xd.open_datatree(filename_scn, engine="furuno", optional_groups=True)
display(dtree_scn["radar_calibration"].dataset)
<xarray.DatasetView> Size: 16B
Dimensions:           ()
Data variables:
    radar_constant_h  float64 8B ...
    radar_constant_v  float64 8B ...