Reading NetCDF files with a generic reader

This reader utilizes netCDF4-python.

In this example, we read NetCDF files from different sources using a generic reader from \(\omega radlib's\) io module.

[1]:
from wradlib.io import read_generic_netcdf
from wradlib.util import get_wradlib_data_file
import os
/home/runner/micromamba-root/envs/wradlib-notebooks/lib/python3.11/site-packages/tqdm/auto.py:22: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from .autonotebook import tqdm as notebook_tqdm
[2]:
# A little helper function for repeated tasks
def read_and_overview(filename):
    """Read NetCDF using read_generic_netcdf and print upper level dictionary keys"""
    test = read_generic_netcdf(filename)
    print("\nPrint keys for file %s" % os.path.basename(filename))
    for key in test.keys():
        print("\t%s" % key)

CfRadial example from TITAN homepage

See also: https://ral.ucar.edu/projects/titan/docs/radial_formats/

[3]:
filename = "netcdf/cfrad.20080604_002217_000_SPOL_v36_SUR.nc"
filename = get_wradlib_data_file(filename)
read_and_overview(filename)

Print keys for file cfrad.20080604_002217_000_SPOL_v36_SUR.nc
        Conventions
        version
        title
        institution
        references
        source
        history
        comment
        instrument_name
        site_name
        scan_name
        scan_id
        platform_is_mobile
        n_gates_vary
        dimensions
        variables

Example PPI from Py-ART repository

See also: https://github.com/ARM-DOE/pyart/

[4]:
filename = "netcdf/example_cfradial_ppi.nc"
filename = get_wradlib_data_file(filename)
read_and_overview(filename)

Print keys for file example_cfradial_ppi.nc
        comment
        title
        Conventions
        source
        version
        references
        instrument_name
        institution
        field_names
        history
        dimensions
        variables

Example RHI from Py-ART repository

See also: https://github.com/ARM-DOE/pyart/

[5]:
filename = "netcdf/example_cfradial_rhi.nc"
filename = get_wradlib_data_file(filename)
read_and_overview(filename)
Downloading file 'netcdf/example_cfradial_rhi.nc' from 'https://github.com/wradlib/wradlib-data/raw/pooch/data/netcdf/example_cfradial_rhi.nc' to '/home/runner/work/wradlib-notebooks/wradlib-notebooks/wradlib-data'.

Print keys for file example_cfradial_rhi.nc
        comment
        title
        Conventions
        source
        version
        references
        instrument_name
        institution
        field_names
        history
        dimensions
        variables

Example EDGE NetCDF export format

[6]:
filename = "netcdf/edge_netcdf.nc"
filename = get_wradlib_data_file(filename)
read_and_overview(filename)

Print keys for file edge_netcdf.nc
        TypeName
        DataType
        Latitude
        Longitude
        Height
        Time
        FractionalTime
        attributes
        NyquistVelocity-unit
        NyquistVelocity-value
        vcp-unit
        vcp-value
        radarName-unit
        radarName-value
        ColorMap-unit
        ColorMap-value
        Elevation
        ElevationUnits
        MissingData
        RangeFolded
        RadarParameters
        PRF-unit
        PRF-value
        PulseWidth-unit
        PulseWidth-value
        MaximumRange-unit
        MaximumRange-value
        ConversionPlugin
        dimensions
        variables