예제 #1
0
def test_wera_raw_to_quality_tabular_nc():
    radial_file = data_path / "radials" / "ruv" / "WERA" / "RDL_csw_2019_10_24_162300.ruv"
    nc_file = output_path / "radials" / "qc" / "nc" / "tabular" / "WERA" / "RDL_csw_2019_10_24_162300.nc"
    rad1 = Radial(radial_file, replace_invalid=False)
    rad1.initialize_qc()
    # rad1.mask_over_land()
    rad1.qc_qartod_radial_count()
    rad1.qc_qartod_valid_location()
    rad1.qc_qartod_maximum_velocity()
    rad1.qc_qartod_spatial_median()
    rad1.to_netcdf(str(nc_file), model="tabular")

    xds2 = rad1.to_xarray("tabular", enhance=True)

    with xr.open_dataset(nc_file) as xds1:
        assert len(xds1.QCTest) == 3  # no VFLG column so one test not run
        # The two enhanced files should be identical
        assert xds1.identical(xds2)
예제 #2
0
def test_wera_qc():
    radial_file = data_path / "radials" / "ruv" / "WERA" / "RDL_csw_2019_10_24_162300.ruv"
    rad1 = Radial(radial_file, replace_invalid=False)
    rad1.initialize_qc()
    # assert len(rad1.data) == 6327
    # rad1.mask_over_land(subset=True)
    rad1.qc_qartod_radial_count()
    rad1.qc_qartod_valid_location()
    rad1.qc_qartod_maximum_velocity()
    rad1.qc_qartod_spatial_median()
    rad1.qc_qartod_avg_radial_bearing(reference_bearing=180)
    rad1.qc_qartod_primary_flag()
    # assert len(rad1.data) == 5745
    assert "QC07" in rad1.data
    assert "QC08" not in rad1.data  # no VFLG column so we can't run it
    assert "QC09" in rad1.data
    assert "QC10" in rad1.data
    # assert 'QC11' in rad1.data  # temporal gradient test
    assert "QC12" in rad1.data
    assert "PRIM" in rad1.data
예제 #3
0
def test_codar_qc():
    radial_file = data_path / "radials" / "ruv" / "SEAB" / "RDLi_SEAB_2019_01_01_0100.ruv"
    radial_file_previous = data_path / "radials" / "ruv" / "SEAB" / "RDLi_SEAB_2019_01_01_0000.ruv"
    rad1 = Radial(radial_file, replace_invalid=False)
    rad1.initialize_qc()
    # assert len(rad1.data) == 733
    # rad1.mask_over_land(subset=True)
    rad1.qc_qartod_radial_count()
    rad1.qc_qartod_valid_location()
    rad1.qc_qartod_maximum_velocity()
    rad1.qc_qartod_spatial_median()
    rad1.qc_qartod_temporal_gradient(radial_file_previous)
    rad1.qc_qartod_avg_radial_bearing(reference_bearing=180)
    rad1.qc_qartod_primary_flag()
    # assert len(rad1.data) == 587
    assert "QC07" in rad1.data
    assert "QC08" in rad1.data
    assert "QC09" in rad1.data
    assert "QC10" in rad1.data
    assert "QC11" in rad1.data  # temporal gradient test
    assert "QC12" in rad1.data
    assert "PRIM" in rad1.data