Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Fixed some of the typing issues with encounter data
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Dec 6, 2022
1 parent c7472ee commit c25423d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/swiftest/swiftest/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ def process_netcdf_input(ds, param):
ds = fix_types(ds,ftype=np.float32)
ds = ds.where(ds.id >=0 ,drop=True)
# Check if the name variable contains unique values. If so, make name the dimension instead of id
if len(np.unique(ds['name'])) == len(ds['name']):
if "name" not in ds.dims and len(np.unique(ds['name'])) == len(ds['name']):
ds = ds.swap_dims({"id" : "name"})
ds = ds.reset_coords("id")

Expand Down
1 change: 1 addition & 0 deletions python/swiftest/swiftest/simulation_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -2771,6 +2771,7 @@ def _preprocess(ds, param):
partial_func = partial(_preprocess, param=self.param)

self.enc = xr.open_mfdataset(enc_files,parallel=True,combine="nested", concat_dim="encounter",preprocess=partial_func)
self.enc = io.process_netcdf_input(self.enc, self.param)

return

Expand Down

0 comments on commit c25423d

Please sign in to comment.