Skip to content
Snippets Groups Projects
Commit b464fecd authored by Claycomb, Abram Earl's avatar Claycomb, Abram Earl
Browse files

fixed some documentation, changed constructor

parent 2da563fe
No related branches found
No related tags found
No related merge requests found
Geomagnetic Adjusted Data
===========================================================
Abram Claycomb <[aclaycomb@usgs.gov](mailto:aclaycomb@usgs.gov)>
Abram Claycomb
<[aclaycomb@usgs.gov](mailto:aclaycomb@usgs.gov)>
## Background and Motivation
......@@ -13,14 +14,23 @@ magnetic field. The three axes are:
- `h` - Horizontal 'leading' ahead of the local magnetic
declination (magnetic north) at the time of installation, so
that the local magnetic vector would eventually cross the h axis
- `e` - Horizontal, nominally orthogonal to h (roughly magnetic east)
- `z` - Nominally vertical, downward, and nominally orthogonal to both `h` and `e`. Vertical at installation on a balancing device with the intended purpose of staying level if the pier on which it is mounted tilts under the sensor, all enclosed under a glass dome to keep air movements from convecting heat directly to the sensor from the room, or pushing the balanced system
Simultaneously, the field is measured by an Overhauser-effect scalar magnetometer (non-directional). This is called the total field:
- `e` - Horizontal, nominally orthogonal to h (roughly magnetic
east)
- `z` - Nominally vertical, downward, and nominally orthogonal
to both `h` and `e`. Vertical at installation on a balancing
device with the intended purpose of staying level if the pier on
which it is mounted tilts under the sensor, all enclosed under a
glass dome to keep air movements from convecting heat directly
to the sensor from the room, or pushing the balanced system
Simultaneously, the field is measured by an Overhauser-effect
scalar magnetometer (non-directional). This is called the total
field:
- `F` - Total field at the Overhauser pier
A third magnetometer, called a declination-inclination magnetometer (DIM) is used to manually find direction of
A third magnetometer, called a declination-inclination
magnetometer (DIM) is used to manually find direction of
the field for the purpose of calibrating the three-axis sensor
mentioned above, and converting the coordinate system to that of
a geographic north, east, and downward set of axes:
......@@ -31,8 +41,9 @@ the time of installation, and periodically on a time scale of a
few years
- `Y` - Geographically East component of the magnetic field,
again based on the survey mentioned in `X` above
- `Z` - Vertical component of the magnetic field, based on
leveling the theodolite at each absolute measurement session
- `Z` - Vertical component of the magnetic field, downward,
based on leveling the theodolite at each absolute measurement
session
The declination and inclination measured by the DIM are:
......@@ -47,18 +58,23 @@ in the sensor and its alignment to the optical axis of the
theodolite to which it is mounted.
The real-time measurements (to the nearest second) of `h`, `e`,
`z` and `F` are used to compute what are known as baselines, or the differences in the pseudo-vector cylindrical coordinate representation. The equations relating these quantities, with some definitions, are found below:
`z` and `F` are used to compute what are known as baselines, or
the differences in the pseudo-vector cylindrical coordinate
representation. The equations relating these quantities, with
some definitions, are found below:
- `F_pier_correction` - measured on the order of once or twice
per year, by a second Overhauser recording for a few hours at the absolute pier location (in place of the absolute DIM theodolite)
per year, by a second Overhauser recording for a few hours at
the absolute pier location (in place of the absolute DIM
theodolite)
- `F_corrected = F + F_pier_correction`
- `X = F_corrected*cos(I)*cos(D)`
- `Y = F_corrected*cos(I)*sin(D)`
- `Z = F_corrected*sin(I)`
- `H_absolute = X**2 + Y**2 = F_corrected*cos(I)`
- `H_absolute = sqrt(X**2 + Y**2) = F_corrected*cos(I)`
- `D_absolute = arctan2(Y,X) = D`
- `Z_absolute = F_corrected*sin(I)`
- `H_ordinate = h**2 + e**2` - were the angles small, this may
- `H_ordinate = sqrt(h**2 + e**2)` - were the angles small, this may
have been historically approximated as `h`
- `D_ordinate = arctan2(e,h)` - were the angles small, this may
have been historically approximated as `e/h`
......@@ -74,14 +90,26 @@ account for errors in the vector magnetometer, and transform
the recorded `h`, `e`, `z` data into `X`, `Y`, `Z` coordinates.
There are several types of errors:
- non-orthogonal sensor error, which can be corrected by a transformation matrix as a linear operator
- scale error (measurement by one unit in one sensor not being equal to one unit of the field), which can again be corrected by a different kind of transformation matrix; for fluxgate (and DIM) magnetic sensors, this is known to be temperature-dependent
- offset error (measurement with no field applied gives a non-zero sensor output; can be corrected by adding a vector, which can be re-cast as a matrix transformation and linear operator by an affine transformation; for fluxgate (and DIM) magnetic sensors, this is known to be temperature-dependent
- local magnetic disturbances - usually minimized by site selection and disciplined operations during maintenance and measurement.
- non-orthogonal sensor error, which can be corrected by a
transformation matrix as a linear operator
- scale error: measurement by one unit in one sensor not being
equal to one unit of the field, which can again be corrected
by a different kind of transformation matrix; for fluxgate
(and DIM) magnetic sensors, this is known to be
temperature-dependent
- offset error: measurement with no field applied gives a
non-zero sensor output; can be corrected by adding a vector,
which can be re-cast as a matrix transformation and linear
operator by an affine transformation; for fluxgate (and DIM)
magnetic sensors, this is known to be temperature-dependent
- local magnetic disturbances - usually minimized by site
selection and disciplined operations during maintenance and
measurement.
The combined effect for the above mentioned errors, as well as
a final rotation to transform coordinates to X,Y,Z can be found
using a least-squares algorithm and baseline calculator data. This is phase one of the Adjusted Data project.
using a least-squares algorithm and baseline calculator data.
This is phase one of the Adjusted Data project.
## Example
......@@ -91,7 +119,9 @@ Usage for this algorithm is shown in this
example.
Example calculations of affine transformation matrices for USGS
observatories are shown in this [Adjusted Example](AdjustedPhaseOneFunction2.ipynb) IPython notebook.
observatories are shown in this
[Adjusted Example](AdjustedPhaseOneFunction2.ipynb) IPython
notebook.
## References
......@@ -100,5 +130,3 @@ observatories are shown in this [Adjusted Example](AdjustedPhaseOneFunction2.ipy
Int. J. of Forecasting, 19(1), 143-148.
- Hitchman, P. G., Crosthwaite, W. V., Lewis, A. M., and Wang, L. (2011), [Australian Geomagnetism Report 2011](https://d28rz98at9flks.cloudfront.net/73627/Rec2012_072.pdf)
Adjusted Algorithm Usage
========================
The Adjusted Algorithm transforms between `observatory`, and `geographic`,
channel orientations, using transform matrices derived from absolute and
baseline measurements. Read more about the [Adjusted Algorithm](./Adjusted.md).
The Adjusted Algorithm transforms between `observatory`, and
`geographic`, channel orientations, using transform matrices
derived from absolute and baseline measurements. Read more about
the [Adjusted Algorithm](./Adjusted.md).
`geomag.py --algorithm sqdist`
### Example
This example uses a state file to produce X, Y, Z and F channels
from raw H, E, Z and F channels using the EDGE channel naming convention. Absolutes were used to compute a transform matrix contained in the statefile. The pier correction is also currently contained in the statefile.
from raw H, E, Z and F channels using the EDGE channel naming
convention. Absolutes were used to compute a transform matrix
contained in the statefile. The pier correction is also currently
contained in the statefile.
bin/geomag.py \
--input-edge cwbpub.cr.usgs.gov \
--observatory BOU \
--inchannels H E Z F \
--starttime 2016-01-03T00:01:00 \
--endtime 2016-01-04T00:00:00 \
--starttime 2016-01-03T00:00:00 \
--endtime 2016-01-03T23:59:59 \
--algorithm adjusted \
--adjusted-statefile=/tmp/adjbou_state_.json \
--adjusted-statefile=/etc/adjusted/adjbou_state_.json \
--outchannels X Y Z F \
--output-iaga-stdout
### Library Notes
> Note: this library internally represents data gaps as NaN, and factories
> Note: this library internally represents data gaps as NaN, and
factories
> convert to this where possible.
......@@ -47,9 +47,9 @@ Exception base class is `geomagio.TimeseriesFactoryException`.
Base class is `geomagio.algorithm.Algorithm`
Exception base class is `geomagio.algorithm.AlgorithmException`
- Adjusted `geomagio.algorithm.AdjustedAlgorithm`
- Delta F `geomagio.algorithm.DeltaFAlgorithm`
- XYZ `geomagio.algorithm.XYZAlgorithm`
- Adjusted `geomagio.algorithm.AdjustedAlgorithm`
## Example
......
......@@ -71,6 +71,14 @@ data to an **_iaga2002_** formatted file:
There are flags to specify certain algorithms should be run against the data.
### Adjusted ###
`--algorithm adjusted`
`--adjusted-statefile=/etc/adjusted/adjbou_state_.json`
`--outchannels X Y Z F `
#### XYZ ####
`--algorithm xyz`
......@@ -85,7 +93,7 @@ Rotate data from HEZ (obs) or HDZ (mag) to XYZ (geo) and back.
Document: [/algorithms/XYZ_usage.md](./algorithms/XYZ_usage.md)
### Adjusted ###
......
......@@ -19,7 +19,9 @@ class AdjustedAlgorithm(Algorithm):
self.matrix = matrix
self.pier_correction = pier_correction
self.statefile = statefile
self.load_state()
if (matrix is None):
self.load_state()
def load_state(self):
"""Load algorithm state from a file.
......@@ -107,9 +109,9 @@ class AdjustedAlgorithm(Algorithm):
stats = Stats(stats)
stats.data_type = 'adjusted'
stats.location = 'A0'
Trace = super(AdjustedAlgorithm, cls).create_trace(channel, stats,
trace = super(AdjustedAlgorithm, cls).create_trace(channel, stats,
data)
return Trace
return trace
def process(self, stream):
"""Run algorithm for a stream.
......
......@@ -6,18 +6,19 @@ Geomag Algorithms module
from Algorithm import Algorithm
from AlgorithmException import AlgorithmException
# algorithms
from AdjustedAlgorithm import AdjustedAlgorithm
from DeltaFAlgorithm import DeltaFAlgorithm
from SqDistAlgorithm import SqDistAlgorithm
from XYZAlgorithm import XYZAlgorithm
from AdjustedAlgorithm import AdjustedAlgorithm
# algorithms is used by Controller to auto generate arguments
algorithms = {
'identity': Algorithm,
'adjusted': AdjustedAlgorithm,
'deltaf': DeltaFAlgorithm,
'sqdist': SqDistAlgorithm,
'xyz': XYZAlgorithm,
'adjusted': AdjustedAlgorithm
'xyz': XYZAlgorithm
}
......@@ -26,8 +27,8 @@ __all__ = [
'Algorithm',
'AlgorithmException',
# algorithms
'AdjustedAlgorithm',
'DeltaFAlgorithm',
'SqDistAlgorithm',
'XYZAlgorithm'
'AdjustedAlgorithm'
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment