import os
from ascat.cgls import SWI_TS
import matplotlib.pyplot as plt
%matplotlib inline

"""
Explanation: Example CGLS SWI time series
End of explanation
"""


ls ../tests/ascat_test_data/cglops/swi_ts

data_path = os.path.join('..', 'tests', 'ascat_test_data', 'cglops', 'swi_ts')
rd = SWI_TS(data_path)

data = rd.read_ts(3002621)
print(data)

"""
Explanation: By default we should have the grid file from the SWI-STATIC collection and the unzipped SWI-TS products in one folder like so:
End of explanation
"""


fig, ax = plt.subplots(1, 1, figsize=(15, 5))
data[['SWI_001', 'SWI_010']].plot(ax=ax)
ax.set_ylabel('Soil Water Index (%)')
plt.show()

"""
Explanation: Since the returned value is a pandas.DataFrame we can plot the data easily.
End of explanation
"""


