1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
| #fenetre principale
fenetre7=Tkinter.Tk()
fenetre7.geometry('270x170+0+0')
frame7=Tkinter.LabelFrame(fenetre7,text='Informations générales sur le fichier')
frame7.pack(fill='both',expand='yes')
Tkinter.Label(frame7,text='ADCP: '+str(typeADCP)).grid(row=0,column=0)
Tkinter.Label(frame7,text='Projet: '+str(projet)).grid(row=0,column=1)
Tkinter.Label(frame7,text='Logiciel utilisé: '+str(typelogiciel)).grid(row=1,column=0)
Tkinter.Label(frame7,text='On travaille depuis la '+str(typetravail)).grid(row=2,column=0)
Tkinter.Label(frame7,text='Date: '+str(date[0][0])).grid(row=1,column=1)
Tkinter.Label(frame7,text='Offset de: '+str(val_off)).grid(row=3,column=0)
Tkinter.Label(frame7,text='Flagg de: '+str(val_flagg)).grid(row=4,column=0)
F8(amp_moy_bt,time,binDepth,BT,spd_flagg,vDir_flagg,lon,lat,lon2,lat2,plan,amp_moy_brut,
spd_brut,vDir_brut,typeADCP,projet,typelogiciel,typetravail,date,val_off,
val_flagg,cell_size[0,0,0])
Boutons.boutonSAVE(fenetre7)
Boutons.boutonOK(fenetre7)
fenetre7.wm_attributes("-topmost", 1)
fenetre7.mainloop()
#fenetre Toplevel
def F8(amp_moy_bt,time,binDepth,BT,spd,vDir,lon,lat,lon2,lat2,plan,amp_moy_brut,spd_brut,vDir_brut,
typeADCP,projet,typelogiciel,typetravail,date,val_off,val_flagg,cell_size):
# affichage donnees brutes
fenetre8=Tkinter.Toplevel()
fenetre8.wm_title('Affichage final du fichier: '+str(plan))
fenetre8.geometry('900x650+300+0')
fig1=plt.Figure(figsize=(6,4.5))
fig1.subplots_adjust(hspace=0.2,wspace=0.05,top=1,bottom=0.1,left=0.1,right=1)
ax11=fig1.add_subplot(311)
ax12=fig1.add_subplot(312)
ax13=fig1.add_subplot(313)
prof=list(-binDepth[plan,:,0])
prof.append(prof[-1]-cell_size)
a1=ax11.pcolormesh(time,prof,amp_moy_brut[plan])
ax11.set_ylabel('Profondeur (en m)')
ax11.plot(time,-BT[plan,0,:],'.',color='k',linewidth=5)
fig1.colorbar(a1,ax=ax11)
b1=ax12.pcolormesh(time,prof,spd_brut[plan])
ax12.set_ylabel('Profondeur (en m)')
ax12.plot(time,-BT[plan,0,:],'.',color='k',linewidth=5)
fig1.colorbar(b1,ax=ax12)
c1=ax13.pcolormesh(time,prof,vDir_brut[plan])
ax13.set_ylabel('Profondeur (en m)')
ax13.plot(time,-BT[plan,0,:],'.',color='k',linewidth=5)
fig1.colorbar(c1,ax=ax13)
graph1=FigureCanvasTkAgg(fig1,master=fenetre8)
canvas1=graph1.get_tk_widget()
canvas1.grid(row=0,column=0)
# affichage donnees nettoyees
fig2=plt.Figure(figsize=(6,4.5))
fig2.subplots_adjust(hspace=0.2,wspace=0.05,top=1,bottom=0.1,left=0.1,right=1)
ax21=fig2.add_subplot(311)
ax22=fig2.add_subplot(312)
ax23=fig2.add_subplot(313)
a2=ax21.pcolormesh(time,prof,amp_moy_bt[plan])
ax21.plot(time,-BT[plan,0,:],'.',color='k',linewidth=5)
bar21=fig2.colorbar(a2,ax=ax21)
bar21.ax.set_ylabel('amplitude (en count)',rotation=-90)
b2=ax22.pcolormesh(time,prof,spd[plan])
ax22.plot(time,-BT[plan,0,:],'.',color='k',linewidth=5)
bar22=fig2.colorbar(b2,ax=ax22)
bar22.ax.set_ylabel('spd (en m/s)',rotation=-90)
c2=ax23.pcolormesh(time,prof,vDir[plan])
ax23.plot(time,-BT[plan,0,:],'.',color='k',linewidth=5)
bar23=fig2.colorbar(c2,ax=ax23)
bar23.ax.set_ylabel('Direction (en degre)',rotation=-90)
graph2=FigureCanvasTkAgg(fig2,master=fenetre8)
canvas2=graph2.get_tk_widget()
canvas2.grid(row=0,column=1)
# affichage trace gps
fig3=plt.Figure(figsize=(6,4.5))
fig3.subplots_adjust(top=1,bottom=0.1,left=0.1,right=1)
import mapsplot
import pandas
lat_len=len(lat[plan,0])
pas=lat_len/140
d={'latitude':list(lat[plan][0][0:lat_len:pas]),'longitude':list(lon[plan][0][0:lat_len:pas]),
'colors':['red' for x in range(0,lat_len,pas)],
'size':['tiny' for y in range(0,lat_len,pas)]}
df=pandas.DataFrame(data=d)
mapsplot.register_api_key('AIzaSyD6fp8YjMPQCQ-umDq7WY5ABhc0wtrntCg')
mapsplot.plot_markers(df,maptype='hybrid')
img=plt.imread('img_gps.png')
ax31=fig3.add_subplot(111)
ax31.imshow(img,aspect='auto',extent=(min(lon[plan,0]),max(lon[plan,0]),min(lat[plan,0]),max(lat[plan,0])),zorder=-1)
ax31.set_xlim(min(lon[plan,0]),max(lon[plan,0]))
ax31.set_ylim(min(lat[plan,0]),max(lat[plan,0]))
graph3=FigureCanvasTkAgg(fig3,master=fenetre8)
canvas3=graph3.get_tk_widget()
canvas3.grid(row=1,column=0)
# affichage informations generales
frame4=Tkinter.LabelFrame(fenetre8,text='Informations generales',height=100,width=300)
Tkinter.Label(frame4,text='ADCP: '+str(typeADCP)).grid(row=0,column=0)
Tkinter.Label(frame4,text='Projet: '+str(projet)).grid(row=0,column=1)
Tkinter.Label(frame4,text='Logiciel utilisé: '+str(typelogiciel)).grid(row=1,column=0)
Tkinter.Label(frame4,text='On travaille depuis la '+str(typetravail)).grid(row=2,column=0)
Tkinter.Label(frame4,text='Date: '+str(date[0][0])).grid(row=1,column=1)
Tkinter.Label(frame4,text='Offset de: '+str(val_off)).grid(row=3,column=0)
Tkinter.Label(frame4,text='Flagg de: '+str(val_flagg)).grid(row=4,column=0)
frame4.grid_propagate(0)
frame4.grid(row=1,column=1)
from PIL import ImageGrab
def boutonSAVE(fenetre):
def enregistrer():
ImageGrab.grab((x,y,x1,y1)).save(str(projet)+'_figure_finale.png')
return Tkinter.Button(fenetre,text='Enregistrer',command=enregistrer).pack(side='left',padx=5,pady=5) |
Partager