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_field::Symbol = :map_data;
map_info::String = splitpath(map_file)[end],
map_units::Symbol = :rad,
file_units::Symbol = :deg,
flip_map::Bool = false)Get map data from saved HDF5 or MAT file or folder containing CSV files. Maps are typically saved in :deg units, while :rad is used internally.
Arguments:
map_file: path/name of map data HDF5 or MAT file (.h5or.matextension required) or folder containing CSV filesmap_field: (optional) struct field within MAT file to use, not relevant for CSV or HDF5 filemap_info: (optional) map information, only used if not inmap_filemap_units: (optional) map xx/yy units to use inmap_map{:rad,:deg}file_units: (optional) map xx/yy units used inmap_file{:rad,:deg}flip_map: (optional) if true, vertically flip data from map file (possibly useful for CSV map)
Returns:
map_map:Mapmagnetic anomaly map struct
get_map(map_name::Symbol, df_map::DataFrame,
map_field::Symbol = :map_data;
map_info::String = "$map_name",
map_units::Symbol = :rad,
file_units::Symbol = :deg,
flip_map::Bool = false)Get map data from saved HDF5 or MAT file or folder containing CSV files 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 and/or folder containing CSV 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) or folder containing CSV files |
map_info: (optional) map information, only used if not inmap_filemap_field: (optional) struct field within MAT file to use, not relevant for CSV or HDF5 filemap_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}flip_map: (optional) if true, vertically flip data from map file (possibly useful for CSV map)
Returns:
map_map:Mapmagnetic anomaly map struct
Built-in map data
MagNav.ottawa_area_maps — Functionottawa_area_maps(f::Union{String,Symbol} = "")Magnetic anomaly maps near Ottawa, Ontario, Canada, contains:
Eastern_395.h5: Eastern Ontario at 395 m HAEEastern_drape.h5: Eastern Ontario on drapeRenfrew_395.h5: Renfrew at 395 m HAERenfrew_555.h5: Renfrew at 555 m HAERenfrew_drape.h5: Renfrew on drapeHighAlt_5181.h5: High Altitude mini-survey (within Renfrew) at 5181 m HAEPerth_800.h5: Perth mini-survey (within Eastern Ontario) at 800 m HAE
NOTE: Missing map data within each map has been filled in (using k-nearest neighbors) so that the maps are fully filled. Care must be taken to not navigate in the filled-in areas, as this is not real data and only done for more accurate and consistent upward continuation of the maps. Use the map_check function with the desired map and flight path data to check if the map may be used without navigating into filled-in (artificial) areas.
Arguments:
f: (optional) name of data file (.h5extension optional)
Returns:
p: path of folder orfdata file
MagNav.namad — Constantconst namadNorth American Magnetic Anomaly Database (NAMAD). Compiled from marine and airborne magnetic measurements by the U.S. Geological Survey (USGS), Geological Survey of Canada (GSC), and Consejo de Recursos Minerales of Mexico (CRM). Reference: https://www.usgs.gov/maps/magnetic-anomaly-map-north-america
MagNav.emag2 — Constantconst emag2Earth Magnetic Anomaly Grid with 2 arcminute resolution (EMAG2). Compiled from satellite, marine, and airborne magnetic measurements. Reference: https://www.ncei.noaa.gov/products/earth-magnetic-model-anomaly-grid-2
MagNav.emm720 — Constantconst emm720Enhanced Magnetic Model (EMM). Compiled from satellite, marine, airborne, and ground magnetic measurements. Expands the scalar crustal field up to spherical harmonic degree and order 720, providing a vector of the magnetic field with approximately 15 arcminute resolution. Underlying crustal field model derived from Earth Magnetic Anomaly Grid with 2-arc-minute resolution (EMAG2). Reference: https://www.ncei.noaa.gov/products/enhanced-magnetic-model
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 amplifies 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:nyxnx2D gridded map datadx: x-direction map step size [m]dy: y-direction map step size [m]dz:nzz-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:nyxnx(xnz) 2D or 3D 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 amplifies 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:Mapmagnetic 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:Mapmagnetic anomaly map struct, upward/downward continued (MapSwithaltvector =>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{T} = T[0]) where TCreate map interpolation function, equivalent of griddedInterpolant in MATLAB.
Arguments:
map_map:nyxnx(xnz) 2D or 3D gridded map datamap_xx:nxmap x-direction (longitude) coordinatesmap_yy:nymap 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, orMapS3Dscalar 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:MapVvector 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:nyxnx2D gridded map datamap_xx:nxmap x-direction (longitude) coordinates [rad] or [deg]map_yy:nymap y-direction (latitude) coordinates [rad] or [deg]clims: (optional) length-2colorbar 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:Mapmagnetic anomaly map structuse_mask: (optional) if true, applymap_mapmask to mapclims: (optional) length-2colorbar 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,mapYp3: ifmap_map isa MapV,mapZ