def get_velocity_by_loc_w(speed, groups=1, prefix=""):
    higher_avg_vel = group_avarage_velocity_w(
        ft.Scene("C:/Users/theem/Desktop/Projects/alpha offline/Data/traj_" +
                 speed + "_high.h5"),
        tls.group_by_location,
        groups=groups)
    print("Higher vel calculated")

    higer_dic = {}
    for key in higher_avg_vel.keys():
        higer_dic[str(key).replace("-0.0", "0.0")] = higher_avg_vel[key]

    tls.save_as_json(
        higer_dic, "raupach_data/" + prefix + "avg_vel_by_loc_higher_" + speed)

    lower_avg_vel = group_avarage_velocity_w(
        ft.Scene("C:/Users/theem/Desktop/Projects/alpha offline/Data/traj_" +
                 speed + "_low.h5"),
        tls.group_by_location,
        groups=groups)
    print("Lower vel calculated")

    lower_dic = {}
    for key in lower_avg_vel.keys():
        lower_dic[str(key).replace("-0.0", "0.0")] = lower_avg_vel[key]

    tls.save_as_json(
        lower_dic, "raupach_data/" + prefix + "avg_vel_by_loc_lower_" + speed)

    merged = tls.merge_dict(lower_dic, higer_dic, merge_long_dict)

    tls.save_as_json(merged,
                     "raupach_data/" + prefix + "avg_vel_by_loc_" + speed)
def auto_rey_stress_err_calculator(speed, skip_vel=True):
    if not skip_vel:
        get_velocity_by_loc(speed)

    high_stress = get_reynolds_stress_errors(
        ft.Scene("C:/Users/theem/Desktop/Projects/alpha offline/Data/traj_" +
                 speed + "_high.h5"),
        "raupach_data/goruped_u_avg_vel_by_loc_" + speed,
        "raupach_data/goruped_w_avg_vel_by_loc_" + speed, True)
    print("Stress higher calculated")
    print(high_stress)

    low_stress = get_reynolds_stress_errors(
        ft.Scene("C:/Users/theem/Desktop/Projects/alpha offline/Data/traj_" +
                 speed + "_low.h5"),
        "raupach_data/goruped_u_avg_vel_by_loc_" + speed,
        "raupach_data/goruped_w_avg_vel_by_loc_" + speed, True)
    print("Stress lower calculeted")
    print(low_stress)

    tls.save_as_json(high_stress,
                     "raupach_data/rey_stress_higher_lerr_" + speed)
    tls.save_as_json(low_stress, "raupach_data/rey_stress_lower_lerr_" + speed)

    merged_stress = tls.merge_dict(
        high_stress, low_stress, lambda a, b: [(a[0] * a[1] + b[0] * b[1]) /
                                               (a[1] + b[1]), a[1] + b[1]])

    tls.save_as_json(merged_stress, "raupach_data/rey_stress_lerr_" + speed)

    high_stress = get_reynolds_stress_errors(
        ft.Scene("C:/Users/theem/Desktop/Projects/alpha offline/Data/traj_" +
                 speed + "_high.h5"),
        "raupach_data/goruped_u_avg_vel_by_loc_" + speed,
        "raupach_data/goruped_w_avg_vel_by_loc_" + speed, False)
    print("Stress higher calculated")
    print(high_stress)

    low_stress = get_reynolds_stress_errors(
        ft.Scene("C:/Users/theem/Desktop/Projects/alpha offline/Data/traj_" +
                 speed + "_low.h5"),
        "raupach_data/goruped_u_avg_vel_by_loc_" + speed,
        "raupach_data/goruped_w_avg_vel_by_loc_" + speed, False)
    print("Stress lower calculeted")
    print(low_stress)

    tls.save_as_json(high_stress,
                     "raupach_data/rey_stress_higher_herr_" + speed)
    tls.save_as_json(low_stress, "raupach_data/rey_stress_lower_herr_" + speed)

    merged_stress = tls.merge_dict(
        high_stress, low_stress, lambda a, b: [(a[0] * a[1] + b[0] * b[1]) /
                                               (a[1] + b[1]), a[1] + b[1]])

    tls.save_as_json(merged_stress, "raupach_data/rey_stress_herr_" + speed)
Exemplo n.º 3
0
def get_average_velocity(speed):
    low_speed = group_avarage_velocity(
        ft.Scene("/home/ron/Desktop/Alexey/the_dataset/traj_" + speed +
                 "_low.h5"),
        lambda t, i: tls.group_by_height(t, i, 0, 0.18, 0.01))
    high_speed = group_avarage_velocity(
        ft.Scene("/home/ron/Desktop/Alexey/the_dataset/traj_" + speed +
                 "_high.h5"),
        lambda t, i: tls.group_by_height(t, i, 0, 0.18, 0.01))

    tls.save_as_json(low_speed,
                     "cd_data/avg_vel_by_height_" + speed + "_lower")
    tls.save_as_json(high_speed,
                     "cd_data/avg_vel_by_height_" + speed + "_higher")

    mrg = tls.merge_dict(
        low_speed, high_speed,
        lambda a, b: [((np.array(a[0]) * a[1] + np.array(b[0]) * b[1]) /
                       (a[1] + b[1])).tolist(), a[1] + b[1]])

    tls.save_as_json(mrg, "cd_data/avg_vel_by_height_" + speed)
def auto_disp_stress_calculator(speed):

    high_stress = get_dispersive_stress(
        ft.Scene("/home/ron/Desktop/Alexey/the_dataset/traj_" + speed +
                 "_high.h5"), "raupach_data/avg_vel_by_loc_" + speed,
        "cd_data/avg_vel_by_height_" + speed)
    print("Stress higher calculated")
    print(high_stress)

    low_stress = get_dispersive_stress(
        ft.Scene("/home/ron/Desktop/Alexey/the_dataset/traj_" + speed +
                 "_low.h5"), "raupach_data/avg_vel_by_loc_" + speed,
        "cd_data/avg_vel_by_height_" + speed)
    print("Stress lower calculeted")
    print(low_stress)

    tls.save_as_json(high_stress, "raupach_data/disp_stress_higher_" + speed)
    tls.save_as_json(low_stress, "raupach_data/disp_stress_lower_" + speed)

    merged_stress = tls.merge_dict(
        high_stress, low_stress, lambda a, b: [(a[0] * a[1] + b[0] * b[1]) /
                                               (a[1] + b[1]), a[1] + b[1]])

    tls.save_as_json(merged_stress, "raupach_data/disp_stress_" + speed)