|
|
|
@ -10,7 +10,8 @@ def pointdata(variables,
|
|
|
|
|
station=None,
|
|
|
|
|
lat=None,
|
|
|
|
|
lon=None,
|
|
|
|
|
units=True):
|
|
|
|
|
units=True,
|
|
|
|
|
output=None):
|
|
|
|
|
"""Request point data from SILO.
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
@ -113,7 +114,8 @@ def pointdata(variables,
|
|
|
|
|
base_url = 'https://siloapi.longpaddock.qld.gov.au/pointdata'
|
|
|
|
|
r = requests.get(base_url, params=params)
|
|
|
|
|
text = r.content.decode()
|
|
|
|
|
df = pd.read_csv(StringIO(text))
|
|
|
|
|
df = pd.read_csv(StringIO(text), parse_dates=['date'])
|
|
|
|
|
df = df.set_index('date')
|
|
|
|
|
|
|
|
|
|
# Add units to columns names
|
|
|
|
|
if units:
|
|
|
|
@ -122,4 +124,8 @@ def pointdata(variables,
|
|
|
|
|
labels[key] = '{}_{}'.format(key, val)
|
|
|
|
|
df = df.rename(columns=labels)
|
|
|
|
|
|
|
|
|
|
# Write to csv
|
|
|
|
|
if output:
|
|
|
|
|
df.to_csv(output)
|
|
|
|
|
|
|
|
|
|
return df
|
|
|
|
|