示例#1
0
    def otis2boundary(self,otisfile,conlist=None,setUV=False):
        """
        Interpolates the OTIS tidal data onto all type-3 boundary cells
        
        Note that the values are added to the existing arrays (h, uc, vc)
        """
        
        if self.N3>0:
            print 'Interolating otis onto type 3 bc''s...'
            xy = np.vstack((self.xv,self.yv)).T
            ll = utm2ll(xy,self.utmzone,north=self.isnorth)
            
            if self.__dict__.has_key('dv'):
                z=self.dv
            else:
                print 'Using OTIS depths to calculate velocity. Use setDepth()\
                to set this.'
                z=None
                
            h,U,V = readotps.tide_pred(otisfile,ll[:,0],ll[:,1],np.array(self.time),z=z,conlist=conlist)
            
            # Update the arrays - note that the values are added to the existing arrays
            self.h += h
            if setUV:
                for k in range(self.Nk):
                    self.uc[:,k,:] += U
                    self.vc[:,k,:] += V

        if self.N2>0:
            print 'Interolating otis onto type 2 bc''s...'
            xy = np.hstack((self.xe,self.ye))
            ll = utm2ll(xy,self.utmzone,north=self.isnorth)
            
            if self.__dict__.has_key('de'):
                z=self.de
            else:
                print 'Using OTIS depths to calculate velocity. Use setDepth()\
                to set this .'
                z=None
                
            h,U,V = readotps.tide_pred(otisfile,ll[:,0],ll[:,1],np.array(self.time),z=z,conlist=conlist)
            
            # Update the arrays - note that the values are added to the existing arrays
            for k in range(self.Nk):
                self.boundary_u[:,k,:] += U
                self.boundary_v[:,k,:] += V

            
        print 'Finished interpolating OTIS tidal data onto boundary arrays.'
示例#2
0
    def otisfile2boundary(self,otisfile,dbfile,stationID,setUV=False,conlist=None):
        """
        Interpolates the OTIS tidal data onto all type-3 boundary cells
        
        Note that the values are added to the existing arrays (h, uc, vc)

	Applies an amplitude and phase correction based on a time series. 
	Also adds the residual (low-frequency) water level variability.
        """
        
        xy = np.vstack((self.xv.ravel(),self.yv.ravel())).T
        ll = utm2ll(xy,self.utmzone,north=self.isnorth)
        
        if self.__dict__.has_key('dv'):
            z=self.dv
        else:
            print 'Using OTIS depths to calculate velocity. Set self.dv to change this.'
            z=None
            
        h,U,V,residual = readotps.tide_pred_correc(otisfile,ll[:,0],ll[:,1],np.array(self.time),dbfile,stationID,z=z,conlist=conlist)

        # Update the arrays - note that the values are added to the existing arrays
        self.h += h
        # Add the residual
        for ii in range(self.N3):
            self.h[:,ii] += residual

        if setUV:
            for k in range(self.Nk):
                self.uc[:,k,:] += U
                self.vc[:,k,:] += V

        print 'Finished interpolating OTIS tidal data onto boundary arrays.'