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

python/xarray updates #320

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions python/psc/psc.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ def FieldToComponent(species):
map['d_rho'] = {'d_rho': 0}
map['div_j'] = {'div_j': 0}

# keeping 'all_1st' for backwards compatibility
map['all_1st'] = {}
map['all_1st_cc'] = {}
moments = ['rho', 'jx', 'jy', 'jz', 'px', 'py',
'pz', 'txx', 'tyy', 'tzz', 'txy', 'tyz', 'tzx']
for i_sp, sp in enumerate(species):
for i_mom, mom in enumerate(moments):
map['all_1st'][f"{mom}_{sp}"] = i_mom + 13 * i_sp
map['all_1st_cc'][f"{mom}_{sp}"] = i_mom + 13 * i_sp

return map
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
Loading