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
c86d221b
Commit
c86d221b
authored
7 years ago
by
Greg Quinn
Browse files
Options
Downloads
Patches
Plain Diff
Refactor rdrgen tests
parent
d154f2c4
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
tests/test_rdrgen.py
+31
-24
31 additions, 24 deletions
tests/test_rdrgen.py
with
31 additions
and
24 deletions
tests/test_rdrgen.py
+
31
−
24
View file @
c86d221b
from
datetime
import
datetime
import
os
import
os
import
subprocess
import
subprocess
from
StringIO
import
StringIO
from
StringIO
import
StringIO
from
datetime
import
datetime
import
h5py
import
h5py
...
@@ -9,30 +9,9 @@ import edosl0util.rdrgen as m
...
@@ -9,30 +9,9 @@ import edosl0util.rdrgen as m
from
edosl0util.jpssrdr
import
decode_rdr_blob
from
edosl0util.jpssrdr
import
decode_rdr_blob
from
edosl0util.stream
import
jpss_packet_stream
from
edosl0util.stream
import
jpss_packet_stream
snpp_base_time
=
1698019234000000
# from CDFCB vol I "Time of First Ascending Node" table
cris_gran_len
=
31997000
def
test_calc_iet_granule
():
run
=
lambda
t
:
m
.
calc_iet_granule
(
snpp_base_time
,
cris_gran_len
,
t
)
gran
=
1880240293174000
prev_gran
=
1880240261177000
next_gran
=
1880240325171000
assert
run
(
gran
)
==
gran
assert
run
(
gran
+
1
)
==
gran
assert
run
(
gran
-
1
)
==
prev_gran
assert
run
(
gran
+
cris_gran_len
)
==
next_gran
def
test_calc_iet_aggregate
():
class
TestViirsGroupedPacketTimeTracker
(
object
):
grans_per_aggr
=
15
pass
run
=
lambda
t
:
m
.
calc_iet_aggregate
(
snpp_base_time
,
cris_gran_len
,
grans_per_aggr
,
t
)
aggr
=
1880240037198000
aggr_len
=
grans_per_aggr
*
cris_gran_len
assert
run
(
aggr
-
1
)
==
aggr
-
aggr_len
assert
run
(
aggr
)
==
aggr
assert
run
(
aggr
+
aggr_len
-
1
)
==
aggr
assert
run
(
aggr
+
aggr_len
)
==
aggr
+
aggr_len
def
test_can_reproduce_rdr_from_class
():
def
test_can_reproduce_rdr_from_class
():
...
@@ -68,3 +47,31 @@ def test_can_reproduce_rdr_from_class():
...
@@ -68,3 +47,31 @@ def test_can_reproduce_rdr_from_class():
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
assert
p
.
communicate
()[
0
]
==
''
assert
p
.
communicate
()[
0
]
==
''
assert
p
.
returncode
==
0
assert
p
.
returncode
==
0
class
TestGranulation
(
object
):
def
test_calc_iet_granule
(
self
):
def
run
(
t
):
return
m
.
calc_iet_granule
(
self
.
snpp_base_time
,
self
.
cris_gran_len
,
t
)
gran
=
1880240293174000
prev_gran
=
1880240261177000
next_gran
=
1880240325171000
assert
run
(
gran
)
==
gran
assert
run
(
gran
+
1
)
==
gran
assert
run
(
gran
-
1
)
==
prev_gran
assert
run
(
gran
+
self
.
cris_gran_len
)
==
next_gran
def
test_calc_iet_aggregate
(
self
):
grans_per_aggr
=
15
def
run
(
t
):
return
m
.
calc_iet_aggregate
(
self
.
snpp_base_time
,
self
.
cris_gran_len
,
grans_per_aggr
,
t
)
aggr
=
1880240037198000
aggr_len
=
grans_per_aggr
*
self
.
cris_gran_len
assert
run
(
aggr
-
1
)
==
aggr
-
aggr_len
assert
run
(
aggr
)
==
aggr
assert
run
(
aggr
+
aggr_len
-
1
)
==
aggr
assert
run
(
aggr
+
aggr_len
)
==
aggr
+
aggr_len
snpp_base_time
=
1698019234000000
# CDFCB vol I "Time of First Ascending Node" table
cris_gran_len
=
31997000
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