diff --git a/setup.py b/setup.py index e9b74b9..67c0eae 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='smart_fact_crawler', - version='0.6.2', + version='0.6.3', description='acquire data published on the smartfact web page', url='https://github.com/fact-project/smart_fact_crawler.git', author='Dominik Neise, Sebastian Mueller, Maximilian Nöthe', diff --git a/smart_fact_crawler/__init__.py b/smart_fact_crawler/__init__.py index 5b56672..43a43bb 100644 --- a/smart_fact_crawler/__init__.py +++ b/smart_fact_crawler/__init__.py @@ -42,6 +42,7 @@ def smartfact(timeout=None, fallback=False): sqm, sun, weather, + tng_weather, sipm_currents, sipm_voltages, container_temperature, @@ -164,6 +165,27 @@ def weather(url=None, timeout=None, fallback=False): }) +def tng_weather(url=None, timeout=None, fallback=False): + if url is None: + url = os.path.join(smartfacturl, 'tngdata.data') + + table = smartfact2table(url, timeout=timeout) + get = partial(get_entry, fallback=fallback) + + return to_namedtuple('TNGWeather', { + 'timestamp': sft2dt(get(table, 0, 0)), + 'temperature': Quantity(s2f(get(table, 1, 1)), 'deg_C'), + 'delta_temperature_24h': Quantity(s2f(get(table, 2, 1)), 'deg_C'), + 'dew_point': Quantity(s2f(get(table, 3, 1)), 'deg_C'), + 'humidity': Quantity(s2f(get(table, 4, 1)), '%'), + 'pressure': Quantity(s2f(get(table, 5, 1)), 'hPa'), + 'wind_speed': Quantity(s2f(get(table, 6, 1)), 'km/h'), + 'wind_direction': Quantity(s2f(get(table, 7, 1)), 'deg'), + 'dust_total': Quantity(s2f(get(table, 8, 1)), 'ug/m3'), + 'solarimeter': Quantity(s2f(get(table, 9, 1)), 'W/m2'), + }) + + def sipm_currents(url=None, timeout=None, fallback=False): if url is None: url = os.path.join(smartfacturl, 'current.data') diff --git a/smart_fact_crawler/resources/20171019_0336/tngdata.data b/smart_fact_crawler/resources/20171019_0336/tngdata.data new file mode 100644 index 0000000..7364055 --- /dev/null +++ b/smart_fact_crawler/resources/20171019_0336/tngdata.data @@ -0,0 +1,10 @@ +1508384189000 +#ffffff 18.3 +#ffffff 1.04 +#ffffff -10.7 +#ffffff 13 +#ffffff 774 +#ffffff 6.44 +#ffffff 300 +#ffffff 7.34 +#ffffff 1.15e+03