How to use the eemeter.modeling.formatters.ModelDataFormatter function in eemeter

To help you get started, we’ve selected a few eemeter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openeemeter / eemeter / tests / modeling / test_model_data_formatter.py View on Github external
def test_basic_hourly_to_daily(hourly_trace, monkeypatch_temperature_data,
    mock_isd_weather_source):
    mdf = ModelDataFormatter("D")

    df = mdf.create_input(hourly_trace, mock_isd_weather_source)

    assert all(df.columns == ["energy", "tempF"])
    assert df.index[0] == datetime(2000, 1, 1, 0, tzinfo=pytz.UTC)
    assert df.index.freq == 'D'
    assert_allclose(df.energy, [2])
    assert_allclose(df.tempF, [35.507344])
github openeemeter / eemeter / tests / ee / test_annualized_weather_normal.py View on Github external
def test_daily(mock_tmy3_weather_source):
    formatter = ModelDataFormatter("D")
    model = MockModel()
    output = annualized_weather_normal(
        formatter, model, mock_tmy3_weather_source)

    assert_allclose(output['annualized_weather_normal'][:4],
                    (365, 1, 1, 365))

    serialized = output['annualized_weather_normal'][4]
    assert len(serialized) == 365
    assert serialized['2015-01-01T00:00:00+00:00'] == 32
github openeemeter / eemeter / tests / modeling / test_model_data_formatter.py View on Github external
def test_daily_to_hourly_fails(daily_trace, monkeypatch_temperature_data,
    mock_isd_weather_source):
    mdf = ModelDataFormatter("H")

    with pytest.raises(ValueError):
        mdf.create_input(daily_trace, mock_isd_weather_source)
github openeemeter / eemeter / tests / modeling / test_seasonal_model.py View on Github external
def input_df(monkeypatch_temperature_data, daily_trace,
    mock_isd_weather_source):
    mdf = ModelDataFormatter("D")
    return mdf.create_input(daily_trace, mock_isd_weather_source)
github openeemeter / eemeter / tests / modeling / test_model_data_formatter.py View on Github external
def test_repr():
    mdf = ModelDataFormatter("H")
    assert str(mdf) == 'ModelDataFormatter("H")'
github openeemeter / eemeter / tests / modeling / test_model_data_formatter.py View on Github external
def test_hourly_demand_fixture(hourly_trace, monkeypatch_temperature_data,
    mock_isd_weather_source):
    mdf = ModelDataFormatter("H")

    df = mdf.create_demand_fixture(hourly_trace.data.index,
        mock_isd_weather_source)
    assert all(df.columns == ["tempF"])
    assert df.index[0] == datetime(2000, 1, 1, 0, tzinfo=pytz.UTC)
    assert df.index[2] == datetime(2000, 1, 1, 2, tzinfo=pytz.UTC)
    assert df.index.freq == 'H'
    assert_allclose(df.tempF, [35.617314, 35.607664, 35.598025])
github openeemeter / eemeter / tests / modeling / test_model_data_formatter.py View on Github external
def test_empty_description():
    mdf = ModelDataFormatter("H")
    description = mdf.describe_input(pd.DataFrame())
    assert description['start_date'] is None
    assert description['end_date'] is None
    assert description['n_rows'] is 0
github openeemeter / eemeter / tests / modeling / test_model_data_formatter.py View on Github external
def test_daily_demand_fixture(daily_trace, monkeypatch_temperature_data,
    mock_isd_weather_source):
    mdf = ModelDataFormatter("D")

    df = mdf.create_demand_fixture(daily_trace.data.index,
        mock_isd_weather_source)

    assert all(df.columns == ["tempF"])
    assert df.index[0] == datetime(2000, 1, 1, 0, tzinfo=pytz.UTC)
    assert df.index[2] == datetime(2000, 1, 3, tzinfo=pytz.UTC)
    assert df.index.freq == 'D'
    assert_allclose(df.tempF, [35.507344, 35.282373, 35.064391])
github openeemeter / eemeter / tests / ee / test_gross_predicted.py View on Github external
def test_basic_usage(mock_isd_weather_source,
                     reporting_period_end_date,
                     reporting_period_no_end_date):
    formatter = ModelDataFormatter("D")
    model = MockModel()

    output_end_date = gross_predicted(
        formatter, model, mock_isd_weather_source, reporting_period_end_date)

    output_no_end_date = gross_predicted(
        formatter, model, mock_isd_weather_source,
        reporting_period_no_end_date)

    assert_allclose(output_end_date['gross_predicted'][:4],
                    (547, 1, 1, 547))
    assert (
        output_end_date['gross_predicted'][0] <
        output_no_end_date['gross_predicted'][0]
    )
github openeemeter / eemeter / tests / modeling / test_model_data_formatter.py View on Github external
def test_basic_15min_to_daily(fifteen_min_trace, monkeypatch_temperature_data,
    mock_isd_weather_source):
    mdf = ModelDataFormatter("D")

    df = mdf.create_input(fifteen_min_trace, mock_isd_weather_source)

    assert all(df.columns == ["energy", "tempF"])
    assert df.index[0] == datetime(2011, 1, 1, 0, tzinfo=pytz.UTC)
    assert df.index.freq == 'D'
    assert df.energy.shape == (100,)
    assert df.tempF.shape == (100,)