Skip to content

Commit

Permalink
Merge pull request #318 from xylar/fix_paraview_extractor_xtime
Browse files Browse the repository at this point in the history
Strip NULL (\x00) characters from xtime

Some NetCDF file types seem to include these.

closes #317
  • Loading branch information
mark-petersen committed Jun 11, 2020
2 parents 1bd41e5 + ae74536 commit 5f07820
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions conda_package/mpas_tools/viz/paraview_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,9 @@ def build_field_time_series(local_time_indices, file_names, mesh_file,
time_series_file))
var = time_series_file.variables[xtimeName]
if len(var.shape) == 2:
xtime = var[local_time_indices[time_index],
:].tostring().decode('utf-8').strip()
xtime = var[local_time_indices[time_index], :]
xtime = xtime.tostring().decode('utf-8').strip().strip(
'\x00')
date = datetime(int(xtime[0:4]), int(xtime[5:7]),
int(xtime[8:10]), int(xtime[11:13]),
int(xtime[14:16]), int(xtime[17:19]))
Expand Down

0 comments on commit 5f07820

Please sign in to comment.