Ejemplo n.º 1
0
def test_gti_dirint():
    times = pd.DatetimeIndex(
        ['2014-06-24T06-0700', '2014-06-24T09-0700', '2014-06-24T12-0700'])
    poa_global = np.array([20, 300, 1000])
    aoi = np.array([100, 70, 10])
    zenith = np.array([80, 45, 20])
    azimuth = np.array([90, 135, 180])
    surface_tilt = 30
    surface_azimuth = 180

    # test defaults
    output = irradiance.gti_dirint(
        poa_global, aoi, zenith, azimuth, times, surface_tilt, surface_azimuth)

    expected_col_order = ['ghi', 'dni', 'dhi']
    expected = pd.DataFrame(array(
        [[  21.05796198,    0.        ,   21.05796198],
         [ 288.22574368,   60.59964218,  245.37532576],
         [ 931.04078010,  695.94965324,  277.06172442]]),
        columns=expected_col_order, index=times)

    assert_frame_equal(output, expected)

    # test ignore calculate_gt_90
    output = irradiance.gti_dirint(
        poa_global, aoi, zenith, azimuth, times, surface_tilt, surface_azimuth,
        calculate_gt_90=False)

    expected_no_90 = expected.copy()
    expected_no_90.iloc[0, :] = np.nan

    assert_frame_equal(output, expected_no_90)

    # test pressure input
    pressure = 93193.
    output = irradiance.gti_dirint(
        poa_global, aoi, zenith, azimuth, times, surface_tilt, surface_azimuth,
        pressure=pressure)

    expected = pd.DataFrame(array(
        [[  21.05796198,    0.        ,   21.05796198],
         [ 289.81109139,   60.52460392,  247.01373353],
         [ 932.46756378,  648.05001357,  323.49974813]]),
        columns=expected_col_order, index=times)

    assert_frame_equal(output, expected)

    # test albedo input
    albedo = 0.05
    output = irradiance.gti_dirint(
        poa_global, aoi, zenith, azimuth, times, surface_tilt, surface_azimuth,
        albedo=albedo)

    expected = pd.DataFrame(array(
        [[  21.3592591,    0.        ,   21.3592591 ],
         [ 292.5162373,   64.42628826,  246.95997198],
         [ 941.6753031,  727.16311901,  258.36548605]]),
        columns=expected_col_order, index=times)

    assert_frame_equal(output, expected)

    # test temp_dew input
    temp_dew = np.array([70, 80, 20])
    output = irradiance.gti_dirint(
        poa_global, aoi, zenith, azimuth, times, surface_tilt, surface_azimuth,
        temp_dew=temp_dew)

    expected = pd.DataFrame(array(
        [[  21.05796198,    0.        ,   21.05796198],
         [ 292.40468994,   36.79559287,  266.3862767 ],
         [ 931.79627208,  689.81549269,  283.5817439]]),
        columns=expected_col_order, index=times)

    assert_frame_equal(output, expected)
