예제 #1
0
def quicklook_testprofiles(nc_file):
    """Give a quick look of the preselected profiles, only the data.
    
    Parameters
    ----------
    nc_file : str
        Path to the netcdf file containing the data
    
    Returns
    -------
    None
    """

    location, day, lat, lon = utils.where_and_when(nc_file)

    plt.figure(figsize=(14, 7))

    n_profiles = 4
    hours = ["0:17", "9:22", "16:17", "21:17"]

    for prof_id in range(n_profiles):
        z, rcs = utils.extract_testprofile(nc_file,
                                           to_extract=["rcs_0"],
                                           profile_id=prof_id)
        plt.subplot(1, n_profiles, prof_id + 1)
        plt.plot(rcs, z, linewidth=2, label=hours[prof_id])
        plt.legend()
    plt.tight_layout()
    plt.suptitle("Lidar backscatter | " + location + " " +
                 day.strftime("%Y/%m/%d"))
    plt.show(block=False)
예제 #2
0
파일: graphics.py 프로젝트: douyoujun/kabl
def quicklook_testprofiles(nc_file):
    '''Give a quick look of the preselected profiles, only the data.
    
    [IN]
        - nc_file (str): path to the netcdf file containing the data
    
    [OUT]
        - (matplotlib.pyplot figure): same as blhs_over_profile'''

    location, day, lat, lon = utils.where_and_when(nc_file)

    plt.figure(figsize=(14, 7))

    n_profiles = 4
    hours = ['0:17', '9:22', '16:17', '21:17']

    for prof_id in range(n_profiles):
        z, rcs = utils.extract_testprofile(nc_file,
                                           to_extract=['rcs_0'],
                                           profile_id=prof_id)
        plt.subplot(1, n_profiles, prof_id + 1)
        plt.plot(rcs, z, linewidth=2, label=hours[prof_id])
        plt.legend()
    plt.tight_layout()
    plt.suptitle("Lidar backscatter | " + location + " " +
                 day.strftime('%Y/%m/%d'))
    plt.show(block=False)
예제 #3
0
def test_prepare_data_singleprof():

    testFile = paths.file_defaultlidardata()
    z_values, rcs_1, rcs_2, coords = utils.extract_testprofile(
        testFile, profile_id=2, return_coords=True)

    params = utils.get_default_params()
    params["predictors"] = {
        "day": ["rcs_1", "rcs_2"],
        "night": ["rcs_1", "rcs_2"]
    }

    X, Z = prepare_data(coords,
                        z_values,
                        rcss={
                            "rcs_1": rcs_1,
                            "rcs_2": rcs_2
                        },
                        params=params)

    assert X.shape == (146, 2) and Z.shape == (146, )
예제 #4
0
print("\n --------------- Test of quicklook_data")
testFile = paths.file_defaultlidardata()
quicklook_data(testFile)

# Test of quicklook_testprofiles
# ------------------------
print("\n --------------- Test of quicklook_testprofiles")
testFile = paths.file_defaultlidardata()
quicklook_testprofiles(testFile)

# Test of blhs_over_profile
# ------------------------
print("\n --------------- Test of blhs_over_profile")
testFile = paths.file_defaultlidardata()
z_values, rcs_1, rcs_2, coords = utils.extract_testprofile(
    testFile, profile_id=3, return_coords=True
)
X, Z = core.prepare_data(coords, z_values, {"rcs_1":rcs_1, "rcs_2":rcs_2})
labels = core.apply_algo(X, 3)
blh = utils.blh_from_labels(labels, Z)

blhs_over_profile(z_values, rcs_1, blh, labels=labels)

plt.figure()
plt.hist(rcs_1, 35)
plt.title("Histogram of a single profile of RCS")
plt.show(block=False)

# Test of blhs_over_data
# ------------------------
print("\n --------------- Test of blhs_over_data")