geomagnet
— Geomagnetic helpers¶
The geomagnet
module provides a simple interface to world wide
models of the Earth magnetic field. It implements simple getter functions,
field()
and model()
, in
order to access the default geomagnetic model. For test purpose alternative
models can also be instanciated as Geomagnet
object.
Warning
The input coordinates to the field()
function or
method must be a grand
frame, i.e. ECEF
or
LTP
. In addition, if no observation time is specified
a default value is used (31 December 2019).
Note
The field()
function and method accept vectorized
input. The frame of the returned value depends on the input size. If a
single point is provided the magnetic field is returned in local
LTP
coordinates, centered on the input coordinates.
Otherwise the components are given in ECEF
.
Default interface¶
-
grand.geomagnet.
field
(coordinates: Union[ECEF, LTP]) → Union[ECEF, LTP]¶ Get the default geo-magnetic field at the given coordinates.
For example, the following returns the Earth magnetic field at sea level, close to Clermont-Ferrand, France, for new year 2019.
>>> coordinates = ECEF(representation_type='geodetic', latitude=45 * u.deg, ... longitude=3 * u.deg, obstime='2019-01-01') >>> field = geomagnet.field(coordinates)
-
property
geomagnet.
model
¶ str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
The default geomagnetic model, i.e. IGRF12.
-
property
geomagnet.
obstime
¶ Return date object with same year, month and day.
The deault observation time, i.e. 31 December 2019.
Alternative magnetic models¶
Warning
In order to get the geomagnetic field from the default GRAND model (IGRF12),
one should not directly instantiate a Geomagnet
object. Instead one should use the field()
function
of the geomagnet
module. This class is only meant to be used
for studies of the impact of alternative models.
Supported models for the Earth magnetic field are: IGRF12 and WMM2015.
-
class
grand.geomagnet.
Geomagnet
(model: Optional[str] = None)¶ Proxy to a geomagnetic model
The default model is IGRF12. You can instanciate an alternative model by specifying its name, E.g. as follow:
>>> magnet = geomagnet.Geomagnet('WWM2015')
-
field
(coordinates: Union[ECEF, LTP]) → Union[ECEF, LTP]¶ Get the geo-magnetic field components
-