Magnetic Anomaly Maps

The following are key functions related to magnetic anomaly maps.

Load Map Data

MagNav.get_mapFunction
get_map(map_file::String   = namad;
        map_info::String   = splitpath(map_file)[end],
        map_units::Symbol  = :rad,
        file_units::Symbol = :deg)

Get map data from saved HDF5 or MAT file. Maps are typically saved in :deg units, while :rad is used internally.

Arguments:

  • map_file: path/name of map data HDF5 or MAT file (.h5 or .mat extension required)
  • map_info: (optional) map information, only used if not in map_file
  • map_units: (optional) map xx/yy units to use in map_map {:rad,:deg}
  • file_units: (optional) map xx/yy units used in map_file {:rad,:deg}

Returns:

  • map_map: Map magnetic anomaly map struct
source
get_map(map_name::Symbol, df_map::DataFrame;
        map_info::String   = "$map_name",
        map_units::Symbol  = :rad,
        file_units::Symbol = :deg)

Get map data from saved HDF5 or MAT file via DataFrame lookup. Maps are typically saved in :deg units, while :rad is used internally.

Arguments:

  • map_name: name of magnetic anomaly map
  • df_map: lookup table (DataFrame) of map data HDF5 and/or MAT files
FieldTypeDescription
map_nameSymbolname of magnetic anomaly map
map_fileStringpath/name of map data HDF5 or MAT file (.h5 or .mat extension required)
  • map_info: (optional) map information, only used if not in map_file
  • map_units: (optional) map xx/yy units to use in map_map {:rad,:deg}
  • file_units: (optional) map xx/yy units used in files within df_map {:rad,:deg}

Returns:

  • map_map: Map magnetic anomaly map struct
source

Upward Continue Map

MagNav.upward_fftFunction
upward_fft(map_map::Matrix, dx, dy, dz; expand::Bool = true, α = 0)

Upward continuation of a potential field (i.e., magnetic anomaly field) map. Uses the Fast Fourier Transform (FFT) to convert the map to the frequency domain, applies an upward continuation filter, and uses the inverse FFT to convert the map back to the spatial domain. Optionally expands the map temporarily with periodic padding. Downward continuation may be performed to a limited degree as well, but be careful, as this is generally unstable and amplify high frequencies (i.e., noise).

Reference: Blakely, Potential Theory in Gravity and Magnetic Applications, 2009, Chapter 12 & Appendix B (pg. 315-317 & 402).

Arguments:

  • map_map: ny x nx 2D gridded map data
  • dx: x-direction map step size [m]
  • dy: y-direction map step size [m]
  • dz: z-direction upward/downward continuation distance(s) [m]
  • expand: (optional) if true, expand map temporarily to reduce edge effects
  • α: (optional) regularization parameter for downward continuation

Returns:

  • map_map: ny x nx 2D gridded map data, upward/downward continued
source
upward_fft(map_map::Map, alt; expand::Bool = true, α = 0)

Upward continuation of a potential field (i.e., magnetic anomaly field) map. Uses the Fast Fourier Transform (FFT) to convert the map to the frequency domain, applies an upward continuation filter, and uses the inverse FFT to convert the map back to the spatial domain. Optionally expands the map temporarily with periodic padding. Downward continuation may be performed to a limited degree as well, but be careful, as this is generally unstable and amplify high frequencies (i.e., noise).

Reference: Blakely, Potential Theory in Gravity and Magnetic Applications, 2009, Chapter 12 & Appendix B (pg. 315-317 & 402).

Arguments:

  • map_map: Map magnetic anomaly map struct
  • alt: target upward continuation altitude(s) [m]
  • expand: (optional) if true, expand map temporarily to reduce edge effects
  • α: (optional) regularization parameter for downward continuation

Returns:

  • map_map: Map magnetic anomaly map struct, upward/downward continued (MapS with alt vector => MapS3D)
source

Interpolate Map

MagNav.map_interpolateFunction
map_interpolate(map_map::AbstractArray{T},
                map_xx::AbstractVector{T},
                map_yy::AbstractVector{T},
                type::Symbol = :cubic,
                map_alt::AbstractVector = []) where T

Create map interpolation function, equivalent of griddedInterpolant in MATLAB.

Arguments:

  • map_map: ny x nx (x nz) 2D or 3D gridded map data
  • map_xx: nx map x-direction (longitude) coordinates
  • map_yy: ny map y-direction (latitude) coordinates
  • type: (optional) type of interpolation {:linear,:quad,:cubic}
  • map_alt: (optional) map altitude levels

