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_2(): from test_tmy import tmy2_testfile from pvlib.tmy import readtmy2 data, meta = readtmy2(tmy2_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_tmy2(): pvlib_abspath = os.path.dirname(os.path.abspath(inspect.getfile(tmy))) tmy2_testfile = os.path.join(pvlib_abspath, 'data', '12839.tm2') tmy2_data, tmy2_metadata = tmy.readtmy2(tmy2_testfile) expected = { 'tz': -5, 'albedo': 0.1, 'altitude': 2.0, 'latitude': 25.8, 'longitude': -80.26666666666667, 'name': 'MIAMI', 'strings_per_inverter': 5, 'modules_per_string': 5, 'surface_azimuth': 0, 'surface_tilt': 0 } assert expected == pvsystem.systemdef(tmy2_metadata, 0, 0, .1, 5, 5)
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_systemdef_tmy2():
def test_readtmy2(): tmy.readtmy2(os.path.join(test_dir, '../data/12839.tm2'))
def test_readtmy2(): tmy.readtmy2(tmy2_testfile)