From 4205b0de0858f5a21b7ecf7469dd563e1ecfcc6c Mon Sep 17 00:00:00 2001 From: shaunwbell Date: Wed, 14 Aug 2024 09:19:39 -0800 Subject: [PATCH] Update sbe_ctd_parser.py (#338) ignore non-ascii characters (like sigma from ctd files) --- src/EcoFOCIpy/io/sbe_ctd_parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EcoFOCIpy/io/sbe_ctd_parser.py b/src/EcoFOCIpy/io/sbe_ctd_parser.py index 60224ae..629c5bf 100644 --- a/src/EcoFOCIpy/io/sbe_ctd_parser.py +++ b/src/EcoFOCIpy/io/sbe_ctd_parser.py @@ -25,7 +25,7 @@ def seabird_header(filename=None): header, headercount, utc_time, latitude, longitude = [], [], [], [], [] var_names = {} - with open(filename) as fobj: + with open(filename, errors='ignore') as fobj: for k, line in enumerate(fobj.readlines()): header = header + [line] if "# name" in line: @@ -66,7 +66,7 @@ def manual_parse(file_list=[None]): for ctdfile in file_list: - with open(ctdfile) as fobj: + with open(ctdfile, errors='ignore') as fobj: print(f"Processing {ctdfile}") for k, line in enumerate(fobj.readlines()): if (not "*" in line) & (not "#" in line):