Skip to content

Commit

Permalink
python: adopt to xarray BACKEND_ENTRYPOINTS API change
Browse files Browse the repository at this point in the history
  • Loading branch information
liangwang-phys authored and germasch committed Jul 17, 2023
1 parent d8f5ce3 commit 24890f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion python/psc/pscadios2.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,9 @@ def guess_can_open(self, filename_or_obj):
return ext in {".bp"}


BACKEND_ENTRYPOINTS["pscadios2"] = PscAdios2BackendEntrypoint
if xarray.__version__ == "2023.4.1":
# FIXME determine exactly when the API changed
BACKEND_ENTRYPOINTS["pscadios2"] = ("psc", PscAdios2BackendEntrypoint)
else:
# API of version 0.19.0
BACKEND_ENTRYPOINTS["pscadios2"] = PscAdios2BackendEntrypoint
7 changes: 6 additions & 1 deletion python/psc/pschdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,9 @@ def guess_can_open(self, filename_or_obj):
return ext in {".h5"}


BACKEND_ENTRYPOINTS["pschdf5"] = PscHdf5BackendEntrypoint
if xarray.__version__ == "2023.4.1":
# FIXME determine exactly when the API changed
BACKEND_ENTRYPOINTS["pschdf5"] = ("psc", PscHdf5BackendEntrypoint)
else:
# API of version 0.19.0
BACKEND_ENTRYPOINTS["pschdf5"] = PscHdf5BackendEntrypoint

0 comments on commit 24890f3

Please sign in to comment.