Esempio n. 1
0
 def __call__(self,X,Y,Z,data,update=True):
     
     if update:
         # The Update the cell index using GridSearch class
         if not self.__dict__.has_key('cellind'):
             GridSearch.__call__(self,X,Y)
         else:
             if np.sum(np.abs(X-self.xpt))>0+1e-8:
                 self.updatexy(X,Y)
                     
    
     # Return the nearest data point (... for now)
     if self.method == 'nearest':
         dataout = data[self.cellind]
     #if self.method == 'linear':
     #    dataout = self.lininterp(X,Y,Z,data,kind)
             
     # Mask bogey points
     dataout[self.cellind==-1]=0.0
             
     return dataout
Esempio n. 2
0
    def __call__(self,X,Y,Z,data,update=True):

        if update:
            # The Update the cell index using GridSearch class
            if 'cellind' not in self.__dict__:
                GridSearch.__call__(self,X,Y)
            else:
                if np.sum(np.abs(X-self.xpt))>0+1e-8:
                    self.updatexy(X,Y)


        # Return the nearest data point (... for now)
        if self.method == 'nearest':
            dataout = data[self.cellind]
        #if self.method == 'linear':
        #    dataout = self.lininterp(X,Y,Z,data,kind)

        # Mask bogey points
        dataout[self.cellind==-1]=0.0

        return dataout
Esempio n. 3
0
    def __call__(self,X,Y,Z,data,update=True):
        
        if update:
            # The Update the cell index using TriSearch class
            if not self.__dict__.has_key('cellind'):
                #print ' Finding initial particle index...'
                GridSearch.__call__(self,X,Y)
            else:
                if np.sum(np.abs(X-self.xpt))>0+1e-8:
                    #print ' updating location index...'
                    self.updatexy(X,Y)
                        
        # Find the k-index
        kind=self.z.searchsorted(Z)
        kind = self.Nkmax - kind 
        
        kind[kind>=self.Nkmax-1] = self.Nkmax-1

        ind = self.maskindex[kind,self.cellind]
        #maskpts = self.mask3d[kind,self.cellind]
        #if np.sum(maskpts==False)>10:
        #    pdb.set_trace()
        #
        #ind[maskpts == False] = 0
        
        # Return the nearest data point (... for now)
        if self.method == 'nearest':
            dataout = data[ind]
        if self.method == 'linear':
            dataout = self.lininterp(X,Y,Z,data,kind)
                
        # Mask bogey points
        #dataout[maskpts==False]=0.0
        dataout[ind==-1]=0 # these are the masked points
        dataout[self.cellind==-1]=0.0
                
        return dataout
Esempio n. 4
0
    def __call__(self,X,Y,Z,data,update=True):

        if update:
            # The Update the cell index using TriSearch class
            if 'cellind' not in self.__dict__:
                #print ' Finding initial particle index...'
                GridSearch.__call__(self,X,Y)
            else:
                if np.sum(np.abs(X-self.xpt))>0+1e-8:
                    #print ' updating location index...'
                    self.updatexy(X,Y)

        # Find the k-index
        kind=self.z.searchsorted(Z)
        kind = self.Nkmax - kind

        kind[kind>=self.Nkmax-1] = self.Nkmax-1

        ind = self.maskindex[kind,self.cellind]
        #maskpts = self.mask3d[kind,self.cellind]
        #if np.sum(maskpts==False)>10:
        #    pdb.set_trace()
        #
        #ind[maskpts == False] = 0

        # Return the nearest data point (... for now)
        if self.method == 'nearest':
            dataout = data[ind]
        if self.method == 'linear':
            dataout = self.lininterp(X,Y,Z,data,kind)

        # Mask bogey points
        #dataout[maskpts==False]=0.0
        dataout[ind==-1]=0 # these are the masked points
        dataout[self.cellind==-1]=0.0

        return dataout