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
4ad42674
Commit
4ad42674
authored
7 years ago
by
Greg Quinn
Browse files
Options
Downloads
Patches
Plain Diff
build_rdr_blob: pass in rdr_type and gran
parent
89218034
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/rdrgen.py
+6
-11
6 additions, 11 deletions
edosl0util/rdrgen.py
with
6 additions
and
11 deletions
edosl0util/rdrgen.py
+
6
−
11
View file @
4ad42674
import
ctypes
import
itertools
import
os
import
tempfile
from
collections
import
OrderedDict
...
...
@@ -32,11 +31,11 @@ def packets_to_rdrs(sat, pkt_files):
# make RDRs one granule at a time
get_jpss_packet_time
=
GetJpssPacketTime
()
for
rdr_pkt_file
in
rdr_pkt_files
.
process_files
():
for
(
rdr_type
,
gran
),
rdr_pkt_file
in
rdr_pkt_files
.
process_files
():
pkts
=
list
(
jpss_packet_stream
(
rdr_pkt_file
))
pkt_times
=
{
p
:
get_jpss_packet_time
(
p
)
for
p
in
pkts
}
pkts
.
sort
(
key
=
(
lambda
p
:
(
pkt_times
[
p
],
p
.
apid
)))
blob
=
build_rdr_blob
(
sat
,
pkts
)
blob
=
build_rdr_blob
(
sat
,
pkts
,
rdr_type
,
gran
)
write_rdr
(
sat
,
blob
)
...
...
@@ -70,9 +69,9 @@ class BinnedTemporaryFileManager(object):
self
.
_process_files_called
=
True
for
file_obj
in
self
.
_file_objs
.
values
():
file_obj
.
close
()
for
_
,
file_name
in
sorted
(
self
.
_file_paths
.
items
()):
for
bin_key
,
file_name
in
sorted
(
self
.
_file_paths
.
items
()):
file_obj
=
open
(
file_name
)
yield
file_obj
yield
bin_key
,
file_obj
file_obj
.
close
()
os
.
remove
(
file_name
)
os
.
rmdir
(
self
.
dir
)
...
...
@@ -170,12 +169,8 @@ def set_h5_attrs(h5_obj, attrs):
h5_obj
.
attrs
[
name
]
=
value
def
build_rdr_blob
(
sat
,
pkt_stream
):
pkt_stream
=
iter
(
pkt_stream
)
def
build_rdr_blob
(
sat
,
pkt_stream
,
rdr_type
,
granule_iet
):
get_jpss_packet_time
=
GetJpssPacketTime
()
first_pkt
=
next
(
pkt_stream
)
# FIXME: what if there are no packets?
rdr_type
=
get_rdr_type
(
first_pkt
.
apid
)
granule_iet
=
calc_rdr_granule
(
sat
,
rdr_type
,
get_jpss_packet_time
(
first_pkt
))
granule_iet_end
=
granule_iet
+
rdr_type
.
gran_len
total_pkt_size
=
0
...
...
@@ -190,7 +185,7 @@ def build_rdr_blob(sat, pkt_stream):
'
pkt_info
'
:
[{}
for
_
in
range
(
apid
.
max_expected
)]}
total_trackers
+=
apid
.
max_expected
for
pkt
in
itertools
.
chain
([
first_pkt
],
pkt_stream
)
:
for
pkt
in
pkt_stream
:
if
pkt
.
apid
not
in
apid_info
:
raise
ValueError
(
'
APID {} not expected for {}
'
.
format
(
pkt
.
apid
,
rdr_type
.
short_name
))
...
...
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