Skip to content
Snippets Groups Projects
Commit 2570349e authored by pascal.mouquet_ird.fr's avatar pascal.mouquet_ird.fr
Browse files

timeseries new figure

parent 40c126fc
No related branches found
No related tags found
No related merge requests found
...@@ -254,7 +254,7 @@ class TimeSeries: ...@@ -254,7 +254,7 @@ class TimeSeries:
self._date_max) self._date_max)
df = self.data[df_name] df = self.data[df_name]
plt.figure(figsize=(19.2,10.8)) plt.figure(figsize=(19.2,10.8))
if df_name in ['NDVI', 'NDWIGAO', 'NDVIMCF', 'MNDWI']: if df_name in ['NDVI', 'NDWIGAO', 'NDWIMCF', 'MNDWI']:
plt.ylim((-10000,10000)) plt.ylim((-10000,10000))
else: else:
plt.ylim((0,10000)) plt.ylim((0,10000))
...@@ -279,8 +279,13 @@ class TimeSeries: ...@@ -279,8 +279,13 @@ class TimeSeries:
df_name, df_name,
self._date_min, self._date_min,
self._date_max) self._date_max)
png_path_nonan = out_path_folder / "{0}_plot-details-nonan_{1}_{2}_{3}.png".format(
self._vectors_file.stem,
df_name,
self._date_min,
self._date_max)
if df_name in ['NDVI', 'NDWIGAO', 'NDWMCF', 'MNDWI']: if df_name in ['NDVI', 'NDWIGAO', 'NDWIMCF', 'MNDWI']:
ylim = [-10000, 10000] ylim = [-10000, 10000]
else: else:
ylim = [0, 10000] ylim = [0, 10000]
...@@ -305,10 +310,24 @@ class TimeSeries: ...@@ -305,10 +310,24 @@ class TimeSeries:
ax.legend(loc=0, labelspacing=0.05) ax.legend(loc=0, labelspacing=0.05)
fig.tight_layout() fig.tight_layout()
fig.suptitle(df_name, fontsize=16) fig.suptitle(df_name, fontsize=16)
plt.savefig(str(png_path)) plt.savefig(str(png_path))
plt.close() plt.close()
logger.info("Plot saved to png: {}".format(png_path)) logger.info("Plot saved to png: {}".format(png_path))
fig, axs = plt.subplots(nrows, ncols, figsize=(19.2,10.8))
for (name, dfe), ax in zip(grouped, axs.flat):
ax.set_ylim(ylim)
ax.set_title(name)
dfe = dfe.dropna(subset = ['mean'])
dfe = dfe[(dfe[['nodata']] == 0).all(axis=1)]
dfe.plot(y=['mean'], ax=ax, yerr='std', color='black', elinewidth=0.2, legend=False)
dfe.plot(y=['min', 'max'], ax=ax, linewidth=0.25, color='black', legend=False)
ax.legend(loc=0, labelspacing=0.05)
fig.tight_layout()
fig.suptitle(df_name, fontsize=16)
plt.savefig(str(png_path_nonan))
plt.close()
logger.info("Plot saved to png: {}".format(png_path_nonan))
def extract_ql(self, out_path: Union[str, pathlib.PosixPath] = None) -> None: def extract_ql(self, out_path: Union[str, pathlib.PosixPath] = None) -> None:
...@@ -331,7 +350,7 @@ class TimeSeries: ...@@ -331,7 +350,7 @@ class TimeSeries:
'BIRNIR' : 'afmhot', 'BIRNIR' : 'afmhot',
'BIBG' : 'bone', 'BIBG' : 'bone',
'MNDWI' : 'BrBG'} 'MNDWI' : 'BrBG'}
if df_name in ['NDVI', 'NDWIGAO', 'NDWMCF', 'MNDWI']: if df_name in ['NDVI', 'NDWIGAO', 'NDWIMCF', 'MNDWI']:
vmin = -10000 vmin = -10000
vmax = 10000 vmax = 10000
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment