Loading a pickled xarray
object
#5642
-
I am trying to open an old pickled xarray object. I get the following errors: ~/neuralhydrology/scripts/read_nh_results.py in get_all_station_ds(res_fp)
115
116 def get_all_station_ds(res_fp: Path) -> xr.Dataset:
--> 117 res_dict = pickle.load(res_fp.open("rb"))
118 ds = _load_dict_to_xarray(res_dict)
119 return ds
AttributeError: Can't get attribute 'PandasIndexAdapter' on <module 'xarray.core.indexing' from '/DataDrive200/data/miniconda3/envs/ml/lib/python3.8/site-packages/xarray/core/indexing.py'> Is there any way of determining which versions of xarray the file was saved with? Or else determining how to go about opening the file? My package versions:
## Steps to reproduce: The pickle file can be found here. import pickle
from pathlib import Path
fp = Path("path/to/file/test_results.p")
pickle.load(fp.open("rb")) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Unfortunately, Xarray does not provide backward compatibility for Pickled objects. In fact, the Xarray documentation on the Pickle format says:
I take it from your question that you don't have the environment that created the Pickle objects? I am not aware of any tools for extracting environment details from a Pickle. |
Beta Was this translation helpful? Give feedback.
Unfortunately, Xarray does not provide backward compatibility for Pickled objects. In fact, the Xarray documentation on the Pickle format says:
I take it from your question that you don't have the environment that created the Pickle objects? I am not aware of any tools for extracting environment details from a Pickle.