xradar furuno backend#
In this example, we read scn/scnx (furuno) data files using the xradar furuno xarray backend.
import glob
import gzip
import io
import wradlib as wrl
import wradlib_data
import warnings
from IPython.display import display
import matplotlib.pyplot as plt
import numpy as np
import xradar as xd
import xarray as xr
warnings.filterwarnings("ignore")
Load furuno scn Data#
Data provided by University of Graz, Austria.
fpath = "furuno/0080_20210730_160000_01_02.scn.gz"
f = wradlib_data.DATASETS.fetch(fpath)
vol = xd.io.open_furuno_datatree(f, reindex_angle=False)
Downloading file 'furuno/0080_20210730_160000_01_02.scn.gz' from 'https://github.com/wradlib/wradlib-data/raw/main/data/furuno/0080_20210730_160000_01_02.scn.gz' to '/home/docs/.cache/wradlib-data'.
Inspect scn RadarVolume#
display(vol)
<xarray.DataTree>
Group: /
β Dimensions: (sweep: 1)
β Coordinates:
β longitude float64 8B 15.45
β altitude float64 8B 407.9
β latitude float64 8B 47.08
β Dimensions without coordinates: sweep
β Data variables:
β volume_number int64 8B 0
β platform_type <U5 20B 'fixed'
β instrument_type <U5 20B 'radar'
β time_coverage_start <U20 80B '2021-07-30T16:00:00Z'
β time_coverage_end <U20 80B '2021-07-30T16:00:14Z'
β sweep_group_name (sweep) int64 8B 0
β sweep_fixed_angle (sweep) float64 8B 7.8
β 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 2021-07-30T16:00:06.2777...
* 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 ...Inspect scn root group#
The sweep dimension contains the number of scans in this radar volume. Further the dataset consists of variables (location coordinates, time_coverage) and attributes (Conventions, metadata).
vol.root
<xarray.DataTree>
Group: /
β Dimensions: (sweep: 1)
β Coordinates:
β longitude float64 8B 15.45
β altitude float64 8B 407.9
β latitude float64 8B 47.08
β Dimensions without coordinates: sweep
β Data variables:
β volume_number int64 8B 0
β platform_type <U5 20B 'fixed'
β instrument_type <U5 20B 'radar'
β time_coverage_start <U20 80B '2021-07-30T16:00:00Z'
β time_coverage_end <U20 80B '2021-07-30T16:00:14Z'
β sweep_group_name (sweep) int64 8B 0
β sweep_fixed_angle (sweep) float64 8B 7.8
β 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 2021-07-30T16:00:06.2777...
* 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 ...Inspect scn sweep group(s)#
The sweep-groups can be accessed via their respective keys. The dimensions consist of range and time with added coordinates azimuth, elevation, range and time. There will be variables like radar moments (DBZH etc.) and sweep-dependent metadata (like fixed_angle, sweep_mode etc.).
display(vol["sweep_0"])
<xarray.DataTree 'sweep_0'>
Group: /sweep_0
Dimensions: (sweep: 1, 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 2021-07-30T16:00:06.2777...
* range (range) float32 2kB 25.0 75.0 ... 3.002e+04 3.008e+04
Dimensions without coordinates: sweep
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 ...Georeferencing scn#
swp = vol["sweep_0"].to_dataset(inherit="all_coords")
swp = swp.assign_coords(sweep_mode=swp.sweep_mode)
swp = swp.wrl.georef.georeference()
Inspect scn radar moments#
The DataArrays can be accessed by key or by attribute. Each DataArray has dimensions and coordinates of its parent dataset.
display(swp.DBZH)
<xarray.DataArray 'DBZH' (azimuth: 1376, range: 602)> Size: 7MB
[828352 values with dtype=float64]
Coordinates: (12/15)
* azimuth (azimuth) float64 11kB 0.21 0.47 0.74 1.0 ... 359.4 359.7 359.9
elevation (azimuth) float64 11kB 7.8 7.8 7.8 7.8 7.8 ... 7.8 7.8 7.8 7.8
time (azimuth) datetime64[ns] 11kB 2021-07-30T16:00:06.277723500 ....
* range (range) float32 2kB 25.0 75.0 125.0 ... 3.002e+04 3.008e+04
x (azimuth, range) float64 7MB 0.09078 0.2723 ... -31.13 -31.19
y (azimuth, range) float64 7MB 24.77 74.3 ... 2.973e+04 2.978e+04
... ...
bins (azimuth, range) float32 3MB 25.0 75.0 ... 3.002e+04 3.008e+04
sweep_mode <U20 80B 'azimuth_surveillance'
longitude float64 8B 15.45
altitude float64 8B 407.9
latitude float64 8B 47.08
crs_wkt int64 8B 0
Attributes:
long_name: Equivalent reflectivity factor H
units: dBZ
standard_name: radar_equivalent_reflectivity_factor_hCreate scn simple plot#
Using xarray features a simple plot can be created like this. Note the sortby('time') method, which sorts the radials by time.
For more details on plotting radar data see under Visualization.
swp.DBZH.sortby("time").plot(x="range", y="time", add_labels=False)
<matplotlib.collections.QuadMesh at 0x7fb3ff1597f0>
fig = plt.figure(figsize=(5, 5))
pm = swp.DBZH.wrl.vis.plot(crs={"latmin": 3e3}, fig=fig)
Load furuno scnx Data#
Data provided by GFZ German Research Centre for Geosciences.
fpath = "furuno/2006_20220324_000000_000.scnx.gz"
f = wradlib_data.DATASETS.fetch(fpath)
vol = xd.io.open_furuno_datatree(f, reindex_angle=False)
Downloading file 'furuno/2006_20220324_000000_000.scnx.gz' from 'https://github.com/wradlib/wradlib-data/raw/main/data/furuno/2006_20220324_000000_000.scnx.gz' to '/home/docs/.cache/wradlib-data'.
Inspect scnx RadarVolume#
display(vol)
<xarray.DataTree>
Group: /
β Dimensions: (sweep: 1)
β Coordinates:
β longitude float64 8B 13.24
β altitude float64 8B 38.0
β latitude float64 8B 53.55
β Dimensions without coordinates: sweep
β Data variables:
β volume_number int64 8B 0
β platform_type <U5 20B 'fixed'
β instrument_type <U5 20B 'radar'
β time_coverage_start <U20 80B '2022-03-24T00:00:01Z'
β time_coverage_end <U20 80B '2022-03-24T00:00:28Z'
β sweep_group_name (sweep) int64 8B 0
β sweep_fixed_angle (sweep) float64 8B 0.5
β Attributes:
β Conventions: None
β instrument_name: None
β version: 10
β title: None
β institution: None
β references: None
β source: Furuno
β history: None
β comment: im/exported using xradar
βββ Group: /sweep_0
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 2022-03-24T00:00:17.65643...
* range (range) float32 4kB 37.5 112.5 ... 7.009e+04 7.016e+04
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 ...Inspect scnx root group#
The sweep dimension contains the number of scans in this radar volume. Further the dataset consists of variables (location coordinates, time_coverage) and attributes (Conventions, metadata).
vol.root
<xarray.DataTree>
Group: /
β Dimensions: (sweep: 1)
β Coordinates:
β longitude float64 8B 13.24
β altitude float64 8B 38.0
β latitude float64 8B 53.55
β Dimensions without coordinates: sweep
β Data variables:
β volume_number int64 8B 0
β platform_type <U5 20B 'fixed'
β instrument_type <U5 20B 'radar'
β time_coverage_start <U20 80B '2022-03-24T00:00:01Z'
β time_coverage_end <U20 80B '2022-03-24T00:00:28Z'
β sweep_group_name (sweep) int64 8B 0
β sweep_fixed_angle (sweep) float64 8B 0.5
β Attributes:
β Conventions: None
β instrument_name: None
β version: 10
β title: None
β institution: None
β references: None
β source: Furuno
β history: None
β comment: im/exported using xradar
βββ Group: /sweep_0
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 2022-03-24T00:00:17.65643...
* range (range) float32 4kB 37.5 112.5 ... 7.009e+04 7.016e+04
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 ...Inspect scnx sweep group(s)#
The sweep-groups can be accessed via their respective keys. The dimensions consist of range and time with added coordinates azimuth, elevation, range and time. There will be variables like radar moments (DBZH etc.) and sweep-dependent metadata (like fixed_angle, sweep_mode etc.).
display(vol["sweep_0"])
<xarray.DataTree 'sweep_0'>
Group: /sweep_0
Dimensions: (sweep: 1, 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 2022-03-24T00:00:17.65643...
* range (range) float32 4kB 37.5 112.5 ... 7.009e+04 7.016e+04
Dimensions without coordinates: sweep
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 ...Georeferencing scnx#
swp = vol["sweep_0"].to_dataset(inherit="all_coords")
swp = swp.assign_coords(sweep_mode=swp.sweep_mode)
swp = swp.wrl.georef.georeference()
Inspect scnx radar moments#
The DataArrays can be accessed by key or by attribute. Each DataArray has dimensions and coordinates of its parent dataset.
display(swp.DBZH)
<xarray.DataArray 'DBZH' (azimuth: 722, range: 936)> Size: 5MB
[675792 values with dtype=float64]
Coordinates: (12/15)
* azimuth (azimuth) float64 6kB 0.19 0.68 1.16 1.69 ... 358.7 359.2 359.7
elevation (azimuth) float64 6kB 0.5 0.5 0.5 0.5 0.5 ... 0.5 0.5 0.5 0.5
time (azimuth) datetime64[ns] 6kB 2022-03-24T00:00:17.656439500 .....
* range (range) float32 4kB 37.5 112.5 187.5 ... 7.009e+04 7.016e+04
x (azimuth, range) float64 5MB 0.1243 0.373 ... -403.6 -404.0
y (azimuth, range) float64 5MB 37.5 112.5 ... 7.008e+04 7.015e+04
... ...
bins (azimuth, range) float32 3MB 37.5 112.5 ... 7.009e+04 7.016e+04
sweep_mode <U20 80B 'azimuth_surveillance'
longitude float64 8B 13.24
altitude float64 8B 38.0
latitude float64 8B 53.55
crs_wkt int64 8B 0
Attributes:
long_name: Equivalent reflectivity factor H
units: dBZ
standard_name: radar_equivalent_reflectivity_factor_hCreate scnx simple plot#
Currently the data dynamic range is left as read from the file. That way the difference between shortpulse and longpulse can be clearly seen.
Using xarray features a simple plot can be created like this. Note the sortby('time') method, which sorts the radials by time.
For more details on plotting radar data see under Visualization.
swp.DBZH.sortby("time").plot(x="range", y="time", add_labels=False)
<matplotlib.collections.QuadMesh at 0x7fb3fc39fed0>
fig = plt.figure(figsize=(5, 5))
pm = swp.DBZH.wrl.vis.plot(crs={"latmin": 3e3}, fig=fig)
More Furuno loading mechanisms#
Use xr.open_dataset to retrieve explicit group#
swp_b = xr.open_dataset(f, engine="furuno", backend_kwargs=dict(reindex_angle=False))
display(swp_b)
<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: 337
antenna_gain_v: 338
tx_power_h: 724
tx_power_v: 708
radar_constant_h: -1294
radar_constant_v: -1296
noise_power_short_pulse_h: -604