pitchdist_cdf2df¶
-
heliopy.data.util.
pitchdist_cdf2df
(cdf, distkeys, energykey, timekey, anglelabels)¶ Converts cdf file of a pitch angle distribution to a pandas dataframe.
MultiIndexing is used as a pitch angle distribution is essentially a 3D dataset f(time, energy, angle). See http://pandas.pydata.org/pandas-docs/stable/advanced.html#multiindex-advanced-indexing for more information.
This has been constructed for importing wind swe pitch angle distributions, and might not generalise very well to other data sets.
Assumes that each energy in the cdf has its own 2D array (time, angle). In the below description of the function there are
n
time data pointsm
energy data pointsl
anglular data points
- Parameters
cdf (cdf) – Opened cdf file.
distkeys (list) – A list of the cdf keys for a given energies. Each array accessed by distkeys is shape
(n, l)
, and there must bem
distkeys.energykey (string) – The cdf key for the energy values. The array accessed by energykey must have shape
(m)
or(a, m)
wherea
can be anything. If it has shape(a, m)
, we assume energies measured don’t change, and take the first row as the energies for all times.timekey (string) – The cdf key for the timestamps. The array access by timekey must have shape
(n)
anglelabels (list) – A list of the labels to give each anglular bin (eg. [0, 10, 20] in degrees). Must be of length
l
.
- Returns
df – Data frame with read in data.
- Return type