Skip to content
Snippets Groups Projects
Commit b2765473 authored by Bruce Flynn's avatar Bruce Flynn
Browse files

Use rec_type in split file names

parent 903fa9a4
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,21 @@ def _replace_pdsname_stamp(filename, stamp):
return stamp.strftime(pat)
def _filename_for_splitfile(filename, stamp, minutes):
# P1570769AAAAAAAAAAAAAS15208032721001.PDS
#
# NOTE: It seems that EDOS uses the file_id column for fractional seconds.
# We just zero this out since the bucket should be on even seconds.
pat = '{}{}{}{}0{}'.format(
filename[:20],
minutes,
filename[21],
'%y%j%H%M%S',
filename[-6:]
)
return stamp.strftime(pat)
def split_file(filepath, minutes, destdir):
"""
Split a level0 PDS file into X minutes files by filename.
......@@ -73,7 +88,7 @@ def split_file(filepath, minutes, destdir):
for timestamp, offset, pkts, blob in stream:
stamp = datetime.utcfromtimestamp(timestamp)
dirname, filename = os.path.split(filepath)
newname = _replace_pdsname_stamp(filename, stamp)
newname = _filename_for_splitfile(filename, stamp, minutes)
dstpath = os.path.join(dirname, destdir, newname)
if os.path.exists(dstpath):
raise RuntimeError(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment