Iris/Sigmet - Reader#
import numpy as np
import xarray as xr
from open_radar_data import DATASETS
import xradar as xd
Download#
Fetching Iris radar data file from open-radar-data repository.
filename_single = DATASETS.fetch("SUR210819000227.RAWKPJV")
filename_volume = DATASETS.fetch("cor-main131125105503.RAW2049")
Downloading file 'SUR210819000227.RAWKPJV' from 'https://github.com/openradar/open-radar-data/raw/main/data/SUR210819000227.RAWKPJV' to '/home/docs/.cache/open-radar-data'.
Downloading file 'cor-main131125105503.RAW2049' from 'https://github.com/openradar/open-radar-data/raw/main/data/cor-main131125105503.RAW2049' to '/home/docs/.cache/open-radar-data'.
xr.open_dataset#
Making use of the xarray iris backend. We also need to provide the group. We use the group notation from CfRadial2.
ds = xr.open_dataset(filename_single, group="sweep_0", engine="iris")
display(ds)
<xarray.Dataset> Size: 13MB
Dimensions: (azimuth: 359, range: 833)
Coordinates:
* azimuth (azimuth) float32 1kB 0.03021 1.035 2.054 ... 358.0 359.0
elevation (azimuth) float32 1kB ...
time (azimuth) datetime64[ns] 3kB ...
* range (range) float32 3kB 150.0 450.0 ... 2.494e+05 2.498e+05
longitude float64 8B ...
latitude float64 8B ...
altitude float64 8B ...
Data variables: (12/16)
DBTH (azimuth, range) float32 1MB ...
DBZH (azimuth, range) float32 1MB ...
VRADH (azimuth, range) float32 1MB ...
WRADH (azimuth, range) float32 1MB ...
ZDR (azimuth, range) float32 1MB ...
KDP (azimuth, range) float32 1MB ...
... ...
SNRH (azimuth, range) float32 1MB ...
sweep_mode <U20 80B ...
sweep_number int64 8B ...
prt_mode <U7 28B ...
follow_mode <U7 28B ...
sweep_fixed_angle float64 8B ...
Attributes:
source: Sigmet
scan_name: PPI1_H
instrument_name: Surgavere, Radar
comment: Dual pol 250km hybrid surveillance task 0.5 de...
radar_constant_h: 63.2
radar_constant_v: 66.2
noise_hc: -82.39
noise_vc: -83.09
pulse_width: 2e-06
radar_beam_width_h: 0.9500000439584255
radar_beam_width_v: 0.9500000439584255
radar_receiver_bandwidth: 559000.0Plot Time vs. Azimuth#
ds.azimuth.plot(y="time")
[<matplotlib.lines.Line2D at 0x7a7eecbdecf0>]
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 0x7a7eec9cb230>
Plot Range vs. Azimuth#
ds.DBZH.plot(y="azimuth")
<matplotlib.collections.QuadMesh at 0x7a7eec8f6350>
backend_kwargs#
Beside first_dim there are several additional backend_kwargs for the iris backend, which handle different aspects of angle alignment. This comes into play, when azimuth and/or elevation arrays are not evenly spacend and other issues.
help(xd.io.IrisBackendEntrypoint)
Help on class IrisBackendEntrypoint in module xradar.io.backends.iris:
class IrisBackendEntrypoint(xarray.backends.common.BackendEntrypoint)
| Xarray BackendEntrypoint for IRIS/Sigmet data.
|
| Method resolution order:
| IrisBackendEntrypoint
| xarray.backends.common.BackendEntrypoint
| builtins.object
|
| Methods defined here:
|
| guess_can_open(self, filename_or_obj)
| IRIS/Sigmet RAW file (``product_hdr`` structure, RAW product).
|
| open_dataset(
| self,
| filename_or_obj,
| *,
| mask_and_scale=True,
| decode_times=True,
| concat_characters=True,
| decode_coords=True,
| drop_variables=None,
| use_cftime=None,
| decode_timedelta=None,
| group=None,
| lock=None,
| first_dim='auto',
| reindex_coord=None,
| reindex_angle=False,
| fix_second_angle=False,
| site_as_coords=True,
| optional=True
| )
| Backend open_dataset method used by Xarray in :py:func:`~xarray.open_dataset`.
|
| open_datatree(self, filename_or_obj, **kwargs)
| Open an Iris/Sigmet RAW file as :py:class:`xarray.DataTree`. See :meth:`open_groups_as_dict` for keyword arguments.
|
| open_groups_as_dict(
| self,
| filename_or_obj,
| *,
| mask_and_scale=True,
| decode_times=True,
| concat_characters=True,
| decode_coords=True,
| drop_variables=None,
| use_cftime=None,
| decode_timedelta=None,
| lock=None,
| first_dim='auto',
| reindex_coord=None,
| reindex_angle=False,
| fix_second_angle=False,
| site_coords=True,
| sweep=None,
| optional=True,
| optional_groups=False
| )
| Open an Iris/Sigmet RAW file as a CfRadial2-shaped dict of group datasets.
|
| Parameters
| ----------
| filename_or_obj : str, Path, or file-like
| Path or file-like object understood by the underlying reader.
| mask_and_scale : bool or dict-like, optional
| Replace fill values with NA and apply ``scale_factor``/``add_offset``
| decoding. See :py:func:`xarray.open_dataset`. Defaults to ``True``.
| decode_times : bool or dict-like, optional
| Decode CF time variables (calendar, units) into ``np.datetime64``.
| Defaults to ``True``.
| concat_characters : bool or dict-like, optional
| Concatenate character arrays into strings along their trailing
| dimension. Defaults to ``True``.
| decode_coords : bool or {"coordinates", "all"}, optional
| Decode the CF ``coordinates`` attribute. Defaults to ``True``
| (equivalent to ``"coordinates"``).
| drop_variables : str or iterable of str, optional
| Names of variables to drop before processing.
| use_cftime : bool, optional
| Force ``cftime`` decoding for time variables (instead of
| ``np.datetime64``). Defaults to ``None`` (auto).
| decode_timedelta : bool, optional
| Decode CF timedelta variables. Default mirrors ``decode_times``
| unless the backend overrides it (cfradial1, cfradial2, and imd
| default to ``False``).
| sweep : int, str, or list of int/str, optional
| Sweep selection. ``None`` (default) returns all sweeps. An ``int``
| or ``"sweep_N"`` string returns one sweep; a list returns the
| named subset.
| first_dim : {"auto", "time"}, optional
| Leading dimension of each sweep dataset. ``"auto"`` picks
| ``azimuth`` (PPI) or ``elevation`` (RHI); ``"time"`` keeps the
| raw time axis. Default ``"auto"`` (``"time"`` for cfradial2).
| optional : bool, optional
| Include optional root variables when available. Defaults to ``True``.
| optional_groups : bool, optional
| Include the ``/radar_parameters``, ``/georeferencing_correction``,
| and ``/radar_calibration`` metadata subgroups under the root.
| Defaults to ``False``.
| reindex_coord : dict, optional
| Nested dict with optional keys ``angle`` and ``range`` holding the
| kwargs for :func:`xradar.util.reindex_angle` and
| :func:`xradar.util.reindex_range`, e.g. ``dict(angle=dict(start_angle=0,
| stop_angle=360, angle_res=1.0, direction=1))``. Only invoked when
| ``decode_coords=True``. Defaults to ``None`` (no reindexing).
| reindex_angle : dict, optional
| Deprecated, use ``reindex_coord=dict(angle=...)`` instead.
| fix_second_angle : bool, optional
| Correct erroneous secondary-angle values (azimuth on RHI,
| elevation on PPI). Only effective with ``first_dim="auto"``.
| Defaults to ``False``.
| site_coords : bool, optional
| Attach ``latitude``/``longitude``/``altitude`` as coordinates on
| the root dataset (and on per-sweep datasets where the backend
| supports it). Defaults to ``True``.
| lock : threading.Lock or None, optional
| Reader lock for thread-safe access. Defaults to ``None``.
|
| Returns
| -------
| dict[str, xarray.Dataset]
| CfRadial2 group paths (``/``, ``/sweep_N``, optional
| ``/radar_parameters`` etc.) mapped to their datasets,
| ready for :py:meth:`xarray.DataTree.from_dict`.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| description = 'Open IRIS/Sigmet files in Xarray'
|
| open_dataset_parameters = ('filename_or_obj', 'mask_and_scale', 'decod...
|
| supports_groups = True
|
| url = 'https://xradar.rtfd.io/latest/io.html#iris-sigmet-data-i-o'
|
| ----------------------------------------------------------------------
| Methods inherited from xarray.backends.common.BackendEntrypoint:
|
| __repr__(self) -> str
| Return repr(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from xarray.backends.common.BackendEntrypoint:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from xarray.backends.common.BackendEntrypoint:
|
| __annotations__ = {}
ds = xr.open_dataset(filename_single, group="sweep_0", engine="iris", first_dim="time")
display(ds)
<xarray.Dataset> Size: 13MB
Dimensions: (time: 359, range: 833)
Coordinates:
* time (time) datetime64[ns] 3kB 2021-08-19T00:02:28.029000 ....
azimuth (time) float32 1kB ...
elevation (time) float32 1kB ...
* range (range) float32 3kB 150.0 450.0 ... 2.494e+05 2.498e+05
longitude float64 8B ...
latitude float64 8B ...
altitude float64 8B ...
Data variables: (12/16)
DBTH (time, range) float32 1MB ...
DBZH (time, range) float32 1MB ...
VRADH (time, range) float32 1MB ...
WRADH (time, range) float32 1MB ...
ZDR (time, range) float32 1MB ...
KDP (time, range) float32 1MB ...
... ...
SNRH (time, range) float32 1MB ...
sweep_mode <U20 80B ...
sweep_number int64 8B ...
prt_mode <U7 28B ...
follow_mode <U7 28B ...
sweep_fixed_angle float64 8B ...
Attributes:
source: Sigmet
scan_name: PPI1_H
instrument_name: Surgavere, Radar
comment: Dual pol 250km hybrid surveillance task 0.5 de...
radar_constant_h: 63.2
radar_constant_v: 66.2
noise_hc: -82.39
noise_vc: -83.09
pulse_width: 2e-06
radar_beam_width_h: 0.9500000439584255
radar_beam_width_v: 0.9500000439584255
radar_receiver_bandwidth: 559000.0open_iris_datatree#
The same works analoguous with the datatree loader. But additionally we can provide a sweep string, number or list. The underlying xarray.Dataset can be accessed with property .dataset.
help(xd.open_datatree)
Help on function open_datatree in module xradar.io:
open_datatree(filename_or_obj, *, engine=None, **kwargs)
Open a radar file as :py:class:`xarray.DataTree`.
The engine is the given ``engine`` or, without it, the one found by
:func:`xradar.io.discover_engine`. This works for all radar formats,
including the netCDF/HDF5 based ones (ODIM_H5, GAMIC, CfRadial) which
:py:func:`xarray.open_datatree` without ``engine`` hands to xarray's own
netCDF/HDF5 backends.
A list of files is stacked into one volume (see
:func:`xradar.util.create_volume`): this is for formats which write one
sweep per file, e.g. IMD or IRIS/Sigmet files of single sweeps. All files
need the same engine, the sweeps of all files are sorted by time and
numbered in this order. The keyword arguments ``time_coverage_start``,
``time_coverage_end``, ``min_angle``, ``max_angle`` and ``volume_number``
of :func:`xradar.util.create_volume` select and label the sweeps, all other
arguments are used for each file.
Parameters
----------
filename_or_obj : str, Path, file-like or list of str or Path
Path to the radar file, or the paths of files with one sweep each.
engine : str, optional
Backend engine name (e.g., ``"odim"``, ``"cfradial1"``, ``"nexradlevel2"``).
Default is to discover the engine from the file with
:func:`xradar.io.discover_engine` (raises ``ValueError`` if no xradar
engine can open it).
**kwargs
Keyword arguments for :py:func:`xarray.open_datatree`: xarray options
such as ``chunks`` or ``cache``, and the backend options documented on
the engine's ``open_groups_as_dict`` (``sweep``, ``first_dim``, ...).
Returns
-------
dtree : xarray.DataTree
DataTree with CfRadial2 group structure.
Examples
--------
>>> import xradar as xd
>>> dtree = xd.open_datatree("file.h5", engine="odim")
>>> dtree = xd.open_datatree("file.h5") # engine discovered
>>> volume = xd.open_datatree(["sweep_1.nc", "sweep_2.nc"]) # stacked sweeps
dtree = xd.open_datatree(filename_volume, engine="iris")
display(dtree)
<xarray.DataTree>
Group: /
│ Dimensions: (sweep: 10)
│ 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_group_name (sweep) int64 80B ...
│ sweep_fixed_angle (sweep) float64 80B ...
│ Attributes:
│ Conventions: None
│ instrument_name: Corozal, Radar
│ version: None
│ title: None
│ institution: None
│ references: None
│ source: Sigmet
│ history: None
│ comment: AEROCIVIL OPERATIONAL DUAL POLE SCAN
│ scan_name: SURV_HV_300
├── Group: /sweep_0
│ Dimensions: (azimuth: 360, range: 664)
│ Coordinates:
│ * azimuth (azimuth) float32 1kB 0.02197 1.134 2.09 ... 358.0 359.0
│ elevation (azimuth) float32 1kB ...
│ time (azimuth) datetime64[ns] 3kB ...
│ * range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
│ Data variables:
│ DBZH (azimuth, range) float32 956kB ...
│ VRADH (azimuth, range) float32 956kB ...
│ ZDR (azimuth, range) float32 956kB ...
│ KDP (azimuth, range) float32 956kB ...
│ PHIDP (azimuth, range) float32 956kB ...
│ RHOHV (azimuth, range) float32 956kB ...
│ DB_HCLASS (azimuth, range) uint8 239kB ...
│ sweep_mode <U20 80B ...
│ sweep_number int64 8B ...
│ prt_mode <U7 28B ...
│ follow_mode <U7 28B ...
│ sweep_fixed_angle float64 8B ...
├── Group: /sweep_1
│ Dimensions: (azimuth: 360, range: 664)
│ Coordinates:
│ * azimuth (azimuth) float32 1kB 0.06042 1.016 2.054 ... 358.0 359.0
│ elevation (azimuth) float32 1kB ...
│ time (azimuth) datetime64[ns] 3kB ...
│ * range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
│ Data variables:
│ DBZH (azimuth, range) float32 956kB ...
│ VRADH (azimuth, range) float32 956kB ...
│ ZDR (azimuth, range) float32 956kB ...
│ KDP (azimuth, range) float32 956kB ...
│ PHIDP (azimuth, range) float32 956kB ...
│ RHOHV (azimuth, range) float32 956kB ...
│ DB_HCLASS (azimuth, range) uint8 239kB ...
│ sweep_mode <U20 80B ...
│ sweep_number int64 8B ...
│ prt_mode <U7 28B ...
│ follow_mode <U7 28B ...
│ sweep_fixed_angle float64 8B ...
├── Group: /sweep_2
│ Dimensions: (azimuth: 360, range: 664)
│ Coordinates:
│ * azimuth (azimuth) float32 1kB 0.09064 0.9778 ... 358.0 359.1
│ elevation (azimuth) float32 1kB ...
│ time (azimuth) datetime64[ns] 3kB ...
│ * range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
│ Data variables:
│ DBZH (azimuth, range) float32 956kB ...
│ VRADH (azimuth, range) float32 956kB ...
│ ZDR (azimuth, range) float32 956kB ...
│ KDP (azimuth, range) float32 956kB ...
│ PHIDP (azimuth, range) float32 956kB ...
│ RHOHV (azimuth, range) float32 956kB ...
│ DB_HCLASS (azimuth, range) uint8 239kB ...
│ sweep_mode <U20 80B ...
│ sweep_number int64 8B ...
│ prt_mode <U7 28B ...
│ follow_mode <U7 28B ...
│ sweep_fixed_angle float64 8B ...
├── Group: /sweep_3
│ Dimensions: (azimuth: 360, range: 664)
│ Coordinates:
│ * azimuth (azimuth) float32 1kB 0.1401 0.986 2.016 ... 358.0 359.0
│ elevation (azimuth) float32 1kB ...
│ time (azimuth) datetime64[ns] 3kB ...
│ * range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
│ Data variables:
│ DBZH (azimuth, range) float32 956kB ...
│ VRADH (azimuth, range) float32 956kB ...
│ ZDR (azimuth, range) float32 956kB ...
│ KDP (azimuth, range) float32 956kB ...
│ PHIDP (azimuth, range) float32 956kB ...
│ RHOHV (azimuth, range) float32 956kB ...
│ DB_HCLASS (azimuth, range) uint8 239kB ...
│ sweep_mode <U20 80B ...
│ sweep_number int64 8B ...
│ prt_mode <U7 28B ...
│ follow_mode <U7 28B ...
│ sweep_fixed_angle float64 8B ...
├── Group: /sweep_4
│ Dimensions: (azimuth: 360, range: 664)
│ Coordinates:
│ * azimuth (azimuth) float32 1kB 0.09613 1.057 2.038 ... 358.1 359.0
│ elevation (azimuth) float32 1kB ...
│ time (azimuth) datetime64[ns] 3kB ...
│ * range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
│ Data variables:
│ DBZH (azimuth, range) float32 956kB ...
│ VRADH (azimuth, range) float32 956kB ...
│ ZDR (azimuth, range) float32 956kB ...
│ KDP (azimuth, range) float32 956kB ...
│ PHIDP (azimuth, range) float32 956kB ...
│ RHOHV (azimuth, range) float32 956kB ...
│ DB_HCLASS (azimuth, range) uint8 239kB ...
│ sweep_mode <U20 80B ...
│ sweep_number int64 8B ...
│ prt_mode <U7 28B ...
│ follow_mode <U7 28B ...
│ sweep_fixed_angle float64 8B ...
├── Group: /sweep_5
│ Dimensions: (azimuth: 360, range: 664)
│ Coordinates:
│ * azimuth (azimuth) float32 1kB 0.1126 1.016 2.098 ... 358.1 358.9
│ elevation (azimuth) float32 1kB ...
│ time (azimuth) datetime64[ns] 3kB ...
│ * range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
│ Data variables:
│ DBZH (azimuth, range) float32 956kB ...
│ VRADH (azimuth, range) float32 956kB ...
│ ZDR (azimuth, range) float32 956kB ...
│ KDP (azimuth, range) float32 956kB ...
│ PHIDP (azimuth, range) float32 956kB ...
│ RHOHV (azimuth, range) float32 956kB ...
│ DB_HCLASS (azimuth, range) uint8 239kB ...
│ sweep_mode <U20 80B ...
│ sweep_number int64 8B ...
│ prt_mode <U7 28B ...
│ follow_mode <U7 28B ...
│ sweep_fixed_angle float64 8B ...
├── Group: /sweep_6
│ Dimensions: (azimuth: 360, range: 664)
│ Coordinates:
│ * azimuth (azimuth) float32 1kB 0.0769 0.997 2.065 ... 358.1 359.0
│ elevation (azimuth) float32 1kB ...
│ time (azimuth) datetime64[ns] 3kB ...
│ * range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
│ Data variables:
│ DBZH (azimuth, range) float32 956kB ...
│ VRADH (azimuth, range) float32 956kB ...
│ ZDR (azimuth, range) float32 956kB ...
│ KDP (azimuth, range) float32 956kB ...
│ PHIDP (azimuth, range) float32 956kB ...
│ RHOHV (azimuth, range) float32 956kB ...
│ DB_HCLASS (azimuth, range) uint8 239kB ...
│ sweep_mode <U20 80B ...
│ sweep_number int64 8B ...
│ prt_mode <U7 28B ...
│ follow_mode <U7 28B ...
│ sweep_fixed_angle float64 8B ...
├── Group: /sweep_7
│ Dimensions: (azimuth: 360, range: 664)
│ Coordinates:
│ * azimuth (azimuth) float32 1kB 0.07965 1.016 2.019 ... 358.0 359.0
│ elevation (azimuth) float32 1kB ...
│ time (azimuth) datetime64[ns] 3kB ...
│ * range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
│ Data variables:
│ DBZH (azimuth, range) float32 956kB ...
│ VRADH (azimuth, range) float32 956kB ...
│ ZDR (azimuth, range) float32 956kB ...
│ KDP (azimuth, range) float32 956kB ...
│ PHIDP (azimuth, range) float32 956kB ...
│ RHOHV (azimuth, range) float32 956kB ...
│ DB_HCLASS (azimuth, range) uint8 239kB ...
│ sweep_mode <U20 80B ...
│ sweep_number int64 8B ...
│ prt_mode <U7 28B ...
│ follow_mode <U7 28B ...
│ sweep_fixed_angle float64 8B ...
├── Group: /sweep_8
│ Dimensions: (azimuth: 360, range: 664)
│ Coordinates:
│ * azimuth (azimuth) float32 1kB 0.06042 1.079 2.008 ... 358.0 359.1
│ elevation (azimuth) float32 1kB ...
│ time (azimuth) datetime64[ns] 3kB ...
│ * range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
│ Data variables:
│ DBZH (azimuth, range) float32 956kB ...
│ VRADH (azimuth, range) float32 956kB ...
│ ZDR (azimuth, range) float32 956kB ...
│ KDP (azimuth, range) float32 956kB ...
│ PHIDP (azimuth, range) float32 956kB ...
│ RHOHV (azimuth, range) float32 956kB ...
│ DB_HCLASS (azimuth, range) uint8 239kB ...
│ sweep_mode <U20 80B ...
│ sweep_number int64 8B ...
│ prt_mode <U7 28B ...
│ follow_mode <U7 28B ...
│ sweep_fixed_angle float64 8B ...
└── Group: /sweep_9
Dimensions: (azimuth: 360, range: 664)
Coordinates:
* azimuth (azimuth) float32 1kB 1.134 1.986 3.062 ... 359.0 360.0
elevation (azimuth) float32 1kB ...
time (azimuth) datetime64[ns] 3kB ...
* range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
Data variables:
DBZH (azimuth, range) float32 956kB ...
VRADH (azimuth, range) float32 956kB ...
ZDR (azimuth, range) float32 956kB ...
KDP (azimuth, range) float32 956kB ...
PHIDP (azimuth, range) float32 956kB ...
RHOHV (azimuth, range) float32 956kB ...
DB_HCLASS (azimuth, range) uint8 239kB ...
sweep_mode <U20 80B ...
sweep_number int64 8B ...
prt_mode <U7 28B ...
follow_mode <U7 28B ...
sweep_fixed_angle float64 8B ...dtree = xd.open_datatree(filename_volume, engine="iris", sweep="sweep_8")
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_group_name (sweep) int64 8B ...
│ sweep_fixed_angle (sweep) float64 8B ...
│ Attributes:
│ Conventions: None
│ instrument_name: Corozal, Radar
│ version: None
│ title: None
│ institution: None
│ references: None
│ source: Sigmet
│ history: None
│ comment: AEROCIVIL OPERATIONAL DUAL POLE SCAN
│ scan_name: SURV_HV_300
└── Group: /sweep_0
Dimensions: (azimuth: 360, range: 664)
Coordinates:
* azimuth (azimuth) float32 1kB 0.06042 1.079 2.008 ... 358.0 359.1
elevation (azimuth) float32 1kB ...
time (azimuth) datetime64[ns] 3kB ...
* range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
Data variables:
DBZH (azimuth, range) float32 956kB ...
VRADH (azimuth, range) float32 956kB ...
ZDR (azimuth, range) float32 956kB ...
KDP (azimuth, range) float32 956kB ...
PHIDP (azimuth, range) float32 956kB ...
RHOHV (azimuth, range) float32 956kB ...
DB_HCLASS (azimuth, range) uint8 239kB ...
sweep_mode <U20 80B ...
sweep_number int64 8B ...
prt_mode <U7 28B ...
follow_mode <U7 28B ...
sweep_fixed_angle float64 8B ...dtree = xd.open_datatree(filename_volume, engine="iris", sweep=[1, 2, 8])
display(dtree)
<xarray.DataTree>
Group: /
│ Dimensions: (sweep: 3)
│ 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_group_name (sweep) int64 24B ...
│ sweep_fixed_angle (sweep) float64 24B ...
│ Attributes:
│ Conventions: None
│ instrument_name: Corozal, Radar
│ version: None
│ title: None
│ institution: None
│ references: None
│ source: Sigmet
│ history: None
│ comment: AEROCIVIL OPERATIONAL DUAL POLE SCAN
│ scan_name: SURV_HV_300
├── Group: /sweep_0
│ Dimensions: (azimuth: 360, range: 664)
│ Coordinates:
│ * azimuth (azimuth) float32 1kB 0.06042 1.016 2.054 ... 358.0 359.0
│ elevation (azimuth) float32 1kB ...
│ time (azimuth) datetime64[ns] 3kB ...
│ * range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
│ Data variables:
│ DBZH (azimuth, range) float32 956kB ...
│ VRADH (azimuth, range) float32 956kB ...
│ ZDR (azimuth, range) float32 956kB ...
│ KDP (azimuth, range) float32 956kB ...
│ PHIDP (azimuth, range) float32 956kB ...
│ RHOHV (azimuth, range) float32 956kB ...
│ DB_HCLASS (azimuth, range) uint8 239kB ...
│ sweep_mode <U20 80B ...
│ sweep_number int64 8B ...
│ prt_mode <U7 28B ...
│ follow_mode <U7 28B ...
│ sweep_fixed_angle float64 8B ...
├── Group: /sweep_1
│ Dimensions: (azimuth: 360, range: 664)
│ Coordinates:
│ * azimuth (azimuth) float32 1kB 0.09064 0.9778 ... 358.0 359.1
│ elevation (azimuth) float32 1kB ...
│ time (azimuth) datetime64[ns] 3kB ...
│ * range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
│ Data variables:
│ DBZH (azimuth, range) float32 956kB ...
│ VRADH (azimuth, range) float32 956kB ...
│ ZDR (azimuth, range) float32 956kB ...
│ KDP (azimuth, range) float32 956kB ...
│ PHIDP (azimuth, range) float32 956kB ...
│ RHOHV (azimuth, range) float32 956kB ...
│ DB_HCLASS (azimuth, range) uint8 239kB ...
│ sweep_mode <U20 80B ...
│ sweep_number int64 8B ...
│ prt_mode <U7 28B ...
│ follow_mode <U7 28B ...
│ sweep_fixed_angle float64 8B ...
└── Group: /sweep_2
Dimensions: (azimuth: 360, range: 664)
Coordinates:
* azimuth (azimuth) float32 1kB 0.06042 1.079 2.008 ... 358.0 359.1
elevation (azimuth) float32 1kB ...
time (azimuth) datetime64[ns] 3kB ...
* range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
Data variables:
DBZH (azimuth, range) float32 956kB ...
VRADH (azimuth, range) float32 956kB ...
ZDR (azimuth, range) float32 956kB ...
KDP (azimuth, range) float32 956kB ...
PHIDP (azimuth, range) float32 956kB ...
RHOHV (azimuth, range) float32 956kB ...
DB_HCLASS (azimuth, range) uint8 239kB ...
sweep_mode <U20 80B ...
sweep_number int64 8B ...
prt_mode <U7 28B ...
follow_mode <U7 28B ...
sweep_fixed_angle float64 8B ...dtree = xd.open_datatree(filename_volume, engine="iris",
sweep=["sweep_0", "sweep_1", "sweep_8"],
)
display(dtree)
<xarray.DataTree>
Group: /
│ Dimensions: (sweep: 3)
│ 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_group_name (sweep) int64 24B ...
│ sweep_fixed_angle (sweep) float64 24B ...
│ Attributes:
│ Conventions: None
│ instrument_name: Corozal, Radar
│ version: None
│ title: None
│ institution: None
│ references: None
│ source: Sigmet
│ history: None
│ comment: AEROCIVIL OPERATIONAL DUAL POLE SCAN
│ scan_name: SURV_HV_300
├── Group: /sweep_0
│ Dimensions: (azimuth: 360, range: 664)
│ Coordinates:
│ * azimuth (azimuth) float32 1kB 0.02197 1.134 2.09 ... 358.0 359.0
│ elevation (azimuth) float32 1kB ...
│ time (azimuth) datetime64[ns] 3kB ...
│ * range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
│ Data variables:
│ DBZH (azimuth, range) float32 956kB ...
│ VRADH (azimuth, range) float32 956kB ...
│ ZDR (azimuth, range) float32 956kB ...
│ KDP (azimuth, range) float32 956kB ...
│ PHIDP (azimuth, range) float32 956kB ...
│ RHOHV (azimuth, range) float32 956kB ...
│ DB_HCLASS (azimuth, range) uint8 239kB ...
│ sweep_mode <U20 80B ...
│ sweep_number int64 8B ...
│ prt_mode <U7 28B ...
│ follow_mode <U7 28B ...
│ sweep_fixed_angle float64 8B ...
├── Group: /sweep_1
│ Dimensions: (azimuth: 360, range: 664)
│ Coordinates:
│ * azimuth (azimuth) float32 1kB 0.06042 1.016 2.054 ... 358.0 359.0
│ elevation (azimuth) float32 1kB ...
│ time (azimuth) datetime64[ns] 3kB ...
│ * range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
│ Data variables:
│ DBZH (azimuth, range) float32 956kB ...
│ VRADH (azimuth, range) float32 956kB ...
│ ZDR (azimuth, range) float32 956kB ...
│ KDP (azimuth, range) float32 956kB ...
│ PHIDP (azimuth, range) float32 956kB ...
│ RHOHV (azimuth, range) float32 956kB ...
│ DB_HCLASS (azimuth, range) uint8 239kB ...
│ sweep_mode <U20 80B ...
│ sweep_number int64 8B ...
│ prt_mode <U7 28B ...
│ follow_mode <U7 28B ...
│ sweep_fixed_angle float64 8B ...
└── Group: /sweep_2
Dimensions: (azimuth: 360, range: 664)
Coordinates:
* azimuth (azimuth) float32 1kB 0.06042 1.079 2.008 ... 358.0 359.1
elevation (azimuth) float32 1kB ...
time (azimuth) datetime64[ns] 3kB ...
* range (range) float32 3kB 300.0 750.0 ... 2.982e+05 2.986e+05
Data variables:
DBZH (azimuth, range) float32 956kB ...
VRADH (azimuth, range) float32 956kB ...
ZDR (azimuth, range) float32 956kB ...
KDP (azimuth, range) float32 956kB ...
PHIDP (azimuth, range) float32 956kB ...
RHOHV (azimuth, range) float32 956kB ...
DB_HCLASS (azimuth, range) uint8 239kB ...
sweep_mode <U20 80B ...
sweep_number int64 8B ...
prt_mode <U7 28B ...
follow_mode <U7 28B ...
sweep_fixed_angle float64 8B ...Plot Time vs. Azimuth#
dtree["sweep_0"].dataset.azimuth.plot(y="time")
[<matplotlib.lines.Line2D at 0x7a7edad6c6e0>]
Plot Sweep Range vs. Time#
We need to sort by time and specify the y-coordinate. Please also observe the different resolutions of this plot, compared to the Azimuth vs. Range plot below. This is due to second-resolution of the time coordinate.
dtree["sweep_0"].dataset.DBZH.sortby("time").plot(y="time")
<matplotlib.collections.QuadMesh at 0x7a7edadd0a50>
Plot Sweep Range vs. Azimuth#
dtree["sweep_0"].dataset.DBZH.plot()
<matplotlib.collections.QuadMesh at 0x7a7edac71450>
import matplotlib.pyplot as plt
sweep = dtree["sweep_0"].to_dataset(inherit="all_coords")
sweep = sweep.sel(range=slice(0, 60000))
sweep = xd.georeference.get_x_y_z(sweep)
for var in xd.util.get_sweep_dataset_vars(sweep):
plt.figure()
sweep[var].plot(x="x", y="y")
plt.title(var)
Optional groups: radar_parameters and radar_calibration#
With optional_groups=True the datatree also has the metadata groups. The IRIS/Sigmet reader fills them from the task configuration of the ingest header: the beam widths and the receiver bandwidth in radar_parameters, the radar constants and the noise at calibration in radar_calibration. Values which are not set in the file (0) are left out.
dtree = xd.open_datatree(filename_volume, engine="iris", sweep=0, optional_groups=True)
display(dtree["radar_parameters"].dataset)
display(dtree["radar_calibration"].dataset)
<xarray.DatasetView> Size: 24B
Dimensions: ()
Data variables:
radar_beam_width_h float64 8B ...
radar_beam_width_v float64 8B ...
radar_receiver_bandwidth float64 8B ...<xarray.DatasetView> Size: 40B
Dimensions: ()
Data variables:
noise_hc float64 8B ...
noise_vc float64 8B ...
pulse_width float64 8B ...
radar_constant_h float64 8B ...
radar_constant_v float64 8B ...np.testing.assert_almost_equal(dtree["radar_parameters"].radar_beam_width_h, 0.95, 2)
np.testing.assert_almost_equal(dtree["radar_calibration"].noise_hc, -81.4, 1)
np.testing.assert_almost_equal(dtree["radar_calibration"].radar_constant_h, 67.1, 1)
assert dtree["radar_calibration"].noise_hc.attrs["units"] == "dBm"
The task configuration is the same for every sweep of the file, so the values do not depend on the selected sweep.