Demo: Plotting with Speasy
using Dates
using Speasy
spz = speasy
using CairoMakie, SpacePhysicsMakie24-Nov-25 06:07:35: /home/runner/work/SpacePhysicsMakie.jl/SpacePhysicsMakie.jl/docs/.CondaPkg/.pixi/envs/default/lib/python3.13/site-packages/speasy/core/proxy/__init__.py:106: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
saved_inventory_dt: datetime = index.get("proxy_inventories_save_date", provider, datetime.utcfromtimestamp(0))
24-Nov-25 06:07:35: /home/runner/work/SpacePhysicsMakie.jl/SpacePhysicsMakie.jl/docs/.CondaPkg/.pixi/envs/default/lib/python3.13/site-packages/speasy/core/proxy/__init__.py:107: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
if saved_inventory_dt + timedelta(days=inventories_cfg.cache_retention_days.get()) > datetime.utcnow():
24-Nov-25 06:07:37: /home/runner/work/SpacePhysicsMakie.jl/SpacePhysicsMakie.jl/docs/.CondaPkg/.pixi/envs/default/lib/python3.13/site-packages/speasy/core/proxy/__init__.py:125: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
index.set("proxy_inventories_save_date", provider, datetime.utcnow())
24-Nov-25 06:07:38: Using pycdfpp
24-Nov-25 06:07:39: Non compliant ISTP file: Epoch was marked as data variable but it has 0 support variableComplex requests and flexible layout
Visualize multiple time series in a customized layout.
data = let intervals = ["2019-01-02T15", "2019-01-02T16"]
products = [
spz.inventories.tree.cda.MMS.MMS1.FGM.MMS1_FGM_SRVY_L2.mms1_fgm_b_gse_srvy_l2_clean,
spz.inventories.tree.cda.MMS.MMS1.SCM.MMS1_SCM_SRVY_L2_SCSRVY.mms1_scm_acb_gse_scsrvy_srvy_l2,
spz.inventories.tree.cda.MMS.MMS1.DES.MMS1_FPI_FAST_L2_DES_MOMS.mms1_des_bulkv_gse_fast,
spz.inventories.tree.cda.MMS.MMS1.DES.MMS1_FPI_FAST_L2_DES_MOMS.mms1_des_temppara_fast,
spz.inventories.tree.cda.MMS.MMS1.DES.MMS1_FPI_FAST_L2_DES_MOMS.mms1_des_tempperp_fast,
spz.inventories.tree.cda.MMS.MMS1.DES.MMS1_FPI_FAST_L2_DES_MOMS.mms1_des_energyspectr_omni_fast,
spz.inventories.tree.cda.MMS.MMS1.DIS.MMS1_FPI_FAST_L2_DIS_MOMS.mms1_dis_energyspectr_omni_fast
]
Speasy.get_data(products, intervals)
end7-element Vector{SpeasyVariable{Float32, 2}}:
mms1_fgm_b_gse_srvy_l2_clean [Time Range: 2019-01-02T15:00:00.051693550 to 2019-01-02T15:59:59.978141999, Units: nT, Size: (57599, 4)]
mms1_scm_acb_gse_scsrvy_srvy_l2 [Time Range: 2019-01-02T15:00:00.030592768 to 2019-01-02T15:59:59.988699202, Units: nT, Size: (115198, 3)]
mms1_des_bulkv_gse_fast [Time Range: 2019-01-02T15:00:01.683028000 to 2019-01-02T15:59:57.212884000, Units: km/s, Size: (800, 3)]
mms1_des_temppara_fast [Time Range: 2019-01-02T15:00:01.683028000 to 2019-01-02T15:59:57.212884000, Units: eV, Size: (800, 1)]
mms1_des_tempperp_fast [Time Range: 2019-01-02T15:00:01.683028000 to 2019-01-02T15:59:57.212884000, Units: eV, Size: (800, 1)]
mms1_des_energyspectr_omni_fast [Time Range: 2019-01-02T15:00:01.683028000 to 2019-01-02T15:59:57.212884000, Units: keV/(cm^2 s sr keV), Size: (800, 32)]
mms1_dis_energyspectr_omni_fast [Time Range: 2019-01-02T15:00:01.683028000 to 2019-01-02T15:59:57.212884000, Units: keV/(cm^2 s sr keV), Size: (800, 32)]Plotting multiple time series on a single figure
let figure = (; size=(1200, 1200)), add_title = true
f = Figure(; figure...)
tplot(f[1, 1], data[1:3]; add_title)
tplot(f[1, 2], [data[4:5], data[6:7]...]; add_title)
f
end
Interactive tplot with Speasy
Visual exploration of OMNI data
t0 = DateTime("2008-09-05T10:00:00")
t1 = DateTime("2008-09-05T22:00:00")
tvars = spz"cda/OMNI_HRO_1MIN/flow_speed,E,Pressure"
f, axes = tplot(tvars, t0, t1)
Here we simulate a user interacting with the plot by progressively zooming out in time with tlims!. Note: For real-time interactivity, consider using the GLMakie backend instead of CairoMakie.
dt = Hour(12)
record(f, "speasy.mp4", 1:5; framerate=1) do n
tlims!(t0 - n * dt, t1 + n * dt)
sleep(1)
end"speasy.mp4"