예제 #1
0
def output_model() -> str:
    df = get_hobolink_data('code_for_boston_export_21d')
    df = process_data(df)
    return '<br /><br />'.join(
        map(stylize_model_output, [
            reach_2_model(df),
            reach_3_model(df),
            reach_4_model(df),
            reach_5_model(df)
        ]))
예제 #2
0
def index() -> str:
    df_hobolink = get_hobolink_data('code_for_boston_export_21d')
    df_usgs = get_usgs_data()
    df = process_data(df_hobolink, df_usgs)
    flags = {
        2: reach_2_model(df, rows=1)['r2_safe'].iloc[0],
        3: reach_3_model(df, rows=1)['r3_safe'].iloc[0],
        4: reach_4_model(df, rows=1)['r4_safe'].iloc[0],
        5: reach_5_model(df, rows=1)['r5_safe'].iloc[0]
    }
    return render_template('index.html', flags=flags)
예제 #3
0
파일: test_api.py 프로젝트: dfe325/flagging
def test_model_output_api_parameters(app):
    """test_model_output_api_parameters() should test that hours=10 returns 10 rows of data,
    that setting the reach returns only that reach."""
    with app.app_context():
        df = reach_2_model(process_data(df_usgs=get_live_usgs_data(), df_hobolink=get_live_hobolink_data('code_for_boston_export_21d')), 10)
        row_count = len(df)
        assert row_count == 10
        test_reach = model_api([3], 10)
        test_reach = list(test_reach.values())
        expected_reach = list(test_reach[2].items())[0][0]
        assert 'reach_3' == expected_reach
예제 #4
0
def output_model() -> str:
    df_hobolink = get_hobolink_data('code_for_boston_export_21d')
    df_usgs = get_usgs_data()
    df = process_data(df_hobolink, df_usgs)
    table_html = '<br /><br />'.join(
        map(stylize_model_output, [
            reach_2_model(df),
            reach_3_model(df),
            reach_4_model(df),
            reach_5_model(df)
        ]))
    return render_template('output_model.html', tables=table_html)
예제 #5
0
def get_data() -> pd.DataFrame:
    """Retrieves the data that gets plugged into the the model."""
    df_hobolink = get_hobolink_data('code_for_boston_export_21d')
    df_usgs = get_usgs_data()
    df = process_data(df_hobolink, df_usgs)
    return df