Overview#
The library#
All functionality in magali is available from the base namespace of the
magali
package. This means that you can access all of them with a
single import:
# magali is usually imported as mg
import magali as mg
import pooch
import matplotlib.pyplot as plt
Load some data:
path = pooch.retrieve(
"doi:10.6084/m9.figshare.22965200.v1/Bz_uc0.mat",
known_hash="md5:268bd3af5e350188d239ff8bd0a88227",
)
print(path)
/home/runner/.cache/pooch/37cafac63fd8b1e21e8fed50e4e1c87e-Bz_uc0.mat
data = mg.read_qdm_harvard(path)
data
<xarray.DataArray 'bz' (y: 600, x: 960)> Size: 5MB array([[ 352.40587477, 94.8913792 , 41.61924299, ..., 470.18833933, 129.20055397, 18.50120941], [ 525.04809649, 624.84659897, 53.45418 , ..., 450.42515609, 240.12455308, -73.61367693], [ 105.0939369 , 638.76559489, 307.60736872, ..., 236.91326522, 386.8498122 , -86.44215589], ..., [ -83.74367957, 32.98078244, -411.75073652, ..., 745.99373583, 1036.20033954, -140.64317643], [ 171.17113661, -214.47801235, 159.23437984, ..., 124.58138395, 258.54331931, -90.3376945 ], [ 80.60950354, 273.08367487, 118.23499313, ..., -4.19572521, -53.55728012, 2.10335918]]) Coordinates: * x (x) float64 8kB 0.0 2.35 4.7 7.05 ... 2.249e+03 2.251e+03 2.254e+03 * y (y) float64 5kB 0.0 2.35 4.7 7.05 ... 1.403e+03 1.405e+03 1.408e+03 z (y, x) float64 5MB 5.0 5.0 5.0 5.0 5.0 5.0 ... 5.0 5.0 5.0 5.0 5.0 Attributes: long_name: vertical magnetic field units: nT
fig, ax = plt.subplots(1, 1, figsize=(9, 4.8), layout="constrained")
scale = 2500
data.plot.imshow(ax=ax, cmap="RdBu_r", vmin=-scale, vmax=scale)
ax.set_aspect("equal")
plt.show()
