Skip to content

Commit

Permalink
Hypack profile exporter now exports to VEL Version 3 format.
Browse files Browse the repository at this point in the history
  • Loading branch information
eriffon committed Mar 18, 2024
1 parent 4e09aab commit 651827b
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions hyo2/ssm2/lib/formats/writers/hypack.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,31 @@ def _write_header(self):

header = str()

header += "FTP NEW 2\n"

# position
if not self.ssp.cur.meta.latitude or not self.ssp.cur.meta.longitude:
latitude = 0.0
longitude = 0.0
else:
latitude = self.ssp.cur.meta.latitude
longitude = self.ssp.cur.meta.longitude
while longitude > 180.0:
longitude -= 360.0

position_string = "{0:.9f} {1:.9f}".format(latitude, longitude)

# date
if self.ssp.cur.meta.utc_time:
date_string = "%s" % self.ssp.cur.meta.utc_time.strftime("%H:%M %m/%d/%Y")
else:
date_string = "%s" % datetime.datetime.now().strftime("%H:%M %m/%d/%Y")

header += "FTP NEW 3 " + position_string + " " + date_string + "\r\n"

self.fod.io.write(header)

def _write_body(self):
# logger.debug('generating body')
vi = self.ssp.cur.proc_valid
for idx in range(np.sum(vi)):
self.fod.io.write("%.1f %.1f\n"
self.fod.io.write("%.2f %.2f\r\n"
% (self.ssp.cur.proc.depth[vi][idx], self.ssp.cur.proc.speed[vi][idx],))

0 comments on commit 651827b

Please sign in to comment.