Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EdosL0Util
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SIPS
EdosL0Util
Commits
b2765473
Commit
b2765473
authored
9 years ago
by
Bruce Flynn
Browse files
Options
Downloads
Patches
Plain Diff
Use rec_type in split file names
parent
903fa9a4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
edosl0util/split.py
+16
-1
16 additions, 1 deletion
edosl0util/split.py
with
16 additions
and
1 deletion
edosl0util/split.py
+
16
−
1
View file @
b2765473
...
...
@@ -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
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment