irfpy.swim.wind
¶
Module to handle WIND data
Simplest way of getting the data is using WindMoon
.
If you want to take the average key parameter of the solar wind at the Moon position, use the following syntaxes. This sample is to get the average between 03:15 and 03:20 on 10 May 2009.
>>> t0 = datetime.datetime(2009, 5, 10, 3, 15, 0)
>>> t1 = datetime.datetime(2009, 5, 10, 3, 20, 0)
>>> tarr, ave, var = WindMoon.get_average(t0, t1)
>>> print(len(tarr))
4
>>> label = WindMoon.label_array()
>>> print('%s %.2f (%.2f)' % (label[0], ave[0], var[0]))
N 2.22 (0.07)
>>> print('%s %.2f (%.2f)' % (label[1], ave[1], var[1]))
V 433.35 (28.05)
>>> print('%s %.2f (%.2f)' % (label[2], ave[2], var[2]))
Vth 27.49 (5.75)
The data file location should be specified by the .irfpyrc
file
using the entry in swim
section with a name of windmoonpath
.
The data file should be made beforehand using
wind2moon.py
script.
See also the document: ftp://space.mit.edu/pub/plasma/wind/kp_files/000_README_WIND_P_FILES.TXT
There is an interface for ACE spacecraft.
See irfpy.swim.ace
, while the usage is a little bit different.
- class irfpy.swim.wind.WindMoon[source]¶
Bases:
object
An user interface.
- windmoondatatree = None¶
- classmethod get_average(t0, t1)[source]¶
Get the average of the parameters.
An interface to the
WindMoonDataTree.get_average_wind_data_between
.- Returns
Tuple of three arrays. The returned is 0) the array of time used with shape of (N,) where N is the number of data in between the time range [t0 t1]; 1) the array of the average of the key parameters; and 2) the array of the variance of the key parameters.
The order of the key parameters can be referred to
WindMoonData.label_array()
.>>> t0 = datetime.datetime(2009, 5, 1, 23, 50) >>> t1 = datetime.datetime(2009, 5, 2, 4, 30) >>> tarr, average, variance = WindMoon.get_average(t0, t1) >>> print('N %.1f' % average[0]) N 7.7 >>> print('V %.1f' % average[1]) V 298.2 >>> print('Vth %.1f' % average[2]) Vth 22.4
>>> t0 = datetime.datetime(2009, 6, 15, 23, 59, 59) >>> t1 = datetime.datetime(2009, 6, 16, 0, 0, 1) >>> tarr, average, variance = WindMoon.get_average(t0, t1) >>> print(len(tarr)) 0 >>> print(len(average)) 7 >>> print(len(variance)) 7 >>> print(average[0]) nan
- class irfpy.swim.wind.WindMoonDataTree[source]¶
Bases:
object
WIND’s Moon data tree
- get_average_wind_data_between(t0, t1)[source]¶
Get the WIND averaged key parameters.
>>> winddata = WindMoonDataTree() >>> t0 = datetime.datetime(2009, 4, 30, 23, 50) >>> t1 = datetime.datetime(2009, 5, 2, 4, 30) >>> tarr, average, variance = winddata.get_average_wind_data_between(t0, t1)
The returned is 0) the array of time used with shape of (N,) where N is the number of data in between the time range [t0 t1]; 1) the array of the average of the key parameters; and 2) the array of the variance of the key parameters.
The order of the key parameters can be referred to
WindMoonData.label_array()
.
- get_wind_data_between(t0, t1)[source]¶
Get the WIND data in the interval between t0 and t1.
Return the time array and the data array. Time array is the datetime instance array and the data array is the WindMoonData instance array.
>>> winddata = WindMoonDataTree() >>> t0 = datetime.datetime(2009, 4, 30, 23, 50) >>> t1 = datetime.datetime(2009, 5, 2, 4, 30) >>> tarr, darr = winddata.get_wind_data_between(t0, t1)
- class irfpy.swim.wind.WindData[source]¶
Bases:
object
WIND data.
>>> str='2009 354 0.00208993 377.5 -0.9312 -1.351 3.646 19.75 -1.000e+31 -377.3 -6.133 -8.901 246.1 -64.36 20.02' >>> data = WindData.parse_string(str)
The data is stored as a member in the class.
yr, doy, dayfrac, t
v, ewang, nsang
n
vth
alpha
vx, vy, vz
gsex, gsey, gsez
- class irfpy.swim.wind.WindMoonData[source]¶
Bases:
object
WIND data at the Moon. >>> str=’2009 354 0.00208993 377.5 -0.9312 -1.351 3.646 19.75 -1.000e+31 -377.3 -6.133 -8.901 246.1 -64.36 20.02 2009-01-27 00:15:30 2009-01-27 01:30:44’
>>> data = WindMoonData.parse_string(str)
The data is stored as a member in the class.
yr, doy, dayfrac, t
tmoon
v, ewang, nsang
n
vth
alpha
vx, vy, vz
gsex, gsey, gsez
- as_array()[source]¶
Return the data as numpy.array.
Return 1-D array of [n, v, vth, alpha%, vx, vy, vz].
- classmethod label_array()[source]¶
Return the label of the
as_array()
.- Returns
A string array
['N', 'V', 'Vth', 'Alpha%', 'Vx', 'Vy', 'Vz']