Retrieving a Time Series
The Python Code snippet 1 shows how to retrieve a MODIS time series for the location with longitude = -54
and latitude = -12
during the period of 01-01-2001` to ``12-31-2001
for the product MOD13Q1:
1import matplotlib.pyplot as plt
2from wtss import wtss
3
4w = wtss('https://brazildatacube.dpi.inpe.br/')
5
6ts = w.time_series(coverage='MOD13Q1-6', attributes=('red_reflectance', 'NIR_reflectance'),
7 latitude=-12.0, longitude=-54.0,
8 start_date='2001-01-01', end_date='2001-12-31')
9
10fig, ax = plt.subplots()
11
12plt.title('Time Series MOD13Q1', fontsize=24)
13
14plt.xlabel('Date', fontsize=16)
15plt.ylabel('Surface Reflectance', fontsize=16)
16
17ax.plot(ts.timeline, ts.red_reflectance, color='red', ls='-', marker='o', label='red')
18ax.plot(ts.timeline, ts.NIR_reflectance, color='purple', ls='-', marker='o', label='nir')
19
20plt.legend()
21
22plt.grid(b=True, color='gray', linestyle='--', linewidth=0.5);
23
24fig.autofmt_xdate()
25
26plt.show()
The output of the above code snippet is a time series chart as shown in Figure 4: