# Limpopo downstream
geometry = { "type": "Point", "coordinates": [33.56529235839844, -24.895779429137615] }
lakes = he.get_lakes(geometry)

len(lakes['features'])

lakes['features'][0]

"""
Explanation: Query lake information for a given catchment determined by a region (searches upstream area)
Alternatively all lakes can be downloaded using hydroengine command-line tool or download_lakes(region, path, id_only) function
Limpopo basin
End of explanation
"""


lake_id = 183160

ts = he.get_lake_time_series(lake_id, 'water_area')

d = pd.DataFrame(ts)

d['time'] = pd.to_datetime(d['time'], unit='ms')

plt.plot(d.time, d.water_area, '.')

# remove empty values, the algorithm should be actually smarter, distinguishing between NODATA and NOT WATER
d = d[d.water_area > 0]

plt.plot(d.time, d.water_area, '-')

lake = he.get_lake_by_id(lake_id)

s = shape(lake['geometry'])
s


lake['properties']

"""
Explanation: Download surface water area time series for a single lake
End of explanation
"""


