Esempio n. 1
0
    def __init__(self, ncfile, **kwargs):
        """
        Initialise the suntides class 
        
        See sunpy.Spatial class for list of kwargs
        """

        self.__dict__.update(kwargs)

        Spatial.__init__(self, ncfile, **kwargs)

        if self.hasVar("uc_amp"):  # This check needs to be made more robust...
            print "Loading existing harmonic data..."
            self._loadVars()

        else:
            # Get the tidal fruequencies
            if self.frqnames == None:
                # This returns the default frequencies from the uspectra class
                self.frq, self.frqnames = uspectra.getTideFreq(Fin=None)
            else:
                self.frq, self.frqnames = uspectra.getTideFreq(Fin=self.frqnames)

            self.Ntide = len(self.frqnames)

            self.reftime = datetime(self.baseyear, 1, 1)

            self.Nt = len(self.time)
Esempio n. 2
0
    def __init__(self,ncfile,**kwargs):
        Spatial.__init__(self,ncfile,gridvars=untrim_gridvars,griddims=untrim_griddims,**kwargs)

        # Make sure the number of faces array is correct
        self.nfaces = np.sum(self.cells.mask==False,axis=1)

        self.xy = self.cellxy()
Esempio n. 3
0
    def __init__(self,ncfile,**kwargs):
        """
        Initialise the suntides class

        See sunpy.Spatial class for list of kwargs
        """

        self.__dict__.update(kwargs)

        Spatial.__init__(self,ncfile,**kwargs)

        if self.hasVar('uc_amp'): # This check needs to be made more robust...
            print('Loading existing harmonic data...')
            self._loadVars()

        else:
            # Get the tidal fruequencies
            if self.frqnames == None:
                        # This returns the default frequencies from the uspectra class
                self.frq,self.frqnames = uspectra.getTideFreq(Fin=None)
            else:
                self.frq,self.frqnames = uspectra.getTideFreq(Fin=self.frqnames)

            self.Ntide = len(self.frqnames)

            self.reftime = datetime(self.baseyear,1,1)

            self.Nt = len(self.time)
Esempio n. 4
0
    def __init__(self, ncfile, **kwargs):
        Spatial.__init__(self,
                         ncfile,
                         gridvars=untrim_gridvars,
                         griddims=untrim_griddims,
                         **kwargs)

        # Make sure the number of faces array is correct
        self.nfaces = np.sum(self.cells.mask == False, axis=1)

        self.xy = self.cellxy()
Esempio n. 5
0
    def on_open_file(self, event):
        file_choices = "SUNTANS NetCDF (*.nc)|*.nc*|UnTRIM NetCDF (*.nc)|*.nc*|All Files (*.*)|*.*"

        dlg = wx.FileDialog(self,
                            message="Open SUNTANS file...",
                            defaultDir=os.getcwd(),
                            defaultFile="",
                            wildcard=file_choices,
                            style=wx.FD_MULTIPLE)

        if dlg.ShowModal() == wx.ID_OK:
            self.plot_type = 'hydro'

            path = dlg.GetPaths()

            # Initialise the class
            if dlg.GetFilterIndex() == 0 or dlg.GetFilterIndex() > 1:  #SUNTANS
                self.flash_status_message("Opening SUNTANS file: %s" % path)
                try:
                    Spatial.__init__(self, path, _FillValue=self._FillValue)
                except:
                    Spatial.__init__(self, path, _FillValue=-999999)
                startvar = 'dv'
            if dlg.GetFilterIndex() == 1:  #UnTRIM
                self.flash_status_message("Opening UnTRIMS file: %s" % path)
                #Spatial.__init__(self,path,gridvars=untrim_gridvars,griddims=untrim_griddims)
                UNTRIMSpatial.__init__(self, path)
                startvar = 'Mesh2_face_depth'

            # Populate the drop down menus
            vnames = self.listCoordVars()
            self.variable_list.SetItems(vnames)

            # Update the time drop down list
            if 'time' in self.__dict__:
                self.timestr = [
                    datetime.strftime(tt, '%d-%b-%Y %H:%M:%S')
                    for tt in self.time
                ]
            else:
                # Assume that it is a harmonic-type file
                self.timestr = self.nc.Constituent_Names.split()

            self.time_list.SetItems(self.timestr)

            # Draw the depth
            if startvar in vnames:
                self.variable = startvar
                self.loadData()
                self.create_figure()
Esempio n. 6
0
    def on_open_file(self, event):
        file_choices = "SUNTANS NetCDF (*.nc)|*.nc*|UnTRIM NetCDF (*.nc)|*.nc*|All Files (*.*)|*.*"
        
        dlg = wx.FileDialog(
            self, 
            message="Open SUNTANS file...",
            defaultDir=os.getcwd(),
            defaultFile="",
            wildcard=file_choices,
            style= wx.FD_MULTIPLE)
        
        if dlg.ShowModal() == wx.ID_OK:
            self.plot_type='hydro'

            path = dlg.GetPaths()

            # Initialise the class
            if dlg.GetFilterIndex() == 0 or dlg.GetFilterIndex() > 1: #SUNTANS
                self.flash_status_message("Opening SUNTANS file: %s" % path)
		try:
		    Spatial.__init__(self, path, _FillValue=self._FillValue)
		except:
		    Spatial.__init__(self, path, _FillValue=-999999)
                startvar='dv'
            if dlg.GetFilterIndex()==1: #UnTRIM
                self.flash_status_message("Opening UnTRIMS file: %s" % path)
                #Spatial.__init__(self,path,gridvars=untrim_gridvars,griddims=untrim_griddims)
                UNTRIMSpatial.__init__(self,path)
                startvar='Mesh2_face_depth'
            
            # Populate the drop down menus
            vnames = self.listCoordVars()
            self.variable_list.SetItems(vnames)
            
            # Update the time drop down list
            if self.__dict__.has_key('time'):
                self.timestr = [datetime.strftime(tt,'%d-%b-%Y %H:%M:%S') for tt in self.time]
            else:
                # Assume that it is a harmonic-type file
                self.timestr = self.nc.Constituent_Names.split()

            self.time_list.SetItems(self.timestr)

            # Draw the depth
            if startvar in vnames:
                self.variable=startvar
                self.loadData()
                self.create_figure()