minor changes in interpolation process

parent 6ffa2c96
......@@ -7,7 +7,7 @@ import seaborn as sns
import matplotlib.pyplot as plt
sns.set()
def smooth_plot (csv,lstBands):
def interpolate_ts (csv,lstBands):
ptrn = os.path.basename(csv)
year = ptrn.split('_')[1]
......@@ -41,6 +41,7 @@ def smooth_plot (csv,lstBands):
dic.setdefault('feat_index',[]).append(index)
if band == lstBands[0] :
dic.setdefault('ID',[]).append(row['ID'])
dic.setdefault('Projet',[]).append(row['Projet'])
dic.setdefault('Biom_f',[]).append(row['Biom_f'])
dic.setdefault('Biom_s',[]).append(row['Biom_s'])
dic.setdefault('Rdt_f',[]).append(row['Rdt_f'])
......@@ -51,6 +52,7 @@ def smooth_plot (csv,lstBands):
ggplot_dic.setdefault('Date',[]).append(idx.strftime("%Y-%m-%d"))
ggplot_dic.setdefault('Band',[]).append(band)
ggplot_dic.setdefault('Plot',[]).append(row['ID'])
ggplot_dic.setdefault('Projet',[]).append(row['Projet'])
# ggplot_dic.setdefault('Crop',[]).append(row['Crop'])
ggplot_dic.setdefault('Sowing',[]).append(row['Sowing'])
ggplot_dic.setdefault('Harvest',[]).append(row['Harvest'])
......@@ -74,19 +76,31 @@ def smooth_plot (csv,lstBands):
if __name__=='__main__':
csv = "./stats/niakhar_2017_opt_gapf_notree.csv"
smooth_plot(csv,["B2","B3","B4","B8","B5","B6","B7","B8A","B11","B12","NDVI","NDWI","EVI","MSAVI2","GDVI","CIGreen","CIRedEdge"])
interpolate_ts(csv,["B2","B3","B4","B8","B5","B6","B7","B8A","B11","B12","NDVI","NDWI","EVI","MSAVI2","GDVI","CIGreen","CIRedEdge"])
csv = "./stats/niakhar_2017_radar_notree.csv"
smooth_plot(csv,["VH","VV"])
interpolate_ts(csv,["VH","VV"])
csv = "./stats/niakhar_2018_opt_gapf_notree.csv"
smooth_plot(csv,["B2","B3","B4","B8","B5","B6","B7","B8A","B11","B12","NDVI","NDWI","EVI","MSAVI2","GDVI","CIGreen","CIRedEdge"])
interpolate_ts(csv,["B2","B3","B4","B8","B5","B6","B7","B8A","B11","B12","NDVI","NDWI","EVI","MSAVI2","GDVI","CIGreen","CIRedEdge"])
csv = "./stats/niakhar_2018_radar_notree.csv"
smooth_plot(csv,["VH","VV"])
interpolate_ts(csv,["VH","VV"])
csv = "./stats/niakhar-serena_2018_opt_gapf_notree.csv"
interpolate_ts(csv,["B2","B3","B4","B8","B5","B6","B7","B8A","B11","B12","NDVI","NDWI","EVI","MSAVI2","GDVI","CIGreen","CIRedEdge"])
csv = "./stats/niakhar-serena_2018_radar_notree.csv"
interpolate_ts(csv,["VH","VV"])
csv = "./stats/niakhar-simco_2018_opt_gapf_notree.csv"
interpolate_ts(csv,["B2","B3","B4","B8","B5","B6","B7","B8A","B11","B12","NDVI","NDWI","EVI","MSAVI2","GDVI","CIGreen","CIRedEdge"])
csv = "./stats/niakhar-simco_2018_radar_notree.csv"
interpolate_ts(csv,["VH","VV"])
csv = "./stats/nioro_2018_opt_gapf_notree.csv"
smooth_plot(csv,["B2","B3","B4","B8","B5","B6","B7","B8A","B11","B12","NDVI","NDWI","EVI","MSAVI2","GDVI","CIGreen","CIRedEdge"])
interpolate_ts(csv,["B2","B3","B4","B8","B5","B6","B7","B8A","B11","B12","NDVI","NDWI","EVI","MSAVI2","GDVI","CIGreen","CIRedEdge"])
csv = "./stats/nioro_2018_radar_notree.csv"
smooth_plot(csv,["VH","VV"])
\ No newline at end of file
interpolate_ts(csv,["VH","VV"])
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -109,21 +109,29 @@ def normalize_time_series (radar_file, opt_file, norm="minmax", radar_bands=["VH
except Exception as error :
print (error)
if __name__ == '__main__' :
# Niakhar 2017
radar_file = "./interpolate/niakhar_2017_radar_notree_interpolate.csv"
opt_file = "./interpolate/niakhar_2017_opt_gapf_notree_interpolate.csv"
normalize_time_series(radar_file,opt_file,norm="minmax")
normalize_time_series(radar_file,opt_file,norm="meanstd")
# Niakhar 2018
radar_file = "./interpolate/niakhar_2018_radar_notree_interpolate.csv"
opt_file = "./interpolate/niakhar_2018_opt_gapf_notree_interpolate.csv"
normalize_time_series(radar_file,opt_file,norm="minmax")
normalize_time_series(radar_file,opt_file,norm="meanstd")
# Niakhar 2018
radar_file = "./interpolate/niakhar-serena_2018_radar_notree_interpolate.csv"
opt_file = "./interpolate/niakhar-serena_2018_opt_gapf_notree_interpolate.csv"
normalize_time_series(radar_file,opt_file,norm="meanstd")
# Niakhar 2018
radar_file = "./interpolate/niakhar-simco_2018_radar_notree_interpolate.csv"
opt_file = "./interpolate/niakhar-simco_2018_opt_gapf_notree_interpolate.csv"
normalize_time_series(radar_file,opt_file,norm="meanstd")
# Nioro 2018
radar_file = "./interpolate/nioro_2018_radar_notree_interpolate.csv"
opt_file = "./interpolate/nioro_2018_opt_gapf_notree_interpolate.csv"
normalize_time_series(radar_file,opt_file,norm="minmax")
\ No newline at end of file
normalize_time_series(radar_file,opt_file,norm="meanstd")
\ No newline at end of file
......@@ -250,10 +250,28 @@ if __name__=="__main__":
outPattern = "niakhar_2018_radar_notree"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern,tree_mask)
############
plots_file = "/media/je/LACIE/SENEGAL/RENDEMENTS/Rdt_Mil_Niakhar-SERENA_2018.shp"
outPattern = "niakhar-serena_2018_radar"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern)
plots_file = "/media/je/LACIE/SENEGAL/RENDEMENTS/Rdt_Mil_Niakhar-SERENA_2018.shp"
outPattern = "niakhar-serena_2018_radar_notree"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern,tree_mask)
plots_file = "/media/je/LACIE/SENEGAL/RENDEMENTS/Rdt_Mil_Niakhar-SIMCO_2018.shp"
outPattern = "niakhar-simco_2018_radar"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern)
plots_file = "/media/je/LACIE/SENEGAL/RENDEMENTS/Rdt_Mil_Niakhar-SIMCO_2018.shp"
outPattern = "niakhar-simco_2018_radar_notree"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern,tree_mask)
#############
# --------
# Optical
# --------
plots_file = "/media/je/LACIE/SENEGAL/RENDEMENTS/Rdt_Mil_Niakhar_2018.shp"
outPattern = "niakhar_2018_opt"
lstTS = ["/media/je/LACIE/SENEGAL/NIAKHAR/SENTINEL-2/2018/OUTPUT/CONCAT_GAPF/B2_NIAKHAR_2018_CONCAT_S2.tif",
"/media/je/LACIE/SENEGAL/NIAKHAR/SENTINEL-2/2018/OUTPUT/CONCAT_GAPF/B3_NIAKHAR_2018_CONCAT_S2.tif",
......@@ -278,10 +296,28 @@ if __name__=="__main__":
outPattern = "niakhar_2018_opt_notree"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern,tree_mask)
############
plots_file = "/media/je/LACIE/SENEGAL/RENDEMENTS/Rdt_Mil_Niakhar-SERENA_2018.shp"
outPattern = "niakhar-serena_2018_opt"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern)
plots_file = "/media/je/LACIE/SENEGAL/RENDEMENTS/Rdt_Mil_Niakhar-SERENA_2018.shp"
outPattern = "niakhar-serena_2018_opt_notree"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern,tree_mask)
plots_file = "/media/je/LACIE/SENEGAL/RENDEMENTS/Rdt_Mil_Niakhar-SIMCO_2018.shp"
outPattern = "niakhar-simco_2018_opt"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern)
plots_file = "/media/je/LACIE/SENEGAL/RENDEMENTS/Rdt_Mil_Niakhar-SIMCO_2018.shp"
outPattern = "niakhar-simco_2018_opt_notree"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern,tree_mask)
#############
# ------------------------
# Optical with gapfilling
# ------------------------
plots_file = "/media/je/LACIE/SENEGAL/RENDEMENTS/Rdt_Mil_Niakhar_2018.shp"
outPattern = "niakhar_2018_opt_gapf"
lstTS = ["/media/je/LACIE/SENEGAL/NIAKHAR/SENTINEL-2/2018/OUTPUT/CONCAT_GAPF/B2_NIAKHAR_2018_CONCAT_S2_GAPF.tif",
"/media/je/LACIE/SENEGAL/NIAKHAR/SENTINEL-2/2018/OUTPUT/CONCAT_GAPF/B3_NIAKHAR_2018_CONCAT_S2_GAPF.tif",
......@@ -306,6 +342,24 @@ if __name__=="__main__":
outPattern = "niakhar_2018_opt_gapf_notree"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern,tree_mask)
############
plots_file = "/media/je/LACIE/SENEGAL/RENDEMENTS/Rdt_Mil_Niakhar-SERENA_2018.shp"
outPattern = "niakhar-serena_2018_opt_gapf"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern)
plots_file = "/media/je/LACIE/SENEGAL/RENDEMENTS/Rdt_Mil_Niakhar-SERENA_2018.shp"
outPattern = "niakhar-serena_2018_opt_gapf_notree"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern,tree_mask)
plots_file = "/media/je/LACIE/SENEGAL/RENDEMENTS/Rdt_Mil_Niakhar-SIMCO_2018.shp"
outPattern = "niakhar-simco_2018_opt_gapf"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern)
plots_file = "/media/je/LACIE/SENEGAL/RENDEMENTS/Rdt_Mil_Niakhar-SIMCO_2018.shp"
outPattern = "niakhar-simco_2018_opt_gapf_notree"
ZonalStats(plots_file,lstTS,dates_file,outPath,outPattern,tree_mask)
#############
# --------
# Nioro
# --------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment