xradar is in an early stage of development, please report any issues here!

Create a Plan Position Indicator (PPI) Plot#

A Plan Position Indicator (PPI) plot is a common plot requested by radar scientists. Let’s show how to create this plot using xradar

Imports#

[1]:
import xarray as xr
import xradar as xd
import cmweather
from open_radar_data import DATASETS
[2]:
import matplotlib.pyplot as plt
import pyproj
import cartopy

Read in some data#

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

[3]:
filename = DATASETS.fetch("cfrad.20080604_002217_000_SPOL_v36_SUR.nc")

Read the data using the cfradial1 engine

[4]:
radar = xd.io.open_cfradial1_datatree(filename, first_dim="auto")
display(radar)
<xarray.DatasetView> Size: 477B
Dimensions:              (sweep: 9)
Dimensions without coordinates: sweep
Data variables:
    volume_number        int32 4B ...
    platform_type        |S32 32B ...
    primary_axis         |S32 32B ...
    status_str           |S1 1B ...
    instrument_type      |S32 32B ...
    time_coverage_start  |S32 32B ...
    time_coverage_end    |S32 32B ...
    latitude             float64 8B ...
    longitude            float64 8B ...
    altitude             float64 8B ...
    sweep_group_name     (sweep) <U7 252B 'sweep_0' 'sweep_1' ... 'sweep_8'
    sweep_fixed_angle    (sweep) float32 36B ...
Attributes: (12/13)
    Conventions:         CF/Radial instrument_parameters radar_parameters rad...
    version:             1.2
    title:               TIMREX
    institution:
    references:
    source:
    ...                  ...
    comment:
    instrument_name:     SPOLRVP8
    site_name:
    scan_name:
    scan_id:             0
    platform_is_mobile:  false

Add georeferencing#

We can use the georeference function, or the accessor to add our georeference information!

Georeference Accessor#

If you prefer the accessor (.xradar.georefence()), this is how you would add georeference information to your radar object.

[5]:
radar = radar.xradar.georeference()
display(radar)
<xarray.DatasetView> Size: 477B
Dimensions:              (sweep: 9)
Dimensions without coordinates: sweep
Data variables:
    volume_number        int32 4B ...
    platform_type        |S32 32B ...
    primary_axis         |S32 32B ...
    status_str           |S1 1B ...
    instrument_type      |S32 32B ...
    time_coverage_start  |S32 32B ...
    time_coverage_end    |S32 32B ...
    latitude             float64 8B ...
    longitude            float64 8B ...
    altitude             float64 8B ...
    sweep_group_name     (sweep) <U7 252B 'sweep_0' 'sweep_1' ... 'sweep_8'
    sweep_fixed_angle    (sweep) float32 36B ...
Attributes: (12/13)
    Conventions:         CF/Radial instrument_parameters radar_parameters rad...
    version:             1.2
    title:               TIMREX
    institution:
    references:
    source:
    ...                  ...
    comment:
    instrument_name:     SPOLRVP8
    site_name:
    scan_name:
    scan_id:             0
    platform_is_mobile:  false

Please observe, that the additional coordinates x, y, z have been added to the dataset. This will also add spatial_ref CRS information on the used Azimuthal Equidistant Projection.

[6]:
radar["sweep_0"]
[6]: