A short demo of taking magnetic measurements from a single Swarm spacecraft and deriving a main field model directly from one month of data!
Now that you have seen the principles of spherical harmonic models in the previous pages, here we use ChaosMagPy to provide the design matrix with which we will perform a simple least squares inversion using measurements from Swarm directly.
hvPlot is used to create some fancy visualisations but this library is very complex to use! so if you are newer to the Python ecosystem, you are better off using Matplotlib for your own work.
import datetime as dt import numpy as np import xarray as xr import matplotlib.pyplot as plt import cartopy.crs as ccrs import cartopy.feature as cfeature import holoviews as hv import hvplot.xarray from viresclient import SwarmRequest from chaosmagpy.model_utils import design_gauss, synth_values