spedas / pyspedas

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

cdf_to_tplot error loading Cluster CP_EFW_L2_E3D_INERT data #888

Closed jameswilburlewis closed 3 months ago

jameswilburlewis commented 3 months ago

In this test:

    def test_load_csa_CP_EFW_L2_E3D_INERT_data(self):
        trange = ['2001-02-01T00:00:00Z', '2001-02-04T00:00:00Z']
        efw_data = pyspedas.cluster.load_csa(probes=['C1'],
                                         trange=trange,
                                         datatypes='CP_EFW_L2_E3D_INERT', time_clip=True)
        print(efw_data)

we get the following error:

Error
Traceback (most recent call last):
  File "/Users/jwl/PycharmProjects/pyspedas/pyspedas/cluster/tests/tests.py", line 133, in test_load_csa_CP_EFW_L2_E3D_INERT_data
    efw_data = pyspedas.cluster.load_csa(probes=['C1'],
  File "/Users/jwl/PycharmProjects/pyspedas/pyspedas/cluster/load_csa.py", line 232, in load_csa
    tvars = cdf_to_tplot(out_files,
  File "/Users/jwl/PycharmProjects/pyspedas/venv/lib/python3.9/site-packages/pytplot/importers/cdf_to_tplot.py", line 324, in cdf_to_tplot
    if xdata[0] < 0.0:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Could be a malformed time variable?

jameswilburlewis commented 3 months ago

Also happening in: test_load_csa_CP_EFW_L2_V3D_INERT_data test_load_csa_CP_PEA_PITCH_SPIN_DEFlux_data test_load_csa_CP_PEA_PITCH_SPIN_DPFlux_data test_load_csa_CP_PEA_PITCH_SPIN_PSD_data test_load_csa_CP_RAP_ESPCT6_R_data test_load_csa_CP_RAP_HSPCT_data test_load_csa_CP_RAP_HSPCT_R_data test_load_csa_CP_RAP_ISPCT_CNO_data test_load_csa_CP_RAP_ISPCT_He_data

jameswilburlewis commented 3 months ago

Fixed in pytplot-mpl-temp 2.2.28. The DEPEND_0 arrays were multidimensional for some caveat and dsettings variables. Those variables are now skipped if the DEPEND_0 arrays have more than one dimension.