Esempio n. 1
0
def precip_to_runoff_h4(hydro_events:np.ndarray ,atlas14_precip_table_dir: pl.WindowsPath,
                     precip_data: pd.DataFrame,df_weights_rainfall: pd.DataFrame, display_print = False) -> tuple:
    """Takes the events, precipitation data, atlas 14 temporal distribution, selected CNs and applies the 
    CN reduction method to obtain a runoff curve for each recurrence interval. 
    """  
    Atlas14_hyetographs = ['q1', 'q2', 'q3', 'q4']
    hydro_events = list(df_weights_rainfall.index)
    column_names = []
    for event in hydro_events:
        for hyetograph in Atlas14_hyetographs:
            column_names.append(event+'_'+hyetograph)
            
    prep_curves = pd.DataFrame(columns = column_names)
    prep_weights = pd.DataFrame(index = column_names, columns= ['Event Weight'])
    
    for  hyetograph in  Atlas14_hyetographs:
        for event in hydro_events:
            dist_df, weight_df = get_hyeto_input_data_atlas(atlas14_precip_table_dir, hyetograph, display_print)
            dist_df['precip'] = dist_df[hyetograph]*df_weights_rainfall['Rainfall'].loc[event]
            s = df_weights_rainfall['Avg. S'].loc[event]
            ia = IA_24hr(s)
            dist_df = excess_precip(dist_df,ia, s)
            prep_curves[event+'_'+hyetograph] = dist_df['hyeto_input']
            prep_weights['Event Weight'].loc[event+'_'+hyetograph] = df_weights_rainfall['Event Weight'][event]*weight_df['weight'][hyetograph]
    return prep_curves, prep_weights
Esempio n. 2
0
def precip_to_runoff_h2(hydro_events:np.ndarray ,nrcs_precip_table_dir: pl.WindowsPath,
                     precip_data: pd.DataFrame,df_weights_rainfall: pd.DataFrame, CN: int, display_print = False) -> pd.DataFrame:
    """Takes the events, precipitation data, nrcs temporal distribution, CN and applies the CN reduction method to
    obtain a runoff curve for each recurrence interval. Also applies to events beyond published Atlas 14 values. 
    """
    prep_curves = pd.DataFrame(columns = hydro_events)
    hyeto_graphs = np.where(df_weights_rainfall.index.to_numpy().astype(int)<1000, df_weights_rainfall.index.to_numpy().astype(int),  1000).tolist()
    for event, hyetograph in zip(hydro_events, hyeto_graphs):
        dist_df = get_hyeto_input_data_nrcs(nrcs_precip_table_dir, hyetograph, display_print)
        dist_df['precip'] = dist_df['ratio']*df_weights_rainfall['P_Mean_in'].loc[event]
        s = S_24hr(CN)
        ia = IA_24hr(s)
        dist_df = excess_precip(dist_df,ia, s)
        prep_curves[event] = dist_df['hyeto_input']
    return prep_curves
Esempio n. 3
0
def precip_to_runoff_atlas(hydro_events_dict:dict,atlas14_precip_table_dir: pl.WindowsPath,
                     precip_data: pd.DataFrame, CN: int, quartile:int, display_print = False) -> pd.DataFrame:
    """Takes the events, precipitation data, nrcs temporal distribution, CN and applies the CN reduction method to
    obtain a runoff curve for each recurrence interval
    """
    #runoff_distros1 = {}
    Atlas14_hyetographs = {1:'q1',2: 'q2',3: 'q3',4: 'q4'}
    prep_curves = pd.DataFrame(columns = hydro_events_dict.keys())
    for event in hydro_events_dict.keys():
        dist_df, weight_df = get_hyeto_input_data_atlas(atlas14_precip_table_dir, Atlas14_hyetographs[quartile], display_print)
        dist_df['precip'] = dist_df[Atlas14_hyetographs[quartile]]*precip_data['Precip_in'].loc[event]
        s = S_24hr(CN)
        ia = IA_24hr(s)
        dist_df = excess_precip(dist_df,ia, s)
        prep_curves[event] = dist_df['hyeto_input']
    return prep_curves
Esempio n. 4
0
def precip_to_runoff_h3(hydro_events:np.ndarray ,nrcs_precip_table_dir: pl.WindowsPath,
                     precip_data: pd.DataFrame,df_weights_rainfall: pd.DataFrame, display_print = False) -> pd.DataFrame:
    """Takes the events, precipitation data, nrcs temporal distribution, selected CNs and applies the CN 
    reduction method to obtain a runoff curve for each recurrence interval. 
    """  
    hyeto_graphs = np.where(hydro_events <1000, hydro_events, 1000).astype(int).tolist()
    hydro_events = list(df_weights_rainfall.index)
    prep_curves = pd.DataFrame(columns = hydro_events)
    for event, hyetograph in zip(hydro_events, hyeto_graphs):
        dist_df = get_hyeto_input_data_nrcs(nrcs_precip_table_dir, hyetograph, display_print)
        dist_df['precip'] = dist_df['ratio']*df_weights_rainfall['Rainfall'].loc[event]
        s = df_weights_rainfall['Avg. S'].loc[event]
        ia = IA_24hr(s)
        dist_df = excess_precip(dist_df,ia, s)
        prep_curves[event] = dist_df['hyeto_input']
    return prep_curves
Esempio n. 5
0
def precip_to_runoff_nrcs(hydro_events_dict:dict,nrcs_precip_table_dir: pl.WindowsPath,
                     precip_data: pd.DataFrame, CN: int, display_print = False) -> pd.DataFrame:
    """Takes the events, precipitation data, nrcs temporal distribution, CN and applies the CN reduction method to
    obtain a runoff curve for each recurrence interval
    """
    #runoff_distros1 = {}
    
    prep_curves = pd.DataFrame(columns = hydro_events_dict.keys())
    for event in hydro_events_dict.keys():
        dist_df = get_hyeto_input_data_nrcs(nrcs_precip_table_dir, hydro_events_dict[event], display_print)
        dist_df['precip'] = dist_df['ratio']*precip_data['Precip_in'].loc[event]
        s = S_24hr(CN)
        ia = IA_24hr(s)
        dist_df = excess_precip(dist_df,ia, s)
        prep_curves[event] = dist_df['hyeto_input']
    return prep_curves
def precip_to_runoff_h1(hydro_events:np.ndarray,nrcs_precip_table_dir: pl.WindowsPath,
                     precip_data: pd.DataFrame, df_weights_rainfall: pd.DataFrame, CN: int, display_print = False) -> pd.DataFrame:
    """Takes the events, precipitation data, nrcs temporal distribution, CN and applies the CN reduction method to
    obtain a runoff curve for each recurrence interval
    """
    #runoff_distros1 = {}
    prep_curves = pd.DataFrame(columns = hydro_events.astype(float))
    for evnt in hydro_events:
        dist_df = get_hyeto_input_data_nrcs(nrcs_precip_table_dir, evnt, display_print)
        dist_df['precip'] = dist_df['ratio']*precip_data['Median'].loc[evnt]
        s = S_24hr(CN)
        ia = IA_24hr(s)
        #runoff_distros1[evnt] = excess_precip(dist_df,ia, s)
        dist_df = excess_precip(dist_df,ia, s)
        prep_curves[evnt] = dist_df['hyeto_input']
    return prep_curves