chaosmagpy.chaos.load_gufm1_txtfile

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

Load model parameter file of the gufm1 model.

Parameters
filepathstr

Path to txt-file (provided by the modellers).

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 gufm1 model, see the original publication:

Andrew Jackson, Art R. T. Jonkers and Matthew R. Walker (2000), “Four centuries of geomagnetic secular variation from historical records”, Phil. Trans. R. Soc. A.358957–990, http://doi.org/10.1098/rsta.2000.0569

Examples

Load the model and plot the degree-1 secular variation. Here, the model parameter file, e.g. “gufm1”, is in the current working directory.

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

model = cp.load_gufm1_txtfile('gufm1')  # load model txt-file

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

# sample model timespan 7.5 years away from endpoints
time = np.linspace(1590., 1990., 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(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()