it's a little complicated but I will try
I have a panel or a button 'file' for the choice of a file and the opening of this file is a .nc file (netCDF4) so I would like to visualize it but the problem I would like to see it in one other panel which will be like a quicklook, and each time you have to choose a file of type .nc or directly to be visualized on the other panel
and here is part of my code for 2 panels:
class LeftPanelTop(wx.Panel): # panel choose file
def __init__(self, parent):
super().__init__(parent,style = wx.SUNKEN_BORDER)
self.SetBackgroundColour('snow2')
List_choices = ["1Km","3Km"]
List2 = ["3X3","5X5","7X7"]
self.dateLbl = wx.StaticBox(self, -1, 'Outils ', size=(310, 320))
self.dategraphSizer = wx.StaticBoxSizer(self.dateLbl, wx.VERTICAL)
combobox1 = wx.ComboBox(self,choices = List_choices, size =(80,20),pos =(180,50))
combobox2 = wx.ComboBox(self,choices = List2, size =(80,20),pos =(180,90))
wx.StaticText(self, label='Referen:', pos=(70, 50))
wx.StaticText(self, label='pixel:', pos=(70, 90))
QuickLook = wx.Button(self ,-1, "Open file" , size =(80, 25),pos =(180,130))
wx.StaticText(self, label='QuickLook:', pos=(70, 130))
QuickLook.Bind(wx.EVT_BUTTON, self.onOpen)
def onOpen(self, event):
wildcard = "netCDF4 files (*.nc)|*.nc"
dialog = wx.FileDialog(self, "Open netCDF4 Files| HDF5 files", wildcard=wildcard,
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
if dialog.ShowModal() == wx.ID_CANCEL:
return
path = dialog.GetPath()
# panel for visualization
class LeftPanelBottom(wx.Panel):
def __init__(self, parent):
super().__init__(parent,style = wx.SUNKEN_BORDER)
self.SetBackgroundColour('whitesmoke')
self.dateLbl = wx.StaticBox(self, -1, 'QuickLook', size=(310, 600))
that it code for read and view netcdf4 in python3.6:
import numpy as np
import netCDF4
import matplotlib.pyplot as plt
#read the netcdf
fic='g_xvxvxvxv_20190108T120000Z.nc'
path='/home/globe/2019/01/08/'
nc = netCDF4.Dataset(path+fic,'r')
#read one variable in netcfd file
cm=nc.variables['cm'][:]
#visualization
plt.pcolormesh(cm)
plt.colorbar()
plt.show()
that what i would see in panel2 like quicklook:
[![enter image description here][1]][1]
what i would like to do is use my code to read the .nc in my code and that my users can just choose a file and then display automatically on the other panel2 :
[![enter image description here][2]][2]
maybe is like this example : How to use matplotlib blitting to add matplot.patches to an matplotlib plot in wxPython?
thank you for the help