spedas / pyspedas

Python-based Space Physics Environment Data Analysis Software
https://pyspedas.readthedocs.io/
MIT License
147 stars 58 forks source link

ERG pwe_wfc() load routine returns weirdly nested lists #741

Closed jameswilburlewis closed 6 months ago

jameswilburlewis commented 7 months ago
import pyspedas
from pytplot import tplot

pwe_wfc_vars = pyspedas.erg.pwe_wfc(trange=['2017-04-01/12:00:00', '2017-04-01/13:00:00'])

returns:


[['erg_pwe_wfc_l2_e_65khz_epoch',
  'erg_pwe_wfc_l2_e_65khz_Ex_waveform',
  'erg_pwe_wfc_l2_e_65khz_Ey_waveform',
  'erg_pwe_wfc_l2_e_65khz_quality_flag'],
 ['erg_pwe_wfc_l2_b_65khz_epoch',
  'erg_pwe_wfc_l2_b_65khz_Bx_waveform',
  'erg_pwe_wfc_l2_b_65khz_By_waveform',
  'erg_pwe_wfc_l2_b_65khz_Bz_waveform',
  'erg_pwe_wfc_l2_b_65khz_quality_flag']]

It should probably be a flat list.

jameswilburlewis commented 6 months ago

This routine performs multiple cdf_to_tplot calls and tries to use loaded_data.append() to accumulate the list of variables. But this results in nested lists. loaded_data.extend() is a better way to do this.