chaosmagpy.chaos.load_CovObs_txtfile

chaosmagpy.chaos.load_CovObs_txtfile(filepath, name=None)[source]

Load the ensemble mean of the internal model from the COV-OBS TXT-file in spline format.

Parameters:
filepathstr

Path to spline-formatted TXT-file (not part of ChaosMagPy).

namestr, optional

User defined name of the model. Defaults to the filename without the file extension.

Returns:
modelBaseModel

Class BaseModel instance.

References

For details on the COV-OBS model (COV-OBS.x2), see the original publication:

Huder, L., Gillet, N., Finlay, C. C., Hammer, M. D. and H. Tchoungui (2020), “COV-OBS.x2: 180 yr of geomagnetic field evolution from ground-based and satellite observations”, Earth, Planets and Space.

Examples

Load the ensemble mean internal model and plot the degree-1 secular variation. Here, the model parameter file, e.g. “COV-OBS.x2-int”, is in the current working directory.

import chaosmagpy as cp
import matplotlib.pyplot as plt
import numpy as np

model = cp.load_CovObs_txtfile('COV-OBS.x2-int')  # load model TXT-file

fig, ax = plt.subplots(1, 1, figsize=(10, 6))

# sample model timespan
time = np.linspace(1840., 2020., 1000)  # decimal years
mjd = cp.data_utils.dyear_to_mjd(time, leap_year=False)

coeffs = model.synth_coeffs(mjd, nmax=1, deriv=1)

ax.plot(cp.data_utils.timestamp(time), coeffs)
ax.set_title(model.name)
ax.set_xlabel('Time (years)')
ax.set_ylabel('nT/yr')

ax.legend(['$g_1^0$', '$g_1^1$', '$h_1^1$'])

plt.tight_layout()
plt.show()