Magnetic Anomaly Maps
The following are key functions related to magnetic anomaly maps.
Load Map Data
MagNav.get_map
— Functionget_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 inmap_file
map_units
: (optional) map xx/yy units to use inmap_map
{:rad
,:deg
}file_units
: (optional) map xx/yy units used inmap_file
{:rad
,:deg
}
Returns:
map_map
:Map
magnetic anomaly map struct
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 mapdf_map
: lookup table (DataFrame) of map data HDF5 and/or MAT files
Field | Type | Description |
---|---|---|
map_name | Symbol | name of magnetic anomaly map |
map_file | String | path/name of map data HDF5 or MAT file (.h5 or .mat extension required) |
map_info
: (optional) map information, only used if not inmap_file
map_units
: (optional) map xx/yy units to use inmap_map
{:rad
,:deg
}file_units
: (optional) map xx/yy units used in files withindf_map
{:rad
,:deg
}
Returns:
map_map
:Map
magnetic anomaly map struct
Upward Continue Map
MagNav.upward_fft
— Functionupward_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
xnx
2D gridded map datadx
: 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
xnx
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 structalt
: 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
withalt
vector =>MapS3D
)
Interpolate Map
MagNav.map_interpolate
— Functionmap_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
xnx
(xnz
) 2D or 3D gridded map datamap_xx
:nx
map x-direction (longitude) coordinatesmap_yy
:ny
map y-direction (latitude) coordinatestype
: (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)
)
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
, orMapS3D
scalar magnetic anomaly map structtype
: (optional) type of interpolation {:linear,:quad,:cubic}return_vert_deriv
: (optional) if true, also returnder_map
Returns:
itp_map
: map interpolation function (f(yy,xx)
or (f(yy,xx,alt)
)der_map
: ifreturn_vert_deriv = true
, vertical derivative map interpolation function (f(yy,xx)
or (f(yy,xx,alt)
)
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 structdim
: map dimension to interpolate {:X
,:Y
,:Z
}type
: (optional) type of interpolation {:linear,:quad,:cubic}
Returns:
itp_map
: map interpolation function (f(yy,xx)
)
Plot Map
MagNav.plot_map
— Functionplot_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
xnx
2D gridded map datamap_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 legendaxis
: (optional) if true, show axesmap_color
: (optional) filled contour color scheme {:usgs
,:gray
,:gray1
,:gray2
,:plasma
,:magma
}bg_color
: (optional) background colormap_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;
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 structuse_mask
: (optional) if true, applymap_map
mask to mapclims
: (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 legendaxis
: (optional) if true, show axesmap_color
: (optional) filled contour color scheme {:usgs
,:gray
,:gray1
,:gray2
,:plasma
,:magma
}bg_color
: (optional) background colormap_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 (ifmap_map isa MapV
,mapX
)p2
: ifmap_map isa MapV
,mapY
p3
: ifmap_map isa MapV
,mapZ