Estimates a likelihood map for each stationary period based on observed magnetic data (intensity and inclination) compared to the expected values from the World Magnetic Model (WMM).
Usage
geomag_map(
tag,
compute_known = FALSE,
sd_e_f = 0.009,
sd_e_i = 2.6,
sd_m_f = 0.014,
sd_m_i = 3.5,
ref_map = geomag_map_ref(tag, quiet = quiet),
quiet = FALSE
)Arguments
- tag
A calibrated GeoPressureR tag object with map metadata set via tag_set_map().
- compute_known
Logical. If
TRUE, computes likelihood maps for known stationary periods; ifFALSE, sets their likelihood to 1 at the known location and 0 elsewhere.- sd_e_f
Numeric. Standard deviation of the observation error of intensity, in Gauss (single value or one per stationary period).
- sd_e_i
Numeric. Standard deviation of the observation error of inclination, in degrees (single value or one per stationary period).
- sd_m_f
Numeric. Standard deviation of the stationary-period error of intensity, in Gauss (single value or one per stationary period).
- sd_m_i
Numeric. Standard deviation of the stationary-period error of inclination, in degrees (single value or one per stationary period).
- ref_map
A
SpatRasterwith layersintensityandinclination, with the same grid as the tag map. By default this is computed bygeomag_map_ref(). Provide it if you have already computed it to save time.- quiet
Logical. If
TRUE, suppresses progress messages.
Value
A GeoPressureR tag object with likelihood maps added as:
tag$map_magnetic_intensitytag$map_magnetic_inclinationtag$map_magnetic(product of the two)
The logical columns clean_F and clean_I of tag$magnetic flag the samples used for each
map, and the parameters are stored in tag$param$geomag_map.
Details
The tag must already contain calibrated magnetic data from geomag_calib() and map metadata
created with tag_set_map(). Stationary-period identifiers must be consecutive integers from 1
to the number of stationary periods.
Only samples assigned to a stationary period (integer stap_id) are used. Intensity samples
must lie between 0.25 and 0.65 Gauss, inclination samples must be static (is_static), and
outliers are removed within each stationary period with a median absolute deviation rule
(threshold 3).
For an observed magnetic quantity \(y_j\) and WMM value \(x_s\) at location \(s\), the observation model is \(y_j = x_s + b + e_j\), with observation error \(e_j \sim N(0, \sigma_e^2)\) and stationary-period error \(b \sim N(0, \sigma_m^2)\). Integrating over \(b\), the likelihood of the \(n\) observations of a stationary period is proportional to a Gaussian of their mean \(\bar{y}\): \(\exp(-(\bar{y} - x_s)^2 / (2(\sigma_m^2 + \sigma_e^2/n)))\). It is returned relative to its maximum value. When no valid observations are available, an uninformative all-one map is returned.
Intensity values and their standard deviations (sd_e_f, sd_m_f) are in Gauss. Inclination
values and their standard deviations (sd_e_i, sd_m_i) are in degrees. Sensitivity analyses
should vary both error components because larger values broaden the likelihood surface and reduce
the spatial information contributed by magnetic data.
Examples
library(GeoPressureR)
withr::with_dir(system.file("extdata", package = "GeoMagR"), {
tag <- tag_create("14DM", quiet = TRUE)
tag <- tag_label(tag, quiet = TRUE)
tag <- tag_set_map(tag,
extent = c(-18, 23, 0, 50),
scale = 2,
known = data.frame(
stap_id = c(1, -1),
known_lon = 7.27,
known_lat = 46.19
)
)
tag <- geomag_calib(tag, quiet = TRUE)
tag <- geomag_map(tag, quiet = TRUE)
plot(tag, type = "map_magnetic_intensity")
plot(tag, type = "map_magnetic_inclination")
})
#> Warning: Selecting ‘env’ backend. Secrets are stored in environment variables
#> Warning: Selecting ‘env’ backend. Secrets are stored in environment variables
#> Warning: Selecting ‘env’ backend. Secrets are stored in environment variables
#> Warning: Selecting ‘env’ backend. Secrets are stored in environment variables
#> Warning: Selecting ‘env’ backend. Secrets are stored in environment variables
#> Warning: Selecting ‘env’ backend. Secrets are stored in environment variables
