Reading NetCDF files with a generic reader

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

In [2]:
from wradlib.io import read_generic_netcdf
from wradlib.util import get_wradlib_data_file
import os
In [3]:
# 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: http://www.ral.ucar.edu/projects/titan/docs/radial_formats

In [4]:
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/

In [5]:
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/

In [6]:
filename = 'netcdf/example_cfradial_rhi.nc'
filename = get_wradlib_data_file(filename)
read_and_overview(filename)

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

In [7]:
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