Skip to content

Commit

Permalink
Removed all parsing of BSH custom header, including position informat…
Browse files Browse the repository at this point in the history
…ion.
  • Loading branch information
eriffon committed Oct 9, 2023
1 parent 4782803 commit 801f19e
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions hyo2/soundspeed/formats/readers/sea_and_sun.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def read(self, data_path, settings, callbacks=CliCallbacks(), progress=None):
return True

def _parse_header(self):
"""Parsing header: field header, filename, time, latitude, longitude, probe type, serial number"""
"""Parsing header: field header, filename, time, probe type, serial number"""
logger.debug('parsing header')

# control flags
Expand Down Expand Up @@ -94,39 +94,6 @@ def _parse_header(self):
logger.info("Fail to interpret date from German: %s" % e)
date_string = None

elif line_idx == 9: # latitude and longitude
try:
lat_str = line[21:34]
lat_tokens = lat_str.split()
# logger.debug("lat: %s" % (lat_tokens,))
lat_deg = int(lat_tokens[0].split('\xb0')[0])
lat_min = float(lat_tokens[1].split('\'')[0])
if lat_tokens[2] == "S":
lat_sign = -1.0
else:
lat_sign = 1.0

self.ssp.cur.meta.latitude = lat_sign * (lat_deg + lat_min / 60.0)

except Exception as e:
logger.warning("unable to retrieve latitude from %s, %s" % (line, e))

try:
lon_str = line[47:60]
lon_tokens = lon_str.split()
# logger.debug("lon: %s" % (lon_tokens,))
lon_deg = int(lon_tokens[0].split('\xb0')[0])
lon_min = float(lon_tokens[1].split('\'')[0])
if lon_tokens[2] == "W":
lon_sign = -1.0
else:
lon_sign = 1.0

self.ssp.cur.meta.longitude = lon_sign * (lon_deg + lon_min / 60.0)

except Exception as e:
logger.warning("unable to retrieve longitude from %s, %s" % (line, e))

elif line_idx == 17: # probe type and serial number
if line[:len(self.tk_serial)] == self.tk_serial:
try:
Expand Down

0 comments on commit 801f19e

Please sign in to comment.