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

Load CHAOS model from mat-file.


Path to mat-file containing the CHAOS model.

namestr, optional

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

satelliteslist of strings, optional

List of satellite names whose Euler angles are stored in the mat-file. This is needed for correct referencing as this information is not given in the standard CHAOS mat-file format (defaults to ['oersted', 'champ', 'sac_c', 'swarm_a', 'swarm_b', 'swarm_c', 'cryosat-2_1', 'cryosat-2_2', 'cryosat-2_3'].)

modelCHAOS instance

Fully initialized model.


Load for example the mat-file CHAOS-6-x7.mat in the current working directory like this:

>>> import chaosmagpy as cp
>>> model = cp.CHAOS.from_mat('CHAOS-6-x7.mat')
>>> print(model)

Compute the Gauss coefficients of the time-dependent internal field on January 1, 2018 at 0:00 UTC. First, convert the date to modified Julian date:

>>> cp.data_utils.mjd2000(2018, 1, 1)

Now, compute the Gauss coefficients:

>>> coeffs = model.synth_coeffs_tdep(6575.)
>>> coeffs
array([-2.94172133e+04, -1.46670696e+03, ..., -8.23461504e-02])

Compute only the dipolar part by restricting the spherical harmonic degree with the help of the nmax keyword argument:

>>> coeffs = model.synth_coeffs_tdep(6575., nmax=1)
>>> coeffs
array([-29417.21325337,  -1466.70696158,   4705.96297947])

Compute the first time derivative of the internal Gauss coefficients in nT/yr with the help of the deriv keyword argument:

>>> coeffs = model.synth_coeffs_tdep(6575., deriv=1)  # nT/yr
>>> coeffs
array([ 6.45476360e+00,  8.56693199e+00, ..., 1.13856347e-03])

Compute values of the time-dependent internal magnetic field on January 1, 2018 at 0:00 UTC at \((\theta, \phi) = (90^\circ, 0^\circ)\) on Earth’s surface (\(r=6371.2\) km):

>>> B_radius, B_theta, B_phi = model.synth_values_tdep(6575., 6371.2, 90., 0.)
>>> B_theta