Ejemplo n.º 2
0
def test_gti_dirint():
    times = pd.DatetimeIndex(
        ['2014-06-24T06-0700', '2014-06-24T09-0700', '2014-06-24T12-0700'])
    poa_global = np.array([20, 300, 1000])
    aoi = np.array([100, 70, 10])
    zenith = np.array([80, 45, 20])
    azimuth = np.array([90, 135, 180])
    surface_tilt = 30
    surface_azimuth = 180

    # test defaults
    output = irradiance.gti_dirint(
        poa_global, aoi, zenith, azimuth, times, surface_tilt, surface_azimuth)

    expected_col_order = ['ghi', 'dni', 'dhi']
    expected = pd.DataFrame(array(
        [[  21.05796198,    0.        ,   21.05796198],
         [ 288.22574368,   60.59964218,  245.37532576],
         [ 930.85454521,  695.8504884 ,  276.96897609]]),
        columns=expected_col_order, index=times)

    assert_frame_equal(output, expected)

    # test ignore calculate_gt_90
    output = irradiance.gti_dirint(
        poa_global, aoi, zenith, azimuth, times, surface_tilt, surface_azimuth,
        calculate_gt_90=False)

    expected_no_90 = expected.copy()
    expected_no_90.iloc[0, :] = np.nan

    assert_frame_equal(output, expected_no_90)

    # test pressure input
    pressure = 93193.
    output = irradiance.gti_dirint(
        poa_global, aoi, zenith, azimuth, times, surface_tilt, surface_azimuth,
        pressure=pressure)

    expected = pd.DataFrame(array(
        [[  21.05796198,    0.        ,   21.05796198],
         [ 289.81109139,   60.52460392,  247.01373353],
         [ 932.22047435,  647.68716072,  323.59362885]]),
        columns=expected_col_order, index=times)

    assert_frame_equal(output, expected)

    # test albedo input
    albedo = 0.05
    output = irradiance.gti_dirint(
        poa_global, aoi, zenith, azimuth, times, surface_tilt, surface_azimuth,
        albedo=albedo)

    expected = pd.DataFrame(array(
        [[  21.3592591 ,    0.        ,   21.3592591 ],
         [ 292.5162373 ,   64.42628826,  246.95997198],
         [ 941.47847463,  727.07261187,  258.25370648]]),
        columns=expected_col_order, index=times)

    assert_frame_equal(output, expected)

    # test temp_dew input
    temp_dew = np.array([70, 80, 20])
    output = irradiance.gti_dirint(
        poa_global, aoi, zenith, azimuth, times, surface_tilt, surface_azimuth,
        temp_dew=temp_dew)

    expected = pd.DataFrame(array(
        [[  21.05796198,    0.        ,   21.05796198],
         [ 292.40468994,   36.79559287,  266.3862767 ],
         [ 930.72198876,  712.36063132,  261.32196017]]),
        columns=expected_col_order, index=times)

    assert_frame_equal(output, expected)
Ejemplo n.º 3
0
def test_gti_dirint():
    times = pd.DatetimeIndex(
        ['2014-06-24T06-0700', '2014-06-24T09-0700', '2014-06-24T12-0700'])
    poa_global = np.array([20, 300, 1000])
    aoi = np.array([100, 70, 10])
    zenith = np.array([80, 45, 20])
    azimuth = np.array([90, 135, 180])
    surface_tilt = 30
    surface_azimuth = 180

    # test defaults
    output = irradiance.gti_dirint(poa_global, aoi, zenith, azimuth, times,
                                   surface_tilt, surface_azimuth)

    expected_col_order = ['ghi', 'dni', 'dhi']
    expected = pd.DataFrame(array([[21.05796198, 0., 21.05796198],
                                   [288.22574368, 60.59964218, 245.37532576],
                                   [931.04078010, 695.94965324,
                                    277.06172442]]),
                            columns=expected_col_order,
                            index=times)

    assert_frame_equal(output, expected)

    # test ignore calculate_gt_90
    output = irradiance.gti_dirint(poa_global,
                                   aoi,
                                   zenith,
                                   azimuth,
                                   times,
                                   surface_tilt,
                                   surface_azimuth,
                                   calculate_gt_90=False)

    expected_no_90 = expected.copy()
    expected_no_90.iloc[0, :] = np.nan

    assert_frame_equal(output, expected_no_90)

    # test pressure input
    pressure = 93193.
    output = irradiance.gti_dirint(poa_global,
                                   aoi,
                                   zenith,
                                   azimuth,
                                   times,
                                   surface_tilt,
                                   surface_azimuth,
                                   pressure=pressure)

    expected = pd.DataFrame(array([[21.05796198, 0., 21.05796198],
                                   [289.81109139, 60.52460392, 247.01373353],
                                   [932.46756378, 648.05001357,
                                    323.49974813]]),
                            columns=expected_col_order,
                            index=times)

    assert_frame_equal(output, expected)

    # test albedo input
    albedo = 0.05
    output = irradiance.gti_dirint(poa_global,
                                   aoi,
                                   zenith,
                                   azimuth,
                                   times,
                                   surface_tilt,
                                   surface_azimuth,
                                   albedo=albedo)

    expected = pd.DataFrame(array([[21.3592591, 0., 21.3592591],
                                   [292.5162373, 64.42628826, 246.95997198],
                                   [941.6753031, 727.16311901, 258.36548605]]),
                            columns=expected_col_order,
                            index=times)

    assert_frame_equal(output, expected)

    # test temp_dew input
    temp_dew = np.array([70, 80, 20])
    output = irradiance.gti_dirint(poa_global,
                                   aoi,
                                   zenith,
                                   azimuth,
                                   times,
                                   surface_tilt,
                                   surface_azimuth,
                                   temp_dew=temp_dew)

    expected = pd.DataFrame(array([[21.05796198, 0., 21.05796198],
                                   [292.40468994, 36.79559287, 266.3862767],
                                   [931.79627208, 689.81549269, 283.5817439]]),
                            columns=expected_col_order,
                            index=times)

    assert_frame_equal(output, expected)