Returns:

  • itp_map: map interpolation function (f(yy,xx) or (f(yy,xx,alt))
source
map_interpolate(mapS::Union{MapS,MapSd,MapS3D}, type::Symbol = :cubic;
                return_vert_deriv::Bool = false)

Create map interpolation function, equivalent of griddedInterpolant in MATLAB. Optionally return vertical derivative map interpolation function, which is calculated using finite differences between map and 1 m upward continued map.

Arguments:

  • mapS: MapS, MapSd, or MapS3D scalar magnetic anomaly map struct
  • type: (optional) type of interpolation {:linear,:quad,:cubic}
  • return_vert_deriv: (optional) if true, also return der_map

Returns:

  • itp_map: map interpolation function (f(yy,xx) or (f(yy,xx,alt))
  • der_map: if return_vert_deriv = true, vertical derivative map interpolation function (f(yy,xx) or (f(yy,xx,alt))
source
map_interpolate(mapV::MapV, dim::Symbol = :X, type::Symbol = :cubic)

Create map interpolation function, equivalent of griddedInterpolant in MATLAB.

Arguments:

  • mapV: MapV vector magnetic anomaly map struct
  • dim: map dimension to interpolate {:X,:Y,:Z}
  • type: (optional) type of interpolation {:linear,:quad,:cubic}

Returns:

  • itp_map: map interpolation function (f(yy,xx))
source

Plot Map

MagNav.plot_mapFunction
plot_map(map_map::Matrix,
         map_xx::Vector       = [],
         map_yy::Vector       = [];
         clims::Tuple         = (),
         dpi::Int             = 200,
         margin::Int          = 2,
         Nmax::Int            = 6*dpi,
         legend::Bool         = true,
         axis::Bool           = true,
         map_color::Symbol    = :usgs,
         bg_color::Symbol     = :white,
         map_units::Symbol    = :rad,
         plot_units::Symbol   = :deg,
         b_e::AbstractBackend = gr())

Plot map.

Arguments:

  • map_map: ny x nx 2D gridded map data
  • map_xx: nx map x-direction (longitude) coordinates [rad] or [deg]
  • map_yy: ny map y-direction (latitude) coordinates [rad] or [deg]
  • clims: (optional) length-2 colorbar limits (cmin,cmax)
  • dpi: (optional) dots per inch (image resolution)
  • margin: (optional) margin around plot [mm]
  • Nmax: (optional) maximum number of data points plotted (per axis)
  • legend: (optional) if true, show legend
  • axis: (optional) if true, show axes
  • map_color: (optional) filled contour color scheme {:usgs,:gray,:gray1,:gray2,:plasma,:magma}
  • bg_color: (optional) background color
  • map_units: (optional) map xx/yy units {:rad,:deg}
  • plot_units: (optional) plot xx/yy units {:rad,:deg,:m}
  • b_e: (optional) plotting backend

Returns:

  • p1: plot of map
source
plot_map(map_map::Map;
         use_mask::Bool       = true,
         clims::Tuple         = (),
         dpi::Int             = 200,
         margin::Int          = 2,
         Nmax::Int            = 6*dpi,
         legend::Bool         = true,
         axis::Bool           = true,
         map_color::Symbol    = :usgs,
         bg_color::Symbol     = :white,
         map_units::Symbol    = :rad,
         plot_units::Symbol   = :deg,
         b_e::AbstractBackend = gr())

Plot map.

Arguments:

  • map_map: Map magnetic anomaly map struct
  • use_mask: (optional) if true, apply map_map mask to map
  • clims: (optional) length-2 colorbar limits (cmin,cmax)
  • dpi: (optional) dots per inch (image resolution)
  • margin: (optional) margin around plot [mm]
  • Nmax: (optional) maximum number of data points plotted (per axis)
  • legend: (optional) if true, show legend
  • axis: (optional) if true, show axes
  • map_color: (optional) filled contour color scheme {:usgs,:gray,:gray1,:gray2,:plasma,:magma}
  • bg_color: (optional) background color
  • map_units: (optional) map xx/yy units {:rad,:deg}
  • plot_units: (optional) plot xx/yy units {:rad,:deg,:m}
  • b_e: (optional) plotting backend

Returns:

  • p1: plot of map (if map_map isa MapV, mapX)
  • p2: if map_map isa MapV, mapY
  • p3: if map_map isa MapV, mapZ
source