Exemple #1
0
def tempratio(temp_c, mach):
    """Ratio of total temperature and the standard SL temperature"""
    temp_k = co.c2k(temp_c)
    sealevelstdtmp_k = co.c2k(15.0)
    theta0 = (temp_k / sealevelstdtmp_k) * (1 + (mach**2) *
                                            (GAMMA_DRY_AIR - 1) / 2)
    return theta0
def environmental_data_dictionary(values_list, index):
    """Designed for the weather data (index = 0) and runway data (index = 1)

    Returns a dictionary data set in the form:
    [[dictionary_1, flight_1], [dictionary_2, flight_2]]
    """
    data_set = environmental_data_filtering(values_list)
    data_list = []
    number_of_flights = len(values_list)
    # Runs through the number of flights and creates a dictionary for each flight
    for flight in range(number_of_flights):
        data = {}
        data_raw = data_set[flight][index]
        for entry in data_raw:
            if entry is not None and "dummy" not in entry[0].lower():
                name = str(entry[0]) + "_" + str(entry[1])
                name = name.replace(" ", "_")
                data_value = entry[-1][
                    0]  # the [0] is to return just the element (not a list)
                data[name] = data_value
        if index == 0:
            # Additional data calculations for weather data
            data["Density_kgperm3"] = data["Pressure_Pa"] / (
                287. * uc.c2k(data["Temperature_C"]))
        data_list.append([data, values_list[flight][0]])
    return data_list