Ejemplo n.º 1
0
def test_from_tmy_2():
    from test_tmy import TMY2_TESTFILE
    from pvlib.iotools import read_tmy2
    data, meta = read_tmy2(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.weather, data)
Ejemplo n.º 2
0
def test_from_tmy_2():
    from test_tmy import tmy2_testfile
    from pvlib.iotools import read_tmy2
    data, meta = read_tmy2(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)
Ejemplo n.º 3
0
def test_from_tmy_2():
    from test_tmy import tmy2_testfile
    from pvlib.iotools import read_tmy2
    data, meta = read_tmy2(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)
Ejemplo n.º 4
0
    def _activate(self, system: System, **kwargs) -> None:
        from pvlib.iotools import read_tmy2, read_tmy3

        dir = os.path.dirname(self.file)
        if not os.path.isdir(dir):
            os.makedirs(dir, exist_ok=True)

        if self.version == 3:
            self.data, self.meta = read_tmy3(filename=self.file,
                                             coerce_year=self.year)

        elif self.version == 2:
            self.data, self.meta = read_tmy2(self.file)
        else:
            raise ValueError('Invalid TMY version: {}'.format(self.version))