irfpy.mima.solarwind

Solar wind related module.

irfpy.mima.solarwind.aberrate(t, v_mso, frame='MSO')[source]

Calculate the aberrated solar wind velocity vector.

Parameters
  • t – Time

  • v_mso – Non-aberrated solar wind velocity vector in the MSO frame.

  • frame – The frame.

Originally developed in appl_130717_swparam_statistics.solarwind_direction. Now ported with a slihgt modification of interface..

The MSO/non-aberrated solar wind is converted to the aberrated solar wind velocity in any frame. The aberration of the spacecraft velocity is calculated inside this function by subtracting the spacecraft velocity in an inertia frame (J2000 in this case). Therefore, the algorithm is

  1. The non-aberrated SW velocity (v_mso) is converted to the J2000 inertial frame, in which frame the solar wind flow is “fixed”.

  2. The non-aberrated SW velocity in J2000 frame is aberrated by considering the spacecraft velocity in J2000 frame.

  3. The aberrated SW velocity (J2000) is converted to the frame given by the parameter frame.

>>> t = datetime.datetime(2007, 12, 10)
>>> vsw_mso_noab = np.array([-400, 0, 0])
>>> if not ms.isdb():
...     print("SPICE not loaded.  Check MEX/SPICE module (mexspice)")  
... else:
...     print('{0[0]:.2f} {0[1]:.2f} {0[2]:.2f}'.format(aberrate(t, vsw_mso_noab)))
-398.11 22.19 -0.31
irfpy.mima.solarwind.vsw(swvel, theta_deg, phi_deg)[source]

Calculate the solar wind velocity vector.

The definition of th_d and ph_d is slightly different from the usual practice. The theta is defined from the ecliptic plane of Mars. The phi is defined from the -x, namely the solar wind flowing direction. +y direction is positive for phi. Thus, the conversion is [-swvel * cos t * cos p, swvel * cos t * sin p, swvel * sin t]

Parameters
  • swvel – Solar wind velocity (positive)

  • theta_deg – Angle of theta.

  • phi_deg – Angle of phi.

>>> print(vsw(400, 0, 0))
[-400.    0.    0.]
>>> print(vsw(400, 10, 0))   # 10 degree "north"
[-393.9231012     0.           69.45927107]
>>> print(vsw(400, 0, 10))   # 10 degree "+y"
[-393.9231012    69.45927107    0.        ]
irfpy.mima.solarwind.direction_imachannel(t, swvel=400.0, theta_deg=0.0, phi_deg=0.0)[source]

Return the direction of SW in IMA channel.

>>> t0 = datetime.datetime(2010, 9, 12, 5, 20)
>>> if not ms.isdb():
...     print("SPICE not loaded.  Check MEX/SPICE module (mexspice)")  
... else:
...     print('{0[0]:.2f} {0[1]:.2f} {0[2]:.2f}'.format(direction_imachannel(t0, swvel=420)))
422.13 1.20 7.46
irfpy.mima.solarwind.direction_imachannel_noab(t, swvel=400.0, theta_deg=0.0, phi_deg=0.0)[source]

Return the direction of SW in IMA channel.

>>> t0 = datetime.datetime(2010, 9, 12, 5, 20)
>>> if not ms.isdb():
...     print("SPICE not loaded.  Check MEX/SPICE module (mexspice)")  
... else:
...     print('{0[0]:.2f} {0[1]:.2f} {0[2]:.2f}'.format(direction_imachannel_noab(t0, swvel=420)))
420.00 1.35 7.50
irfpy.mima.solarwind.doctests()[source]