The file should contain the coefficients of the time-dependent or static internal part of the CHAOS model. In case of the time-dependent part, a reconstruction of the piecewise polynomial is performed.

Parameters:
filepathstr

Path to shc-file.

namestr, optional

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

leap_year{False, True}, optional

Take leap year in time conversion into account. By default set to False, so that a conversion factor of 365.25 days per year is used.

Returns:
modelCHAOS instance

Class instance with either the time-dependent or static internal part initialized.

Examples

Load for example the shc-file CHAOS-6-x7_tdep.shc in the current working directory, containing the coefficients of time-dependent internal part of the CHAOS-6-x7 model.

>>> import chaosmagpy as cp
>>> 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)
6575.0


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
array(-27642.31732596)