コード例 #1
0
ファイル: test_kdp_proc.py プロジェクト: aniruddhavpatil/NSA
def test_kdp_maesaka_linear_psidp(slope=0.002, maxiter=100):
    radar = _make_linear_psidp_radar(slope=slope)
    kdp_dict, phidpf_dict, phidpr_dict = kdp_proc.kdp_maesaka(
        radar, maxiter=maxiter, check_outliers=False)

    assert np.allclose(np.diff(kdp_dict['data'][0]), 0.0, atol=0.1)
    assert np.allclose(kdp_dict['data'], 1000.0 * slope / 2.0, atol=0.1)

    return
コード例 #2
0
ファイル: test_kdp_proc.py プロジェクト: aniruddhavpatil/NSA
def test_kdp_maesaka_all_excluded(first_guess=0.01, maxiter=100):
    radar = _make_linear_psidp_radar()
    gatefilter = GateFilter(radar)
    gatefilter.exclude_all()
    kdp_dict, phidpf_dict, phidpr_dict = kdp_proc.kdp_maesaka(
        radar, gatefilter=gatefilter, first_guess=first_guess, maxiter=maxiter,
        check_outliers=False)

    assert np.allclose(kdp_dict['data'][0], 0.0, atol=first_guess)

    return
コード例 #3
0
ファイル: test_compare_kdp_proc.py プロジェクト: normbw/pyart
def test_compare_kdp_estimation_methods():
    # Get profile of noisy psidp
    prof_psidp = _make_real_psidp_radar()
    # Maesaka method
    kdp_mae, phidpf_mae, phidp_mae = kdp_maesaka(prof_psidp,
                                                 maxiter=1000,
                                                 check_outliers=False,
                                                 parallel=False)

    # Vulpiani method (note windsize is just a guess here..)
    kdp_vulp, phidp_vulp = kdp_vulpiani(prof_psidp,
                                        windsize=2,
                                        n_iter=20,
                                        parallel=False,
                                        band='X')
    # Kalman filter method
    kdp_schnee, kdp_std_schnee, phidp_schnee = kdp_schneebeli(prof_psidp,
                                                              parallel=False,
                                                              band='X')
    # Create figure
    fig = plt.figure(figsize=(10, 10))
    plt.subplot(2, 1, 1)
    plt.grid(True)
    plt.title('Kdp estimation')
    ranges = prof_psidp.range['data']
    plt.plot(ranges, kdp_mae['data'][0])
    plt.plot(ranges, kdp_vulp['data'][0])
    plt.plot(ranges, kdp_schnee['data'][0])
    plt.xlabel('Range [m]')
    plt.ylabel('Kdp [deg/km]')
    plt.legend(['Maesaka', 'Vulpiani', 'Schneebeli'], loc=0)
    plt.subplot(2, 1, 2)
    plt.grid(True)
    plt.title('Reconstructed Phidp')
    ranges = prof_psidp.range['data']
    phidp_mae = 0.5 * (phidp_mae['data'][0] + phidp_mae['data'][0])
    plt.plot(ranges, phidp_mae)
    plt.plot(ranges, phidp_vulp['data'][0])
    plt.plot(ranges, phidp_schnee['data'][0])
    plt.plot(ranges, prof_psidp.fields['differential_phase']['data'][0])
    plt.xlabel('Range [m]')
    plt.ylabel('Diff. phase [deg]')
    plt.legend(['Maesaka', 'Vulpiani', 'Schneebeli', 'Real Psidp'], loc=0)
    try:
        return fig
    finally:
        plt.close(fig)
コード例 #4
0
ファイル: compare_kdp_proc.py プロジェクト: ARM-DOE/pyart
def compare_kdp_estimation_methods():
    # Get profile of noisy psidp
    prof_psidp = _make_real_psidp_radar()
    # Maesaka method
    kdp_mae, phidpf_mae, phidp_mae = kdp_maesaka(prof_psidp, maxiter=1000,
                                                 check_outliers=False)
    # Vulpiani method (note windsize is just a guess here..)
    kdp_vulp, phidp_vulp = kdp_vulpiani(prof_psidp, windsize=30, n_iter=20,
                                        band='X')
    # Kalman filter method
    kdp_schnee, kdp_std_schnee, phidp_schnee = kdp_schneebeli(prof_psidp,
                                                              band='X')
    # Create figure
    plt.figure(figsize=(10, 10))
    plt.subplot(2, 1, 1)
    plt.grid(True)
    plt.title('Kdp estimation')
    plt.hold(True)
    ranges = prof_psidp.range['data']
    plt.plot(ranges, kdp_mae['data'][0])
    plt.plot(ranges, kdp_vulp['data'][0])
    plt.plot(ranges, kdp_schnee['data'][0])
    plt.xlabel('Range [m]')
    plt.ylabel(r'Kdp [deg/km]')
    plt.legend(['Maesaka', 'Vulpiani', 'Schneebeli'], loc=0)
    plt.subplot(2, 1, 2)
    plt.grid(True)
    plt.title('Reconstructed Phidp')
    plt.hold(True)
    ranges = prof_psidp.range['data']
    phidp_mae = 0.5 * (phidp_mae['data'][0] + phidp_mae['data'][0])
    plt.plot(ranges, phidp_mae)
    plt.plot(ranges, phidp_vulp['data'][0])
    plt.plot(ranges, phidp_schnee['data'][0])
    plt.plot(ranges, prof_psidp.fields['differential_phase']['data'][0])
    plt.xlabel('Range [m]')
    plt.ylabel(r'Diff. phase [deg]')
    plt.legend(['Maesaka', 'Vulpiani', 'Schneebeli', 'Real Psidp'], loc=0)
    # Display plot
    plt.show()
コード例 #5
0
        try:
            if not os.path.exists(FOLDER_RADAR + 'ZH_' + str(i) + '.npy'):
                time = pycosmo.get_time_from_COSMO_filename(f)

                # Radar
                files = rad_db.query(date=[str(time)],
                                     radar=RADAR,
                                     res='L',
                                     angle=1)

                rad = pyart_wrapper.PyradCH(files[0][0].rstrip(), True)
                rad.snr_threshold(5)
                #            rad.average(n_gates=6)
                rad.correct_velocity()
                KDP_rad, b, a = kdp_proc.kdp_maesaka(rad,
                                                     kdp_field='KDP',
                                                     psidp_field='PHIDP')
                KDP_rad['data'][np.isnan(rad.get_field(0, 'PHIDP'))] = np.nan

                KDP_rad = ma.filled(KDP_rad['data'], np.nan)
                ZH_rad = ma.filled(rad.get_field(0, 'Z'), np.nan)
                ZDR_rad = ma.filled(rad.get_field(0, 'ZDR'), np.nan)
                RHOHV_rad = ma.filled(rad.get_field(0, 'RHO'), np.nan)
                RVEL_rad = ma.filled(rad.get_field(0, 'V'), np.nan)

                np.save(FOLDER_RADAR + 'ZH_' + str(i) + '.npy', ZH_rad)
                np.save(FOLDER_RADAR + 'ZDR_' + str(i) + '.npy', ZDR_rad)
                np.save(FOLDER_RADAR + 'KDP_' + str(i) + '.npy', KDP_rad)
                np.save(FOLDER_RADAR + 'RHOHV_' + str(i) + '.npy', RHOHV_rad)
                np.save(FOLDER_RADAR + 'RVEL_' + str(i) + '.npy', RVEL_rad)