Skip to content

Commit

Permalink
Merge pull request #40 from fact-project/add_tng
Browse files Browse the repository at this point in the history
Add tng weather
  • Loading branch information
maxnoe authored Jul 8, 2019
2 parents e5aafa3 + be55c84 commit 1305079
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
22 changes: 22 additions & 0 deletions smart_fact_crawler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def smartfact(timeout=None, fallback=False):
sqm,
sun,
weather,
tng_weather,
sipm_currents,
sipm_voltages,
container_temperature,
Expand Down Expand Up @@ -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')
Expand Down
10 changes: 10 additions & 0 deletions smart_fact_crawler/resources/20171019_0336/tngdata.data
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1305079

Please sign in to comment.