diff --git a/hyo2/soundspeed/__init__.py b/hyo2/soundspeed/__init__.py index 02090ad3..28328dc4 100644 --- a/hyo2/soundspeed/__init__.py +++ b/hyo2/soundspeed/__init__.py @@ -12,7 +12,7 @@ logger.addHandler(logging.NullHandler()) name = "Sound Speed" -__version__ = '2023.0.8' +__version__ = '2023.0.9' __copyright__ = 'Copyright 2023 University of New Hampshire, Center for Coastal and Ocean Mapping' lib_info = LibInfo() diff --git a/hyo2/soundspeed/formats/readers/sea_and_sun.py b/hyo2/soundspeed/formats/readers/sea_and_sun.py index 1ae57915..5914edcf 100644 --- a/hyo2/soundspeed/formats/readers/sea_and_sun.py +++ b/hyo2/soundspeed/formats/readers/sea_and_sun.py @@ -21,7 +21,7 @@ class SeaAndSun(AbstractTextReader): 'CTP': Dicts.probe_types['SST-CTP'], 'CTM': Dicts.probe_types['SST-MEM'] } - + def __init__(self): super(SeaAndSun, self).__init__() self.desc = "SeaAndSun" @@ -91,18 +91,18 @@ def _parse_header(self): date_string = date_tuple.strftime("%d.%m.%Y") locale.setlocale(locale.LC_TIME, old_loc) except Exception as e: - logger.info("Fail to interpret date from German: %s" % e) + logger.info("unable to interpret date using German locale: %s" % e) date_string = None - elif line_idx == 17: # probe type and serial number - if line[:len(self.tk_serial)] == self.tk_serial: - try: - probe_sn_tokens = line.split()[1] - self.ssp.cur.meta.probe_type = self.probe_dict[probe_sn_tokens[:3]] - self.ssp.cur.meta.sn = probe_sn_tokens[3:] - except KeyError: - logger.warning("unable to recognize probe type from line #%s" % line_idx) - + elif line_idx == 17: # probe type and serial number + if line[:len(self.tk_serial)] == self.tk_serial: + try: + probe_sn_tokens = line.split()[1] + self.ssp.cur.meta.probe_type = self.probe_dict[probe_sn_tokens[:3]] + self.ssp.cur.meta.sn = probe_sn_tokens[3:] + except KeyError: + logger.warning("unable to recognize probe type from line #%s" % line_idx) + if not line: # skip empty lines continue @@ -130,10 +130,11 @@ def _parse_header(self): if (time_string is not None) and (date_string is not None): try: - self.ssp.cur.meta.utc_time = dt.datetime.strptime(date_string + ' ' + time_string, "%d.%m.%Y %H:%M:%S") + timestamp = "%s %s" % (date_string, time_string) + self.ssp.cur.meta.utc_time = dt.datetime.strptime(timestamp, "%d.%m.%Y %H:%M:%S") - except Exception: - logger.warning("issue in retrieving the timestamp") + except Exception as e: + logger.warning("issue in retrieving the timestamp: %s" % e) # sample fields checks if not has_pressure: diff --git a/hyo2/soundspeedmanager/__init__.py b/hyo2/soundspeedmanager/__init__.py index 4010f6df..cbacf38c 100644 --- a/hyo2/soundspeedmanager/__init__.py +++ b/hyo2/soundspeedmanager/__init__.py @@ -11,7 +11,7 @@ logger.addHandler(logging.NullHandler()) name = "Sound Speed Manager" -__version__ = "2023.0.8" +__version__ = "2023.0.9" __copyright__ = "Copyright 2023 University of New Hampshire, Center for Coastal and Ocean Mapping" app_info = AppInfo() diff --git a/hyo2/soundspeedsettings/__init__.py b/hyo2/soundspeedsettings/__init__.py index d7ae7121..e11aa98e 100644 --- a/hyo2/soundspeedsettings/__init__.py +++ b/hyo2/soundspeedsettings/__init__.py @@ -11,7 +11,7 @@ logger.addHandler(logging.NullHandler()) name = "Sound Speed Settings" -__version__ = '2023.0.8' +__version__ = '2023.0.9' __copyright__ = 'Copyright 2023 University of New Hampshire, Center for Coastal and Ocean Mapping' app_info = AppInfo()