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_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_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
get_map(map_name::Symbol, df_map::DataFrame;
        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_h5Stringpath/name of map data HDF5 file (.h5 extension optional)
map_typeSymbol(optional) type of magnetic anomaly map {drape,HAE}
map_altReal(optional) map altitude, -1 for drape map [m]
  • 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

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
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)

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
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 grid interpolation, which is calculated using finite differences between the map and a slightly 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
  • der_map: if return_vert_deriv = true, vertical derivative grid interpolation
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

Plot Map

MagNav.plot_mapFunction
plot_map(map_map::Matrix,
         map_xx::Vector     = [],
         map_yy::Vector     = [];
         clims::Tuple       = (0,0),
         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                = 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) color scale limits
  • dpi: (optional) dots per inch (image resolution)
  • margin: (optional) margin around plot [mm]
  • Nmax: (optional) maximum number of data points plotted
  • 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
plot_map(map_map::Map;
         clims::Tuple       = (0,0),
         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                = gr())

Plot map.

Arguments:

  • map_map: Map magnetic anomaly map struct
  • clims: (optional) color scale limits
  • dpi: (optional) dots per inch (image resolution)
  • margin: (optional) margin around plot [mm]
  • Nmax: (optional) maximum number of data points plotted
  • 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 typeof(map_map) = MapV, mapX)
  • p2: if typeof(map_map) = MapV, mapY
  • p3: if typeof(map_map) = MapV, mapZ