MAGMAP Filtering

Use the 2D Filtering > MAGMAP Filtering option (geogxnet.dll(Geosoft.GX.FFT2D.MAGMAPFiltering;Run)*) to apply common Fourier domain filters to gridded data.

MAGMAP Filtering dialog options

Input grid(s)

Select the input (original) grid file. You can import multiple grid files by clicking on the browse [...] button and holding the control key down while selecting the files. Alternatively supply the file names, separated by the "|" character.

Script Parameter: MAGMAP1.INGRD

Output grid

Specify the name of the output (processed) grid file.

Script Parameter: MAGMAP1.OUTGRD

Multiple grid selection

Output directory

Use the browse [...] button to select the destination folder. The default is your current project directory.

Script Parameter: MAGMAP1.DIRECTORY

Output grid prefix

Specify a grid name prefix to be added to every generated grid.

Script Parameter: MAGMAP1.PREFIX

Output grid suffix

Specify a grid name suffix to be added to every generated grid.

Script Parameter: MAGMAP1.SUFFIX

At least one of prefix or suffix must be set, or the output directory must be different than the input grid directory. Otherwise, the default behavior (input grid name == output grid name, in the same directory) produces an error message.

Filter file

Specify the name of the filter control file. This can be a new or existing file.

  • The filter button will switch between [Create Filter] and [Edit Filter] based on the filter file input (new or existing file).
  • Script Parameter: MAGMAP1.CONFIL

    Display option

    Specify how the generated grids should be displayed: 

    • Use the option "Display in grid windows" if you want the generated grids to be displayed in the current project workspace in individual grid windows. This is the default behavior for a single grid file selection.

    • If the option "Do not display" is selected, the output grids will be added to the current project and listed in Project Explorer, but they will not be opened in the project workspace. This is the default behavior for a multi-file selection.
      The option overrides the Advanced Settings parameter "Image Settings > Display Created Grids" when its value is set to "True".
    • The option "Current map" will be available only when there is a current map opened.

    Script Parameter: MAGMAP1.DISPLAY_OPTION [C :Current map; D: Display in grid windows; X: Do not display]

    [Create/Edit Filter]

    Click this button to interactively build the filter file.

    More

    Automatic defaults are applied during the pre-processing stage. Should you prefer to inspect and customize the pre-processing parameters, click on this button. You will then be able to modify the trend, expansion and fill parameters.

    Trend

    Trend type

    Select the order of trend to remove.

    The options are:

    • Remove mean

    • First order (default)

    • Second order

    • Third order

  • You can remove up to a third order trend surface from a grid. For more details, see the Pre-Processing section under Application Notes below.
  • Script Parameter: MAGMAP1.TORDER

    Base on

    Select which grid points to use when calculating the trend surface to remove.

    The options are:

    • Edge points (default) - only the edge points along the valid edge of the grid are used.

    • All points - all the valid points in the grid are used.

  • Using the edge points to calculate the trend surface to remove is often preferable, especially if there are any large amplitude anomalies within the grid.
  • Script Parameter: MAGMAP1.TBASE

    Expansion

    % expansion

    The input grid must be expanded to allow adequate space for ensuring continuity across opposite edges of the input grid.

    Specify the grid expansion as a percentage of the average grid coverage. By default, the grid is expanded by a minimum of 10%. See the Pre-Processing section under Application Notes for more details.

    Script Parameter: MAGMAP1.PEX

    Expansion type

    Select the type of grid expansion:

    • Square (default)

    • Rectangular

  • The square expansion is recommended because it minimizes side-effects that result from having different wave number samples in the X and Y directions. Use rectangular expansion only for very large grids to save significant processing time and disk space.
  • Script Parameter: MAGMAP1.TEX

    Fill

    Grid fill method

    Select the grid fill method: 

    • Multi-trend expansion

    • Maximum entropy (default)

    • Inverse distance

    The FFT (Fast Fourier Domain) routines require a completely filled grid which is periodic at its edges: all dummy areas will be extrapolated using the real data that is located in their immediate vicinity. See the Pre-Processing section under Application Notes for more details.

    Script Parameter: MAGMAP1.FILL

    Roll off to zero (cells)

    Specify the number of cells beyond the valid area at which to roll-off to zero.

    Script Parameter: MAGMAP1.ZDIST

    Amplitude limit

    Specify an amplitude limit.

    High amplitude anomalies can cause problems in filtering systems such as MAGMAP Filtering. With this option, anomalies that exceed half the specified limit are smoothly attenuated. The attenuation is started at half the limit with no values allowed to exceed the limit. This option should only be used on trend-removed grids.

    Script Parameter: MAGMAP1.ALIM

    Edge amplitude limit

    Specify an edge amplitude limit.

    High amplitude anomalies on the edges of the valid area can produce oscillations in the extrapolated areas. With this option, a limit may be placed on anomalies along the edges of the grid.

    Script Parameter: MAGMAP1.ELIM

    [Display]

    Click this button if you would like to inspect the interim files prior to proceeding with filtering.
    After inspecting the interim files, if you invoke MAGMAP Filtering again, it will proceed with the latest interim files.

    Application Notes

    *The GX tool will search in the "...\Geosoft\Desktop Applications \gx" folder. The GX.Net tools, however, are embedded in the geogxnet.dll located in the "...\Geosoft\Desktop Applications \bin" folder. If running this GX interactively, bypassing the menu, first change the folder to point to the "bin" folder, then supply the GX.Net tool in the specified format.

    1. Overview

    Fourier Domain filtering (often referred to as FFT Filtering) provided by MAGMAP Filtering enables the following kinds of processes to be applied to 2-D gridded data:

    Potential Field Filters
    General Purpose Filters

    This is not a comprehensive list. For more filters, see the links at the bottom of this document.

    2. MAGMAP Processing System

    For the sake of mathematical convenience and speed, MAGMAP Filtering applies filters in the wavenumber or Fourier domain. This requires several steps:

    1. Pre-processing: the original space domain grid is trend removed, expanded and filled. The fill routine maintains data continuity on opposite edges of the grid.
    2. Transformation: the space domain data is transformed to Fourier domain.
    3. Filtering: filter operators are applied.
    4. Inverse transformation: the filtered data is transformed back to space domain.
    5. Post-processing: the filtered grid is masked to the same footprint as the original grid; the regional trend is replaced.

    Following are descriptions of each of the processing steps.

    Pre-processing (creates _prp.grd)
    1. The background trend is removed from the gridded data. The trend can be a DC shift (0th order), a linear trend (1st order) or a very long regional trend emulated with the 2nd or 3rd order trend. This step reduces the potential of introducing high power long wavelength into the data through the process of filling the grid while maintaining periodicity. If the background is around zero, the extrapolated data will reside within the spectrum of the real data and thus the outcome will not suffer from the artifacts of the Digital Fourier Domain processing.

    2. The trend removed grid is then expanded in order to prepare it for the Fourier transform process. MAGMAP uses either the Cooley-Tukey or the Winograd algorithm. The Cooley-Tukey algorithm requires that the dimensions of the input grid be a power of 2 (i.e. 2, 4, 8, 16, 32,...,1024, 2048, 4096). It is preferable to expand the grid as little as possible while maintaining continuity and periodicity. To circumvent the dilemma of the increasing difference of successive powers of 2, Winograd came up with an alternative algorithm supporting more frequent permissible dimensions. The Winograd dimensions are (2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 24, 28,..., 1008, 1260, 1680, 2520, 5040).

    3. The dummies in the expanded grid are then filled using one of the three available methods such that the grid is smoothly periodic across opposite edges. If you think of the grid as a single square/rectangular tile and copies of the tiles are laid out edge to edge, the grid pattern should smoothly match from tile to tile. If the matches were not smooth, an effective 'step' function would be introduced at the edge of each grid - this would cause serious side effects in the data when transformed back to space domain.

      • The Maximum entropy method (MEM) uses a segment of the real data to predict the extension. The principle of maximum entropy postulates that given a set of known data, the probability distribution that best represents it is one that has the largest entropy or uncertainty. MEM uses this stipulation to calculated coefficients that are convolved with the real segment in order to predict the expended segment. This method is the default method and behaves properly with most geophysical datasets.
      • The Inverse distance is a method that quickly attenuates the extrapolated data and is most useful when the real data along the edge has a high frequency high amplitude nature. This is the least used method.
      • The Multi-trend expansion method uses the NSI gridding algorithm developed by Tomas Naprstek and Richard Smith of Laurentian University 2. Use this method if your data contains thin linear features that span across multiple survey lines and the data does not contain a predominant strike direction.

    The expanded and filled grid is saved in the working folder. It retains the base name of the input grid and is appended by _prp.

  • If you apply another filter to the same grid, the existing _prp grid is used; it is not recomputed. It is only recomputed if you change any of the grid expansion/fill parameters or if you delete it.
  • Forward Fourier Transform (creates _trn.grd)

    The expanded/filled grid is transformed to the Fourier domain where the filters are applied. In the field of digital signal processing these two domains are referred to as time and frequency domains; the units of the former is “t” and the latter “t-1”. By analogy since geophysical data has a spatial attribution, in order to apply Fourier domain filtering, it is converted from space (m) to wavenumber (m-1) domain.

    In one dimension, the Fourier transform is represented with the integral:

    H(υ)=

    ../image/magmap1_formula1.png

    Where: 

                  x is the distance variable

                  υ is the wavenumber variable

                  h(x) represents the signal in space domain

                  H(υ) represents the signal in wavenumber domain

    Since the operation is performed in a two dimensional space, the space domain variables are x and y, and the wavenumber domain equivalents are u and v.

    Expressing the transformation in 2 dimensions:

    H(υ,ν)=

    ../image/magmap1_formula2.png

    Where: 

                 h(x,y) represents the signal in space domain

                 H(υ,ν) represents the signal in wavenumber domain

    The transformed grid retains the base name of the input grid and is appended by _trn.

    For practical reasons, the transform grid is saved in the Geosoft grid format, the axis of which are the wavenumber domain υ & ν. See Display 2D Spectrum for further description.

  • If you apply another filter to the same grid, the existing _trn grid is used; it is not recomputed. It is only recomputed if you change any of the grid expansion/fill parameters or if you delete it.
  • Output TRN (_trn.grd) and PRP (_prp.grd) Grids

    By default, the TRN grid and the PRP grid will be created in the current working directory. This location can be changed in a script by setting the parameters:

    MAGMAP1.OUTTRNGRD="full path to grid file.ext(qual)"

    MAGMAP1.OUTPRPGRD=" full path to grid file.ext(qual)"

    Radial Energy Spectrum (creates *.spc)

    Once the Forward Fourier Transform is created, the radially averaged energy spectrum is also calculated. This data is saved in an ASCII file constructed using the input file base name and the extension *.spc. The format of this file (example below) consists of:

    • header containing:
      • the averaged energy value over the entire transform.
      • the labels of the five columns that follow.
    • five numeric columns of data.
     

    The 2D energy at each υ & ν point in the wavenumber domain consists of the square sum of its real and imaginary components. The radial energy spectrum that follows (3rd column) is normalized by the transform averaged energy listed in the header.

    The 1st data column, CYC/K_unit, contains the radial increment in the wavenumber domain.

    The 2nd data column, Norm_Contr_SAMP, represents the circumference at the radial increment, normalized by the radial increment. This is an indicator of the relative number of contributing elements.

    The 3rd data column, Ln_P, lists the averaged energy of all elements at the wavenumber radius (1st column). The energy is normalized by subtracting the log of the average spectral density.

    The 3-DEPTH and 5-DEPTH columns are ensemble magnetic depth estimates based on 3- and 5-point averages of the slope of the energy spectrum3.

    The depth to a statistical ensemble of sources is determined by the following expression:

    h = −s/4π

    Where:

    h is depth

    s is the slope of the log (energy) spectrum

    The above estimates can be used as a rough guide to the depth of magnetic source populations.

    MAGMAP displays the radially averaged spectrum automatically.

    Define Filters

    You can define the filters in the interactive MAGMAP Filter Design window.

    Multiple filters can be applied concurrently. The Fourier domain filters are commutative and the order in which they are supplied is immaterial. You will be prompted for additional parameters according to each filter’s requirements. For example band-pass filters will prompt the user to specify two cutoff wavelengths. This information is saved in the specified filter control file (*.con).

  • If running MAGMAP filtering in batch (script) mode, you will have to supply the control file that has been previously generated or edit an existing one. The filter control file is a text file. You are referred to the sample control file ...\geosoft\magmap.con for its format.
  • Filtering

    The filters are defined and applied to the Fourier transformed grid.

    H(υ,ν)= H(υ,ν) . F(υ,ν)

    Where:  F(υ,ν) represents the two dimensional filter.

    Note that in order to filter the data, for each element (υ,ν) of the grid, a single multiplication is performed.

    Inverse Fourier Transform

    The filtered grid is transformed from the wavenumber domain back to the space domain through the following formula:

    h(x,y)=

    ../image/magmap1_formula3.png
    Post-processing
    1. This step uses Boolean operations to match the filtered grid to the original input grid size. For example, if our original input grid was 29x15, and it had been expanded to 32x16 using the Cooley-Tukey method in the pre-processing stage, then it is now deflated back to 29x15.

    2. The trend is then added back into the grid.

    3. Size Consideration

    There are no software limits on the size of the grid to filter. However, in order to successfully filter a very large grid, a few considerations must be made:

    1. Do not run other memory intensive operations at the same time with MAGMAP Filtering.
    2. Use the Maximum entropy method to fill the expanded grid.
    3. Ensure that the size of your expanded grid is reasonably smaller than the RAM available: nX *nY * 8 << available RAM.

    References

    • [1] S. Winograd, "On Computing the Discrete Fourier Transform", Mathematics of Computation, vol. 32, no. 141 (January 1978), pp. 175-199
    • [2] T. Naprstek and R.S. Smith, "A new method for interpolating linear features in aeromagnetic data", GEOPHYSICS, vol. 84, no. 3, pp. JM15-JM24, 2019
    • [3] A. Spector, "Statistical Analysis of Aeromagnetic Data", Thesis/dissertation, University of Toronto, chapter 5, section 2 (1968)