During a file renaming script, we loaded in the file "imap_glows_l3e_survival-probability-hi-45_20260109-repoint00103_v002.cdf" with cdf_to_xarray, then we modified some attributes, and spit it back out as "imap_glows_l3e_survival-probability-hi-45_20260109-repoint00103_v001.0002.cdf". However, doing so caused an error with the latter file. Reading it in throws the error:
Traceback (most recent call last):
File "<python-input-1>", line 1, in <module>
x = cdf_to_xarray("imap_glows_l3e_survival-probability-hi-45_20260109-repoint00103_v001.0002.cdf")
File "C:\Users\harter\AppData\Roaming\Python\Python313\site-packages\cdflib\xarray\cdf_to_xarray.py", line 783, in cdf_to_xarray
global_attributes, all_variable_attributes, all_variable_data, all_variable_properties = _convert_cdf_to_dicts(
~~~~~~~~~~~~~~~~~~~~~^
filename, to_datetime=to_datetime, to_unixtime=to_unixtime
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\harter\AppData\Roaming\Python\Python313\site-packages\cdflib\xarray\cdf_to_xarray.py", line 108, in _convert_cdf_to_dicts
cdf_info = cdf_file.cdf_info()
File "C:\Users\harter\AppData\Roaming\Python\Python313\site-packages\cdflib\cdfread.py", line 203, in cdf_info
self._get_attnames(),
~~~~~~~~~~~~~~~~~~^^
File "C:\Users\harter\AppData\Roaming\Python\Python313\site-packages\cdflib\cdfread.py", line 768, in _get_attnames
adr_info = self._read_adr(position)
File "C:\Users\harter\AppData\Roaming\Python\Python313\site-packages\cdflib\cdfread.py", line 957, in _read_adr
return self._read_adr3(position)
~~~~~~~~~~~~~~~^^^^^^^^^^
File "C:\Users\harter\AppData\Roaming\Python\Python313\site-packages\cdflib\cdfread.py", line 964, in _read_adr3
adr = self._f.read(block_size - 8)
ValueError: read length must be non-negative or -1
I cannot upload files with the .cdf extension, but I renamed them to .txt. Just rename them back.
During a file renaming script, we loaded in the file "imap_glows_l3e_survival-probability-hi-45_20260109-repoint00103_v002.cdf" with cdf_to_xarray, then we modified some attributes, and spit it back out as "imap_glows_l3e_survival-probability-hi-45_20260109-repoint00103_v001.0002.cdf". However, doing so caused an error with the latter file. Reading it in throws the error:
I cannot upload files with the .cdf extension, but I renamed them to .txt. Just rename them back.
imap_glows_l3e_survival-probability-hi-45_20260109-repoint00103_v002.txt
imap_glows_l3e_survival-probability-hi-45_20260109-repoint00103_v001.0002.txt