Ejemplo n.º 1
0
def test_PV_lat_tilt(res, site_index):
    """Test the method to set tilt based on latitude."""
    rev2_points = TESTDATADIR + '/project_points/ri.csv'
    sam_files = [
        TESTDATADIR + '/SAM/naris_pv_1axis_inv13.json',
        TESTDATADIR + '/SAM/naris_pv_1axis_inv13.json'
    ]
    sam_files = {'sam_param_{}'.format(i): k for i, k in enumerate(sam_files)}
    pp = ProjectPoints(rev2_points, sam_files, 'pv')

    for i, [res_df, meta] in enumerate(res):
        if i == site_index:
            # get SAM inputs from project_points based on the current site
            site = res_df.name
            config, inputs = pp[site]
            inputs['tilt'] = 'latitude'
            # iterate through requested sites.
            with warnings.catch_warnings():
                warnings.simplefilter("ignore")
                sim = Pvwattsv5(resource=res_df,
                                meta=meta,
                                sam_sys_inputs=inputs,
                                output_request=('cf_mean', ))
            break
        else:
            pass

    assert sim.sam_sys_inputs['tilt'] == meta['latitude']
Ejemplo n.º 2
0
def test_time_interval(dt):
    """Test the method to get the 'time interval' from the time index obj."""
    baseline = {'1h': 1, '30min': 2, '5min': 12}
    ti = pd.date_range('1-1-{y}'.format(y=2012),
                       '1-1-{y}'.format(y=2013),
                       freq=dt)[:-1]
    interval = Pvwattsv5.get_time_interval(ti)
    assert interval == baseline[dt]
Ejemplo n.º 3
0
def test_leap_year(res):
    """Test the method to ensure resource array length with dropping leap day.
    """
    for res_df, meta in res:
        res_dropped = Pvwattsv5.drop_leap(res_df)
        break
    compare = np.allclose(res_dropped.iloc[-9000:, :].values,
                          res_df.iloc[-9000:, :].values)
    assert compare
Ejemplo n.º 4
0
def test_res_length(res):
    """Test the method to ensure resource array length with truncation."""
    for res_df, meta in res:
        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            res_dropped = Pvwattsv5.ensure_res_len(res_df.values)
        break
    compare = np.allclose(res_dropped[:9000, :], res_df.values[:9000, :])
    return compare