Geomag Algorithms is an open source library for processing Geomagnetic timeseries data. It includes algorithms and input/output factories used by the USGS Geomagnetism Program to translate between data formats, generate derived data and indices in near-realtime, and research and develop new algorithms.
- Accesses USGS data services.
- Built using established open source python libraries NumPy, SciPy, and ObsPy.
- Common geomagnetic formats including IAGA2002, IMFV122, IMFV283 (read only), and PCDCP.
- Defines command line interface,
geomag.py
. - Embeddable Python API,
import geomagio
.
The following examples request data from USGS for
BOU
observatory,
H
, E
, Z
, and F
component,
minute
interval,
and variation
type data
for the day 2016-07-04
,
then write IAGA2002
formatted output to the console.
geomag.py \
--input edge \
--observatory BOU \
--inchannels H E Z F \
--type variation \
--interval minute \
--output iaga2002 \
--output-stdout \
--starttime 2016-07-04T00:00:00Z \
--endtime 2016-07-04T23:59:00Z
Command Line Interface documentation
import sys
import geomagio
from obspy.core import UTCDateTime
input_factory = geomagio.edge.EdgeFactory()
timeseries = input_factory.get_timeseries(
observatory = 'BOU',
channels = ('H', 'E', 'Z', 'F'),
type = 'variation',
interval = 'minute',
starttime = UTCDateTime('2016-07-04T00:00:00Z'),
endtime = UTCDateTime('2016-07-04T23:59:00Z'))
output_factory = geomagio.iaga2002.IAGA2002Factory()
output_factory.write_file(
channels = ('H', 'E', 'Z', 'F'),
fh = sys.stdout,
timeseries = timeseries)
Docker is the simplest install option.
-
Create and start a new container
named
geomagio
, listening on local port8000
, from the imageusgs/geomag-algorithms
on docker hubdocker run -d --name geomagio -p 8000:8000 usgs/geomag-algorithms
-
Use the running container
-
Run the
geomag.py
command line interface:To work with files outside the container, use a volume mount when starting the container
docker exec -it geomagio geomag.py
-
Or, to run an interactive python prompt:
docker exec -it geomagio python
Algorithms described in docs/algorithms/
Developing described in docs/develop.md.