Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Question #3

Closed
Zhugexiaoyuanyuan opened this issue Jun 19, 2023 · 1 comment
Closed

Some Question #3

Zhugexiaoyuanyuan opened this issue Jun 19, 2023 · 1 comment

Comments

@Zhugexiaoyuanyuan
Copy link

Hi, when I use the mms.psd_moments function, (I'm using the example you gave) I always get the following error: Traceback (most recent call last).
File "C:\Users\eric\AppData\Roaming\JetBrains\PyCharmCE2023.1\scratches\demo6.py", line 585, in
moments_e = mms.psd_moments(vdf_e, scpot, **options)
File "C:\anaconda\envs\pyrfu\lib\site-packages\pyrfu\mms\psd_moments.py", line 251, in psd_moments
field_name = vdf.attrs["FIELDNAM"]
KeyError: 'FIELDNAM'

from pyrfu import mms

tint_brst = ["2015-09-01T12:15:28.000", "2015-09-01T12:24:00.000"]

mms.download_data('pdi_fpi_brst_l2',tint_brst,1,data_path="C:\MMS\volumes")
scpot = mms.get_data("V_edp_brst_l2", tint_brst, 1)
vdf_e = mms.get_data("pde_fpi_brst_l2", tint_brst, 1)
options = dict(energy_range=[1, 1000])
moments_e = mms.psd_moments(vdf_e, scpot, **options)

@louis-richard
Copy link
Owner

Hi,
Thank you very much for reporting this issue!! The problem was due to changes in the structure of the VDFs (xarray.Dataset). pyrfu is continuously under development, so unspotted bugs can occur (although I do my best to test the code).

I fixed pyrfu.mms.psd_moments and uploaded the new release 2.4.9. The script is now running fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants