Magnetic field in VSO frame (1s data)¶
To get the magnetic field, irfpy.vmag.scidata1s.DataCenterMag1s
data center can be used.
>>> from irfpy.vmag import scidata1s
>>> dc = scidata1s.DataCenterMag1s()
>>> import datetime
>>> t0 = datetime.datetime(2007, 10, 12, 3, 30, 20)
>>> t1 = datetime.datetime(2007, 10, 12, 3, 30, 40)
>>> tobs, bfield = dc.get_array(t0, t1)
Now you get the list of time (tobs) and the data (bfield)
>>> print(tobs)
[datetime.datetime(2007, 10, 12, 3, 30, 20, 958000),
datetime.datetime(2007, 10, 12, 3, 30, 21, 958000),
datetime.datetime(2007, 10, 12, 3, 30, 22, 958000),
...
datetime.datetime(2007, 10, 12, 3, 30, 38, 957000),
datetime.datetime(2007, 10, 12, 3, 30, 39, 957000)]
>>> print(bfield)
[masked_array(data=[ 1.096, -1.325, 0.366],
mask=False,
fill_value=99999.999),
masked_array(data=[ 1.042, -1.287, 0.463],
mask=False,
fill_value=99999.999),
masked_array(data=[ 0.921, -1.29 , 0.647],
mask=False,
fill_value=99999.999),
...
masked_array(data=[ 1.063, -1.327, 0.38 ],
mask=False,
fill_value=99999.999),
masked_array(data=[ 1.029, -1.357, 0.451],
mask=False,
fill_value=99999.999)]
Probably you want to make the data by
>>> import numpy as np
>>> bfield = np.ma.masked_array(bfield)
then you can access the time series of each component Bx, By and Bz component as a normal numpy array like.
>>> bx = bfield[:, 0]
Magnetic field in VSO frame (4s data)¶
Note
Data center for 4s data is not yet implemented.
Another simple interface is implemented in irfpy.aspera
to coherently use MAG and ASPERA data in a sinlge program.
By using irfpy.vmag.scidata.get_magarray()
function, you can get the MAG data between the specified times.
>>> import irfpy.vmag.scidata as vmag_data
>>> import datetime
>>> t0 = datetime.datetime(2007, 10, 12, 3, 30, 20)
>>> t1 = datetime.datetime(2007, 10, 12, 3, 30, 40)
>>> tobs, bfield = vmag_data.get_magarray(t0, t1)
>>> print(tobs)
[datetime.datetime(2007, 10, 12, 3, 30, 20)
datetime.datetime(2007, 10, 12, 3, 30, 24)
datetime.datetime(2007, 10, 12, 3, 30, 28)
datetime.datetime(2007, 10, 12, 3, 30, 32)
datetime.datetime(2007, 10, 12, 3, 30, 36)
datetime.datetime(2007, 10, 12, 3, 30, 40)]
>>> print(bfield.shape)
(6, 3)
>>> print(bfield)
[[ 1.065 -1.289 0.451]
[ 1.049 -1.302 0.449]
[ 1.124 -1.275 0.361]
[ 1.122 -1.271 0.36 ]
[ 1.111 -1.305 0.37 ]
[ 1.095 -1.322 0.35 ]]