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
5f668a70
Commit
5f668a70
authored
9 years ago
by
Bruce Flynn
Browse files
Options
Downloads
Patches
Plain Diff
Handle empty rdr datasets
parent
8a979956
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
edosl0util/jpssrdr.py
+13
-10
13 additions, 10 deletions
edosl0util/jpssrdr.py
with
13 additions
and
10 deletions
edosl0util/jpssrdr.py
+
13
−
10
View file @
5f668a70
...
...
@@ -152,7 +152,7 @@ def _generate_packet_datasets(group):
dsnames
=
group
.
keys
()
for
name
in
_sorted_packet_dataset_names
(
dsnames
):
ds
=
group
[
name
]
yield
np
.
array
(
ds
)
yield
name
,
np
.
array
(
ds
)
def
_find_science_group
(
fobj
):
...
...
@@ -164,7 +164,10 @@ def _find_science_group(fobj):
def
_rdrs_for_packet_dataset
(
group
):
if
group
:
for
buf
in
_generate_packet_datasets
(
group
):
for
name
,
buf
in
_generate_packet_datasets
(
group
):
if
buf
.
shape
[
0
]
<
c
.
sizeof
(
StaticHeader
):
LOG
.
warn
(
'
Not enough bytes for %s static header
'
,
name
)
continue
header
=
StaticHeader
.
from_buffer
(
buf
)
apids
=
_read_apid_list
(
header
,
buf
)
yield
CommonRdr
(
buf
,
header
,
list
(
apids
))
...
...
@@ -222,21 +225,21 @@ def write_rdr_datasets(filepath, science=True, ancillary=True, skipfill=False):
rdrs
=
rdr_datasets
(
filepath
)
if
science
:
dest
=
open
(
'
{}.science.pkts
'
.
format
(
rdrname
),
'
wb
'
)
for
idx
,
rdr
in
enumerate
(
rdrs
[
'
science
'
]):
LOG
.
debug
(
'
writing science gran %d %s-%s-%s
'
,
idx
,
rdr
.
header
.
satellite
,
rdr
.
header
.
sensor
,
rdr
.
header
.
type_id
)
_write_packets
(
rdr
.
packets
(),
dest
,
skipfill
)
with
open
(
'
{}.science.pkts
'
.
format
(
rdrname
),
'
wb
'
)
as
dest
:
for
idx
,
rdr
in
enumerate
(
rdrs
[
'
science
'
]):
LOG
.
debug
(
'
writing science gran %d %s-%s-%s
'
,
idx
,
rdr
.
header
.
satellite
,
rdr
.
header
.
sensor
,
rdr
.
header
.
type_id
)
_write_packets
(
rdr
.
packets
(),
dest
,
skipfill
)
if
ancillary
:
for
idx
,
rdr
in
enumerate
(
rdrs
[
'
ancillary
'
]):
packets
=
{
a
.
value
:
rdr
.
packets_for_apid
(
a
.
value
)
for
a
in
rdr
.
apids
}
for
apid
,
packets
in
packets
.
items
():
dest
=
open
(
'
{}.anc{}.pkts
'
.
format
(
rdrname
,
apid
),
'
wb
'
)
LOG
.
debug
(
'
writing ancillary gran %d %s-%s-%s %d
'
,
idx
,
rdr
.
header
.
satellite
,
rdr
.
header
.
sensor
,
rdr
.
header
.
type_id
,
apid
.
value
)
_write_packets
(
packets
,
dest
)
with
open
(
'
{}.anc{}.pkts
'
.
format
(
rdrname
,
apid
),
'
wb
'
)
as
dest
:
_write_packets
(
packets
,
dest
)
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