diff --git a/python/swiftest/swiftest/io.py b/python/swiftest/swiftest/io.py index ae12125b6..5cd294246 100644 --- a/python/swiftest/swiftest/io.py +++ b/python/swiftest/swiftest/io.py @@ -7,6 +7,7 @@ import re newfeaturelist = ("FRAGMENTATION", "ROTATION", "TIDES", "ENERGY", "GR", "YARKOVSKY", "YORP", "IN_FORM") +string_varnames = ["name", "particle_type", "status", "origin_type"] def real2float(realstr): """ @@ -714,6 +715,16 @@ def swiftest2xr(param, verbose=True): return ds +def xstrip(a): + func = lambda x: np.char.strip(x) + return xr.apply_ufunc(func, a.str.decode(encoding='utf-8')) + +def string_converter(da): + if da.dtype == np.dtype(object): + da = da.astype('