Exemple #1
0
    def dxdy(self,
             method='SG',
             deg=3,
             win=5,
             doEdges=True,
             fs_tap=5,
             **kwargs):
        '''Calculate second horizontal derivative with various methods.
        '''
        if method.upper() == 'SG':
            output = transforms.savgol_deriv(self.data,
                                             self.cellsize,
                                             direction='dxdy',
                                             deg=deg,
                                             win=win,
                                             doEdges=doEdges)

        elif method.upper() == 'FS':
            output = transforms.fs_deriv(self.data,
                                         self.cellsize,
                                         direction='dxdy',
                                         tap=fs_tap)

        elif method.lower() == 'fourier':
            output = transforms.fourier_transform(self.data,
                                                  self.cellsize,
                                                  trans='dxdy',
                                                  **kwargs)
        else:
            raise ValueError(
                'Method {} has not been recognised.'.format(method))

        return Grid(output, self.transform, name=self.name + '_dxdy')
Exemple #2
0
    def hgm(self, method='SG', deg=3, win=5, doEdges=True, fs_tap=5, **kwargs):
        '''Calculate the horizontal gradient magnitude with various methods.
        '''
        if method.upper() == 'SG':
            dx1 = transforms.savgol_deriv(self.data,
                                          self.cellsize,
                                          direction='dx',
                                          deg=deg,
                                          win=win,
                                          doEdges=doEdges)
            dy1 = transforms.savgol_deriv(self.data,
                                          self.cellsize,
                                          direction='dy',
                                          deg=deg,
                                          win=win,
                                          doEdges=doEdges)

        elif method.upper() == 'FS':
            dx1 = transforms.fs_deriv(self.data,
                                      self.cellsize,
                                      direction='dx',
                                      tap=fs_tap)
            dy1 = transforms.fs_deriv(self.data,
                                      self.cellsize,
                                      direction='dy',
                                      tap=fs_tap)

        elif method.lower() == 'fourier':
            dx1 = transforms.fourier_transform(self.data,
                                               self.cellsize,
                                               trans='dx',
                                               order=1,
                                               **kwargs)
            dy1 = transforms.fourier_transform(self.data,
                                               self.cellsize,
                                               trans='dy',
                                               order=1,
                                               **kwargs)
        else:
            raise ValueError(
                'Method {} has not been recognised.'.format(method))

        return Grid(np.sqrt(dx1 * dx1 + dy1 * dy1),
                    self.transform,
                    name=self.name + '_hgm')
Exemple #3
0
    def lw(self,
           method='SG',
           dz_method='isvd',
           deg=4,
           win=5,
           doEdges=True,
           fs_tap=5,
           **kwargs):
        '''Calculate the local wavenumber with various methods.
        '''
        # vertical derivative
        if dz_method.lower() == 'isvd':
            dz_grid = self.isvd(method=method,
                                order=1,
                                deg=deg,
                                win=win,
                                doEdges=doEdges,
                                fs_tap=fs_tap)
            dzdz_grid = self.isvd(method=method,
                                  order=2,
                                  deg=deg,
                                  win=win,
                                  doEdges=doEdges,
                                  fs_tap=fs_tap)
        else:
            dz_grid = self.dz(method='fourier', order=1)
            dzdz_grid = self.dz(method='fourier', order=2)

        # horizontal derivatives
        if method.upper() == 'SG':
            dx1 = transforms.savgol_deriv(self.data,
                                          self.cellsize,
                                          direction='dx',
                                          deg=deg,
                                          win=win,
                                          doEdges=doEdges)
            dy1 = transforms.savgol_deriv(self.data,
                                          self.cellsize,
                                          direction='dy',
                                          deg=deg,
                                          win=win,
                                          doEdges=doEdges)
            dxdz1 = transforms.savgol_deriv(dz_grid.data,
                                            self.cellsize,
                                            direction='dx',
                                            deg=deg,
                                            win=win,
                                            doEdges=doEdges)
            dydz1 = transforms.savgol_deriv(dz_grid.data,
                                            self.cellsize,
                                            direction='dy',
                                            deg=deg,
                                            win=win,
                                            doEdges=doEdges)
        elif method.upper() == 'FS':
            dx1 = transforms.fs_deriv(self.data,
                                      self.cellsize,
                                      direction='dx',
                                      tap=fs_tap)
            dy1 = transforms.fs_deriv(self.data,
                                      self.cellsize,
                                      direction='dy',
                                      tap=fs_tap)
            dxdz1 = transforms.fs_deriv(dz_grid.data,
                                        self.cellsize,
                                        direction='dx',
                                        tap=fs_tap)
            dydz1 = transforms.fs_deriv(dz_grid.data,
                                        self.cellsize,
                                        direction='dy',
                                        tap=fs_tap)

        elif method.lower() == 'fourier':
            dx1 = transforms.fourier_transform(self.data,
                                               self.cellsize,
                                               trans='dx',
                                               order=1,
                                               **kwargs)
            dy1 = transforms.fourier_transform(self.data,
                                               self.cellsize,
                                               trans='dy',
                                               order=1,
                                               **kwargs)
            dxdz1 = transforms.fourier_transform(dz_grid.data,
                                                 self.cellsize,
                                                 trans='dx',
                                                 order=1,
                                                 **kwargs)
            dydz1 = transforms.fourier_transform(dz_grid.data,
                                                 self.cellsize,
                                                 trans='dy',
                                                 order=1,
                                                 **kwargs)

        else:
            raise ValueError(
                'Method {} has not been recognised.'.format(method))

        # calculate local wavenumber
        output = ((dxdz1 * dx1 + dydz1 * dy1 + dzdz_grid.data * dz_grid.data) /
                  (dx1 * dx1 + dy1 * dy1 + dz_grid.data * dz_grid.data))

        return Grid(output, self.transform, name=self.name + '_LW')