From d008ac3a879375020ec1f94d0c53296d1b4f563f Mon Sep 17 00:00:00 2001 From: David A Minton Date: Fri, 27 Aug 2021 20:07:49 -0400 Subject: [PATCH] Getting SyMBA info into the NetCDF --- python/swiftest/swiftest/io.py | 7 ++++--- src/util/util_append.f90 | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/python/swiftest/swiftest/io.py b/python/swiftest/swiftest/io.py index 00bcd914c..0397335d6 100644 --- a/python/swiftest/swiftest/io.py +++ b/python/swiftest/swiftest/io.py @@ -718,9 +718,10 @@ def clean_string_values(param, ds): ------- ds : xarray dataset with the strings cleaned up """ - #ds['name'] = ds['name'].str.decode(encoding='utf-8') - #ds['particle_type'] = ds['particle_type'].str.decode(encoding='utf-8') - # ds['origin_type'] = ds['origin_type'].str.decode(encoding='utf-8') + ds['name'] = ds['name'].str.decode(encoding='utf-8') + ds['particle_type'] = ds['particle_type'].str.decode(encoding='utf-8') + if 'origin_type' in ds: + ds['origin_type'] = ds['origin_type'].str.decode(encoding='utf-8') return ds diff --git a/src/util/util_append.f90 b/src/util/util_append.f90 index 2f7d54474..d6b18d4e8 100644 --- a/src/util/util_append.f90 +++ b/src/util/util_append.f90 @@ -134,7 +134,12 @@ module subroutine util_append_arr_info(arr, source, nold, nsrc, lsource_mask) nnew = count(lsource_mask(1:nsrc)) if (.not.allocated(arr)) then - allocate(arr(nold+nnew)) + select type(source) + class is (symba_particle_info) + allocate(symba_particle_info :: arr(nold+nnew)) + class default + allocate(swiftest_particle_info :: arr(nold+nnew)) + end select else call util_resize(arr, nold + nnew) end if