Ejemplo n.º 4
0
def test_gti_dirint():
    times = pd.DatetimeIndex(
        ['2014-06-24T06-0700', '2014-06-24T09-0700', '2014-06-24T12-0700'])
    poa_global = np.array([20, 300, 1000])
    aoi = np.array([100, 70, 10])
    zenith = np.array([80, 45, 20])
    azimuth = np.array([90, 135, 180])
    surface_tilt = 30
    surface_azimuth = 180

    # test defaults
    output = irradiance.gti_dirint(poa_global, aoi, zenith, azimuth, times,
                                   surface_tilt, surface_azimuth)

    expected_col_order = ['ghi', 'dni', 'dhi']
    expected = pd.DataFrame(array([[21.05796198, 0., 21.05796198],
                                   [291.40037163, 63.41290679, 246.56067523],
                                   [931.04078010, 695.94965324,
                                    277.06172442]]),
                            columns=expected_col_order,
                            index=times)

    assert_frame_equal(output, expected)

    # test ignore calculate_gt_90
    output = irradiance.gti_dirint(poa_global,
                                   aoi,
                                   zenith,
                                   azimuth,
                                   times,
                                   surface_tilt,
                                   surface_azimuth,
                                   calculate_gt_90=False)

    expected_no_90 = expected.copy()
    expected_no_90.iloc[0, :] = np.nan

    assert_frame_equal(output, expected_no_90)

    # test pressure input
    pressure = 93193.
    output = irradiance.gti_dirint(poa_global,
                                   aoi,
                                   zenith,
                                   azimuth,
                                   times,
                                   surface_tilt,
                                   surface_azimuth,
                                   pressure=pressure)

    expected = pd.DataFrame(array([[21.05796198, 0., 21.05796198],
                                   [293.21310935, 63.27500913, 248.47092131],
                                   [932.46756378, 648.05001357,
                                    323.49974813]]),
                            columns=expected_col_order,
                            index=times)

    assert_frame_equal(output, expected)

    # test albedo input
    albedo = 0.05
    output = irradiance.gti_dirint(poa_global,
                                   aoi,
                                   zenith,
                                   azimuth,
                                   times,
                                   surface_tilt,
                                   surface_azimuth,
                                   albedo=albedo)

    expected = pd.DataFrame(array([[21.3592591, 0., 21.3592591],
                                   [294.4985420, 66.25848451, 247.64671830],
                                   [941.7943404, 727.50552952, 258.16276278]]),
                            columns=expected_col_order,
                            index=times)

    assert_frame_equal(output, expected)

    # test temp_dew input
    temp_dew = np.array([70, 80, 20])
    output = irradiance.gti_dirint(poa_global,
                                   aoi,
                                   zenith,
                                   azimuth,
                                   times,
                                   surface_tilt,
                                   surface_azimuth,
                                   temp_dew=temp_dew)

    expected = pd.DataFrame(array([[21.05796198, 0., 21.05796198],
                                   [295.06070190, 38.20346345, 268.0467738],
                                   [931.79627208, 689.81549269, 283.5817439]]),
                            columns=expected_col_order,
                            index=times)

    assert_frame_equal(output, expected)