def test_get_standard_effective_temperature_with_wind(): """Test the get_standard_effective_temperature method with wind.""" set_obj = PMV.from_epw(epw, True, False, met_rate=2.4, clo_value=1.0) assert set_obj.percent_neutral == pytest.approx(19.82, rel=1e-2) assert set_obj.percent_hot == pytest.approx(15.56, rel=1e-2) assert set_obj.percent_cold == pytest.approx(64.61, rel=1e-2)
def test_get_standard_effective_temperature_with_sun_and_wind(): """Test the get_standard_effective_temperature method with sun and wind.""" set_obj = PMV.from_epw(epw, True, True, met_rate=2.4, clo_value=1.0) assert set_obj.percent_neutral == pytest.approx(17.95, rel=1e-2) assert set_obj.percent_hot == pytest.approx(18.82, rel=1e-2) assert set_obj.percent_cold == pytest.approx(63.23, rel=1e-2)
def test_get_standard_effective_temperature(): """Test the get_standard_effective_temperature method.""" calc_length = 8760 set_obj = PMV.from_epw(epw, False, False, met_rate=2.4, clo_value=1.0) assert isinstance(set_obj, PMV) assert isinstance(set_obj.air_temperature, HourlyContinuousCollection) assert len(set_obj.air_temperature.values) == calc_length assert set_obj.air_temperature[0] == -6.1 assert isinstance(set_obj.rel_humidity, HourlyContinuousCollection) assert len(set_obj.rel_humidity.values) == calc_length assert set_obj.rel_humidity[0] == 81 assert isinstance(set_obj.standard_effective_temperature, HourlyContinuousCollection) assert len(set_obj.standard_effective_temperature.values) == calc_length assert set_obj.standard_effective_temperature[0] == pytest.approx(12.76, rel=1e-2) assert isinstance(set_obj.thermal_condition, HourlyContinuousCollection) assert len(set_obj.thermal_condition.values) == calc_length assert set_obj.thermal_condition[0] == -1 assert set_obj.percent_neutral == pytest.approx(18.961187, rel=1e-3) assert set_obj.percent_hot == pytest.approx(38.6415525, rel=1e-3) assert set_obj.percent_cold == pytest.approx(42.39726, rel=1e-3)
def test_get_standard_effective_temperature_with_sun(): """Test the get_standard_effective_temperature method with sun.""" set_obj = PMV.from_epw(epw, False, True, met_rate=2.4, clo_value=1.0) assert set_obj.percent_neutral == pytest.approx(17.043378, rel=1e-3) assert set_obj.percent_hot == pytest.approx(44.56621, rel=1e-3) assert set_obj.percent_cold == pytest.approx(38.39041, rel=1e-3)
def set_(epw_file, include_wind, include_sun, met_rate, clo_value, csv, output_file): """Get a data collection for Standard Effective Temperature from an EPW weather file. \b Args: epw_file: Path to an .epw file. """ try: epw_obj = EPW(epw_file) pmv_obj = PMV.from_epw(epw_obj, include_wind, include_sun, met_rate, clo_value) set_data = pmv_obj.standard_effective_temperature if csv: output_file.write('\n'.join([str(v) for v in set_data.values])) else: output_file.write(json.dumps(set_data.to_dict())) except Exception as e: _logger.exception('Failed to get SET from EPW file.\n{}'.format(e)) sys.exit(1) else: sys.exit(0)