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
642ba4b4
Commit
642ba4b4
authored
7 years ago
by
Bruce Flynn
Browse files
Options
Downloads
Patches
Plain Diff
fix issues related to new timecode code
parent
80af8eaf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
edosl0util/crgen.py
+4
-3
4 additions, 3 deletions
edosl0util/crgen.py
edosl0util/merge.py
+4
-1
4 additions, 1 deletion
edosl0util/merge.py
edosl0util/stream.py
+1
-1
1 addition, 1 deletion
edosl0util/stream.py
edosl0util/timecode.py
+8
-0
8 additions, 0 deletions
edosl0util/timecode.py
with
17 additions
and
5 deletions
edosl0util/crgen.py
+
4
−
3
View file @
642ba4b4
...
@@ -11,6 +11,7 @@ import pprint
...
@@ -11,6 +11,7 @@ import pprint
import
edosl0util.crio
as
crio
import
edosl0util.crio
as
crio
from
edosl0util.headers
import
DaySegmentedTimecode
from
edosl0util.headers
import
DaySegmentedTimecode
from
edosl0util.stream
import
jpss_packet_stream
from
edosl0util.stream
import
jpss_packet_stream
from
edosl0util.timecode
import
dt_to_cds
def
diff_crs
(
real_file
,
generated_file
):
def
diff_crs
(
real_file
,
generated_file
):
...
@@ -115,7 +116,7 @@ def pds_id_from_path(pds_file):
...
@@ -115,7 +116,7 @@ def pds_id_from_path(pds_file):
def
get_pds_creation_time
(
pds_file_or_id
):
def
get_pds_creation_time
(
pds_file_or_id
):
"""
Parse 11-char creation time out of a PDS ID or file name; return a DaySegmentedTimecode
"""
"""
Parse 11-char creation time out of a PDS ID or file name; return a DaySegmentedTimecode
"""
pds_file_or_id
=
os
.
path
.
basename
(
pds_file_or_id
)
pds_file_or_id
=
os
.
path
.
basename
(
pds_file_or_id
)
return
create_timecode
(
datetime
.
strptime
(
pds_file_or_id
[
22
:
33
],
'
%y%j%H%M%S
'
))
return
create_timecode
(
dt_to_cds
(
datetime
.
strptime
(
pds_file_or_id
[
22
:
33
],
'
%y%j%H%M%S
'
))
)
def
build_apid_info
(
scan_apid_info
):
def
build_apid_info
(
scan_apid_info
):
...
@@ -189,7 +190,7 @@ def scan_packets(pds_file, prev_pds_file=None):
...
@@ -189,7 +190,7 @@ def scan_packets(pds_file, prev_pds_file=None):
if
pkt
.
cds_timecode
:
if
pkt
.
cds_timecode
:
if
not
first_pkt_time
:
if
not
first_pkt_time
:
first_pkt_time
=
pkt
.
cds_timecode
first_pkt_time
=
pkt
.
cds_timecode
last_pkt_time
=
pkt
.
cds_time
m
code
last_pkt_time
=
pkt
.
cds_timecode
return
{
'
first_packet_time
'
:
create_timecode
(
first_pkt_time
),
return
{
'
first_packet_time
'
:
create_timecode
(
first_pkt_time
),
'
last_packet_time
'
:
create_timecode
(
last_pkt_time
),
'
last_packet_time
'
:
create_timecode
(
last_pkt_time
),
'
apid_info
'
:
[
apid_map
[
k
]
for
k
in
sorted
(
apid_map
)]}
'
apid_info
'
:
[
apid_map
[
k
]
for
k
in
sorted
(
apid_map
)]}
...
@@ -241,7 +242,7 @@ def create_timecode(tc):
...
@@ -241,7 +242,7 @@ def create_timecode(tc):
Handles input of None by returning epoch value of 1958-01-01.
Handles input of None by returning epoch value of 1958-01-01.
"""
"""
return
DaySegmentedTimecode
(
tc
.
days
,
tc
.
millis
,
tc
.
micros
)
if
tc
else
DaySegmentedTimecode
()
return
DaySegmentedTimecode
(
*
tc
)
if
tc
else
DaySegmentedTimecode
()
idps_epoch
=
datetime
(
1958
,
1
,
1
)
idps_epoch
=
datetime
(
1958
,
1
,
1
)
...
...
This diff is collapsed.
Click to expand it.
edosl0util/merge.py
+
4
−
1
View file @
642ba4b4
...
@@ -95,11 +95,14 @@ def read_packet_index(stream):
...
@@ -95,11 +95,14 @@ def read_packet_index(stream):
def
_sort_by_time_apid
(
index
,
order
=
None
):
def
_sort_by_time_apid
(
index
,
order
=
None
):
"""
Sort pointers by time and apid in-place.
"""
if
order
:
if
order
:
index
=
sorted
(
index
,
key
=
lambda
p
:
order
.
index
(
p
.
apid
)
if
p
.
apid
in
order
else
-
1
)
index
=
sorted
(
index
,
key
=
lambda
p
:
order
.
index
(
p
.
apid
)
if
p
.
apid
in
order
else
-
1
)
else
:
else
:
index
=
sorted
(
index
,
key
=
lambda
p
:
p
.
apid
)
index
=
sorted
(
index
,
key
=
lambda
p
:
p
.
apid
)
return
sorted
(
index
,
key
=
lambda
p
:
p
.
cds_
timecode
)
return
sorted
(
index
,
key
=
lambda
p
:
p
.
timecode
)
def
_filter_duplicates_by_size
(
index
):
def
_filter_duplicates_by_size
(
index
):
...
...
This diff is collapsed.
Click to expand it.
edosl0util/stream.py
+
1
−
1
View file @
642ba4b4
...
@@ -124,7 +124,7 @@ class Packet(object):
...
@@ -124,7 +124,7 @@ class Packet(object):
return
(
return
(
self
.
secondary_header
and
self
.
secondary_header
and
hasattr
(
self
.
secondary_header
,
'
timecode
'
)
and
hasattr
(
self
.
secondary_header
,
'
timecode
'
)
and
self
.
secondary_header
.
day_segmented_timecode
()
or
None
)
self
.
secondary_header
.
timecode
.
day_segmented_timecode
()
or
None
)
@property
@property
def
stamp
(
self
):
def
stamp
(
self
):
...
...
This diff is collapsed.
Click to expand it.
edosl0util/timecode.py
+
8
−
0
View file @
642ba4b4
...
@@ -48,4 +48,12 @@ def cds_to_dt(days, ms, us):
...
@@ -48,4 +48,12 @@ def cds_to_dt(days, ms, us):
return
timecode_parts_to_dt
(
days
,
ms
,
us
,
CDS_EPOCH
)
return
timecode_parts_to_dt
(
days
,
ms
,
us
,
CDS_EPOCH
)
def
dt_to_cds
(
dt
):
"""
UTC datetime to (day, millis, micros)
"""
d
=
(
dt
-
CDS_EPOCH
)
return
(
d
.
days
,
int
(
d
.
seconds
*
1e3
),
d
.
microseconds
)
iet_to_dt
=
_grain
.
iet2utc
iet_to_dt
=
_grain
.
iet2utc
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