def test(number): from data import data_loader data = getattr(data_loader, "get_site_" + str(number) + "_data")() from model.temperature import add_temp_columns add_temp_columns(data) add_estimated_height(data) print(data)
def plot_estimated_vs_actual_height(site_number: int): data = getattr(data_loader, "get_site_" + str(site_number) + "_data")() add_temp_columns(data) add_estimated_height(data) columns = [ Line("altitude", "From data", "b"), Line("estimated_height", "From hypsometric equation", "r"), ] plot_columns_vs_pressure(data, columns, "Height (m)", "Height Comparison - Site " + str(site_number)) plot_columns_vs_pressure(data, [Line("height_diff", "Altitude - Estimate", "b")], "Height Diff (m)", "Height Diff - Site " + str(site_number))
def estimate_bowen_ratio(data, height=20): height = rebase_reference_height(data, height) add_temp_columns(data) data = data[data["altitude"] <= height] # data.plot("altitude", "specific_humidity") # plt.savefig("test") data.reset_index(drop=True, inplace=True) # print(data["specific_humidity"]) gamma = .0004 potential_temp_slope = linregress(data["altitude"], data["theta"]).slope model_q = linregress(data["altitude"], data["specific_humidity"]) q_slope = model_q.slope potential_temp_slope = potential_temp_slope # print("r " + str(model_q.rvalue**2)) # print(potential_temp_slope) # print(q_slope) # print("gamma " + str(gamma)) return gamma * potential_temp_slope / q_slope
def get_fluxes(data, debug=False): add_temp_columns(data) rho = get_average_density(data, reference_height) wind_speed = get_reference_value(data, "speed", reference_height) surface_temp = get_surface_value(data, "temp") reference_temp = get_reference_value(data, "temp", reference_height) surface_q = get_surface_value(data, "specific_humidity") reference_q = get_reference_value(data, "specific_humidity", reference_height) sat_reference_q = get_reference_value(data, "sat_specific_humidity", reference_height) evaporative = get_evaporative_flux(rho, wind_speed, surface_q, reference_q, sat_reference_q) H_L = L_v * evaporative H_S = get_sensible_heat_flux(rho, wind_speed, surface_temp, reference_temp) if debug: print("\tDebug output:") print("\t\trho: " + str(rho)) print("\t\twindspeed: " + str(wind_speed)) print("\t\tsurface_temp: " + str(surface_temp)) print("\t\treference_temp: " + str(reference_temp)) print("\t\tsurface_q: " + str(surface_q)) print("\t\treference_q: " + str(reference_q)) print("\t\tsat_reference_q: " + str(sat_reference_q)) return Fluxes(H_S, H_L, evaporative)
def test(number): from model import temperature data = getattr(data_loader, "get_site_" + str(number) + "_data")() temperature.add_temp_columns(data) compare_potential_temp_methods(data, "Site " + str(number))