Skip to content

Commit c8aad3d

Browse files
Merge branch 'yt-project:main' into fixIssue5144
2 parents 2f935f8 + cb85c32 commit c8aad3d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

yt/frontends/ramses/io.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ def _ramses_particle_csv_file_handler(
159159
# read only selected fields
160160
dat = pd.read_csv(
161161
fname,
162-
delimiter=",",
162+
delimiter=r"\s*,\s*",
163+
engine="python",
163164
usecols=[ind for _field, ind in list_field_ind],
164165
skiprows=2,
165166
header=None,
@@ -375,7 +376,7 @@ def _read_part_csv_file_descriptor(fname: Union[str, "os.PathLike[str]"]):
375376

376377
# Fields name from the default csv RAMSES sink algorithm in the yt default convention
377378
mapping = {
378-
" # id": "particle_identifier",
379+
"# id": "particle_identifier",
379380
"msink": "particle_mass",
380381
"x": "particle_position_x",
381382
"y": "particle_position_y",
@@ -401,11 +402,12 @@ def _read_part_csv_file_descriptor(fname: Union[str, "os.PathLike[str]"]):
401402
}
402403

403404
# read the all file to get the number of particle
404-
dat = pd.read_csv(fname, delimiter=",")
405+
dat = pd.read_csv(fname, delimiter=r"\s*,\s*", engine="python")
405406
fields = []
406407
local_particle_count = len(dat)
407408

408409
for varname in dat.columns:
410+
varname = varname.strip()
409411
if varname in mapping:
410412
varname = mapping[varname]
411413
else:

0 commit comments

Comments
 (0)