def test_deprecated_07(): with pytest.warns(pvlibDeprecationWarning): from pvlib.tmy import readtmy2 readtmy2(tmy2_testfile) with pytest.warns(pvlibDeprecationWarning): from pvlib.tmy import readtmy3 readtmy3(tmy3_testfile)
def test_from_tmy_3(): from test_tmy import tmy3_testfile from pvlib.tmy import readtmy3 data, meta = readtmy3(tmy3_testfile) loc = Location.from_tmy(meta, data) assert loc.name is not None assert loc.altitude != 0 assert loc.tz != 'UTC' assert_frame_equal(loc.tmy_data, data)
def test_systemdef_tmy3(): pvlib_abspath = os.path.dirname(os.path.abspath(inspect.getfile(tmy))) tmy3_testfile = os.path.join(pvlib_abspath, 'data', '703165TY.csv') tmy3_data, tmy3_metadata = tmy.readtmy3(tmy3_testfile) expected = { 'tz': -9.0, 'albedo': 0.1, 'altitude': 7.0, 'latitude': 55.317, 'longitude': -160.517, 'name': '"SAND POINT"', 'strings_per_inverter': 5, 'modules_per_string': 5, 'surface_azimuth': 0, 'surface_tilt': 0 } assert expected == pvsystem.systemdef(tmy3_metadata, 0, 0, .1, 5, 5)
def test_readtmy3(): tmy.readtmy3(os.path.join(test_dir, '../data/703165TY.csv'))
ephem_data['apparent_azimuth']) am = atmosphere.relativeairmass(ephem_data.apparent_zenith) meta = {'latitude': 37.8, 'longitude': -122.3, 'altitude': 10, 'Name': 'Oakland', 'State': 'CA', 'TZ': -8} pvlib_abspath = os.path.dirname(os.path.abspath(inspect.getfile(tmy))) tmy3_testfile = os.path.join(pvlib_abspath, 'data', '703165TY.csv') tmy2_testfile = os.path.join(pvlib_abspath, 'data', '12839.tm2') tmy3_data, tmy3_metadata = tmy.readtmy3(tmy3_testfile) tmy2_data, tmy2_metadata = tmy.readtmy2(tmy2_testfile) def test_systemdef_tmy3(): expected = {'tz': -9.0, 'albedo': 0.1, 'altitude': 7.0, 'latitude': 55.317, 'longitude': -160.517, 'name': '"SAND POINT"', 'parallel_modules': 5, 'series_modules': 5, 'surface_azimuth': 0, 'surface_tilt': 0} assert_equals(expected, pvsystem.systemdef(tmy3_metadata, 0, 0, .1, 5, 5))
def test_readtmy3_no_coerce_year(): coerce_year = None data, meta = tmy.readtmy3(tmy3_testfile, coerce_year=coerce_year) assert 1997 and 1999 in data.index.year
def test_readtmy3_norecolumn(): data, meta = tmy.readtmy3(tmy3_testfile, recolumn=False) assert 'GHI source' in data.columns
def test_readtmy3_coerce_year(): coerce_year = 1987 data, meta = tmy.readtmy3(tmy3_testfile, coerce_year=coerce_year) assert (data.index.year == 1987).all()
def test_readtmy3_remote(): url = 'http://rredc.nrel.gov/solar/old_data/nsrdb/1991-2005/data/tmy3/703165TYA.CSV' tmy.readtmy3(url)
def test_readtmy3_recolumn(): data, meta = tmy.readtmy3(tmy3_testfile) assert 'GHISource' in data.columns
def test_readtmy3(): tmy.readtmy3(tmy3_testfile)