How to plot the pseudo RHI for Rainbow 5 by using vol data format

Hi, I’m just new here.

I want to plot RHI for radar data Rainbow 5, but all the data that I have is in the (.vol) format.
I managed to plot the PPI but couldn’t for RHI. I tried to do with the pyart but it shows “TypeError: Unknown or unsupported file format: UNKNOWN”.

How can I plot the RHI/pseudo RHI for this radar data?
Attached is the link to a sample of my radar data.
https://drive.google.com/drive/folders/11sX4jiZtmkBd66K6tXbG0LB96mI7ldH6?usp=drive_link

1 Like

Py-ART does not fully support rainbow files - I would suggest using xradar here.

https://docs.openradarscience.org/projects/xradar/en/stable/notebooks/Rainbow.html

There would not be out-of-the-box support for a pseudo rhi, this is something you would likely need to implement. Taking a look at the file you shared, it looks more like a PPI file than an RHI.

import os
import pyart
import xradar
import cmweather
import numpy as np
import xarray as xr
import cartopy.crs as ccrs
import matplotlib.pyplot as plt

import warnings
warnings.filterwarnings("ignore")

file1 = "2021110309550500dBZ.vol"

dtree = xradar.io.open_rainbow_datatree(file1)

# Fubction to add necessaey metadata, in order to export it to cfradial1 format
def correct_cfradial2(dtree):
    data = np.array('axis_z', dtype='|S32')
    attributes = {
        'standard_name': 'primary_axis_of_rotation',
        'options': 'axis_z, axis_y, axis_x'
    }
    # Create the xarray DataArray
    dtree['primary_axis'] = xr.DataArray(data, attrs=attributes, dims=())
    
    fixed_angles = []
    for grp in dtree.groups:
        if "sweep" in grp:
            fixed_angle = dtree[grp]['sweep_fixed_angle'].values
            fixed_angles.append(fixed_angle)
            dtree[grp]['sweep_mode'] = xr.DataArray(
                np.array(dtree[grp]['sweep_mode'], dtype='|S32'),
                attrs={'standard_name': 'scan_mode_for_sweep',
     'options': 'sector, coplane, rhi, vertical_pointing, idle, azimuth_surveillance, \
     elevation_surveillance, sunscan, pointing, calibration, manual_ppi, manual_rhi'})
    
    fixed_angles = np.array(fixed_angles, dtype=np.float32)
    sweep_groups = np.array([f'sweep_{i}' for i in range(fixed_angles.size)])
    dtree['sweep_fixed_angle'] = xr.DataArray(fixed_angles, dims=('sweep'))
    dtree['sweep_group_name'] = xr.DataArray(sweep_groups, dims=('sweep'))
    dtree['volume_number'] = xr.DataArray(np.array(0, dtype=np.int16),
                                      attrs={'standard_name':'data_volume_index_number'})
    dtree['instrument_type'] = xr.DataArray(np.array('radar', dtype='|S32'),
                                      attrs={'standard_name': 'type_of_instrument',
                                             'options': 'radar, lidar',
                                             'meta_group': 'instrument_parameters'}
                                       )
    dtree['platform_type'] = xr.DataArray(
        np.array('fixed', dtype='|S32'),
        attrs={'standard_name': 'platform_type',
    'options':'fixed, vehicle, ship, aircraft_fore, aircraft_aft, aircraft_tail, aircraft_belly,\
    aircraft_roof, aircraft_nose, satellite_orbit, satellite_geostat'})
    
    return dtree

# Apply Correction
dtree = correct_cfradial2(dtree)

# Export to Cfradial1
xradar.io.to_cfradial1(dtree, filename=None, calibs=True)

# Now Let's create PsedudoRHI using Pyart
radar = pyart.io.read_cfradial('cfrad1_None_20211103_095505.nc')
azi = 10 # Choose any azimuth from 0 to 360
pseudorhi = pyart.util.cross_section_ppi(radar, [azi])
display = pyart.graph.RadarDisplay(pseudorhi)
fig = plt.figure(figsize=[8, 3])
ax = plt.axes()
display.plot_rhi('DBZH', ax=ax, cmap="NWSRef")
ax.set_ylim(0, 20)
ax.set_xlim(0,130)
plt.show()

image

For the detailed Notebook, and how I created this animation, check this Notebook

knisa_vol

2 Likes

Hi @kmuehlbauer @mgrover1 ,
This Rainbow file required the correct_cfradial2(dtree) function to be applied in order to export it to cfradial1 format and subsequently reading it with PyArt. I’m curious to know if the problem lies with the data or the Rainbow reader. What are your insights on this matter? Could it be possible that we missed adding the necessary metadata when reading the Rainbow file, or is it that the file itself lacks the essential metadata?

Hi, I see
Thank you!

That’s amazing!
I’d try and at the line

# Export to Cfradial1
xradar.io.to_cfradial1(dtree, filename=None, calibs=True)

it shows “AttributeError: module ‘xradar.io’ has no attribute ‘to_cfradial1’”

How to fix this?

You need to update it, you may use one of the following commands:

conda update xradar -c conda-forge

Or

mamba update xradar -c conda-forge

Thank you so much!

It works!

1 Like

@syedhamidali I think currently only a minimal set of those items are available via .coords. But I think they also do lack proper attrs. Please open an issue at xradar. Thanks!

1 Like