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
50da18b2
Commit
50da18b2
authored
9 years ago
by
Bruce Flynn
Browse files
Options
Downloads
Plain Diff
Release 0.4.1
parents
fea85eab
01fc7dcc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
edosl0util/stream.py
+4
-7
4 additions, 7 deletions
edosl0util/stream.py
edosl0util/trunc.py
+2
-1
2 additions, 1 deletion
edosl0util/trunc.py
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
7 additions
and
9 deletions
edosl0util/stream.py
+
4
−
7
View file @
50da18b2
...
@@ -31,10 +31,9 @@ class PacketTooShort(Error):
...
@@ -31,10 +31,9 @@ class PacketTooShort(Error):
After this error occurs the stream is no longer usable because data offsets
After this error occurs the stream is no longer usable because data offsets
are no longer reliable.
are no longer reliable.
"""
"""
def
__init__
(
self
,
header
=
None
,
offset
=
None
):
def
__init__
(
self
,
header
=
None
):
self
.
offset
=
offset
self
.
primary_header
=
header
self
.
primary_header
=
header
self
.
args
=
(
self
.
offset
,
self
.
primary_header
)
self
.
args
=
(
self
.
primary_header
,
)
class
NonConsecutiveSeqId
(
Error
):
class
NonConsecutiveSeqId
(
Error
):
...
@@ -49,7 +48,6 @@ class SimpleStream(object):
...
@@ -49,7 +48,6 @@ class SimpleStream(object):
"""
"""
def
__init__
(
self
,
fobj
):
def
__init__
(
self
,
fobj
):
self
.
fobj
=
fobj
self
.
fobj
=
fobj
self
.
offset
=
fobj
.
tell
()
def
__iter__
(
self
):
def
__iter__
(
self
):
return
self
return
self
...
@@ -63,14 +61,13 @@ class SimpleStream(object):
...
@@ -63,14 +61,13 @@ class SimpleStream(object):
if
not
buf
:
if
not
buf
:
raise
StopIteration
()
raise
StopIteration
()
if
len
(
buf
)
<
psize
:
if
len
(
buf
)
<
psize
:
raise
PacketTooShort
(
header
=
None
,
offset
=
self
.
offset
)
raise
PacketTooShort
(
header
=
None
)
h1
=
PrimaryHeader
.
from_buffer_copy
(
buf
)
h1
=
PrimaryHeader
.
from_buffer_copy
(
buf
)
# read user data
# read user data
size
=
h1
.
data_length_minus1
+
1
size
=
h1
.
data_length_minus1
+
1
buf
=
self
.
fobj
.
read
(
size
)
buf
=
self
.
fobj
.
read
(
size
)
if
len
(
buf
)
<
size
:
if
len
(
buf
)
<
size
:
raise
PacketTooShort
(
header
=
h1
,
offset
=
self
.
offset
)
raise
PacketTooShort
(
header
=
h1
)
self
.
offset
+=
(
psize
+
size
)
return
h1
,
buf
return
h1
,
buf
...
...
This diff is collapsed.
Click to expand it.
edosl0util/trunc.py
+
2
−
1
View file @
50da18b2
...
@@ -6,7 +6,8 @@ from edosl0util.stream import PacketStream
...
@@ -6,7 +6,8 @@ from edosl0util.stream import PacketStream
def
trunc_stream
(
stream
,
start
,
end
):
def
trunc_stream
(
stream
,
start
,
end
):
stream
.
seek
(
start
)
stream
.
seek_to
(
start
)
stream
.
seek_to_next_stamp
()
pkt
=
stream
.
next
()
pkt
=
stream
.
next
()
while
pkt
.
stamp
<=
end
:
while
pkt
.
stamp
<=
end
:
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
50da18b2
...
@@ -5,7 +5,7 @@ setup(
...
@@ -5,7 +5,7 @@ setup(
author
=
'
Bruce Flynn
'
,
author
=
'
Bruce Flynn
'
,
author_email
=
'
brucef@ssec.wisc.edu
'
,
author_email
=
'
brucef@ssec.wisc.edu
'
,
description
=
'
Utilities for working with EDOS L0 PDS files
'
,
description
=
'
Utilities for working with EDOS L0 PDS files
'
,
version
=
'
0.4
'
,
version
=
'
0.4
.1
'
,
zip_safe
=
False
,
zip_safe
=
False
,
packages
=
find_packages
(),
packages
=
find_packages
(),
install_requires
=
[
install_requires
=
[
...
...
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