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
73d54093
Commit
73d54093
authored
9 years ago
by
Bruce Flynn
Browse files
Options
Downloads
Patches
Plain Diff
Tool for generic PDS info
parent
46184797
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
edosl0util/cli.py
+30
-2
30 additions, 2 deletions
edosl0util/cli.py
edosl0util/jpssrdr.py
+2
-1
2 additions, 1 deletion
edosl0util/jpssrdr.py
setup.py
+1
-0
1 addition, 0 deletions
setup.py
with
33 additions
and
3 deletions
edosl0util/cli.py
+
30
−
2
View file @
73d54093
...
@@ -3,8 +3,9 @@ Console script entry points for CLI tools.
...
@@ -3,8 +3,9 @@ Console script entry points for CLI tools.
"""
"""
import
os
import
os
from
datetime
import
datetime
from
datetime
import
datetime
from
collections
import
defaultdict
from
edosl0util
import
split
,
trunc
from
edosl0util
import
split
,
trunc
,
stream
def
_timestamp
(
v
):
def
_timestamp
(
v
):
...
@@ -28,10 +29,37 @@ def cmd_trunc():
...
@@ -28,10 +29,37 @@ def cmd_trunc():
def
cmd_split
():
def
cmd_split
():
from
argparse
import
ArgumentParser
from
argparse
import
ArgumentParser
parser
=
ArgumentParser
(
description
=
split
.
__doc__
)
parser
=
ArgumentParser
()
parser
.
add_argument
(
'
--minutes
'
,
type
=
int
,
default
=
6
)
parser
.
add_argument
(
'
--minutes
'
,
type
=
int
,
default
=
6
)
parser
.
add_argument
(
'
filepath
'
)
parser
.
add_argument
(
'
filepath
'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
for
stamp
,
fpath
in
split
.
split_file
(
args
.
filepath
,
args
.
minutes
,
os
.
getcwd
()):
for
stamp
,
fpath
in
split
.
split_file
(
args
.
filepath
,
args
.
minutes
,
os
.
getcwd
()):
print
(
'
wrote bucket {} to {}
'
.
format
(
stamp
.
isoformat
(),
fpath
))
print
(
'
wrote bucket {} to {}
'
.
format
(
stamp
.
isoformat
(),
fpath
))
def
cmd_info
():
from
argparse
import
ArgumentParser
parser
=
ArgumentParser
(
description
=
split
.
__doc__
)
parser
.
add_argument
(
'
filepath
'
)
args
=
parser
.
parse_args
()
packets
=
stream
.
PacketStream
(
open
(
args
.
filepath
))
first
=
datetime
(
2016
,
1
,
1
)
last
=
datetime
(
2000
,
1
,
1
)
apids
=
defaultdict
(
lambda
:
{
'
count
'
:
0
})
for
p
in
packets
:
if
p
.
stamp
:
first
=
min
(
first
,
p
.
stamp
)
last
=
max
(
last
,
p
.
stamp
)
apids
[
p
.
apid
][
'
count
'
]
+=
1
print
"
First:
"
,
first
print
"
Last:
"
,
last
total
=
0
for
apid
in
sorted
(
apids
):
count
=
apids
[
apid
][
'
count
'
]
total
+=
count
print
"
{}: {}
"
.
format
(
apid
,
count
)
print
"
{} total packets
"
.
format
(
total
)
This diff is collapsed.
Click to expand it.
edosl0util/jpssrdr.py
+
2
−
1
View file @
73d54093
...
@@ -219,16 +219,17 @@ def convert_to_nasa_l0(sensor, filename, skipfill=False):
...
@@ -219,16 +219,17 @@ def convert_to_nasa_l0(sensor, filename, skipfill=False):
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
import
argparse
import
argparse
from
datetime
import
datetime
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
-v
'
,
action
=
'
store_true
'
)
parser
.
add_argument
(
'
-v
'
,
action
=
'
store_true
'
)
parser
.
add_argument
(
'
-o
'
,
'
--output
'
)
parser
.
add_argument
(
'
-o
'
,
'
--output
'
)
parser
.
add_argument
(
'
-f
'
,
'
--skipfill
'
,
action
=
'
store_true
'
)
parser
.
add_argument
(
'
-f
'
,
'
--skipfill
'
,
action
=
'
store_true
'
)
"""
def interval(val):
def interval(val):
fmt =
'
%Y-%m-%d %H:%M:%S
'
fmt =
'
%Y-%m-%d %H:%M:%S
'
start, end = val.split(
'
,
'
)
start, end = val.split(
'
,
'
)
return datetime.strptime(start, fmt), datetime.strptime(end, fmt)
return datetime.strptime(start, fmt), datetime.strptime(end, fmt)
parser.add_argument(
'
-t
'
,
'
--trunc
'
, type=interval)
parser.add_argument(
'
-t
'
,
'
--trunc
'
, type=interval)
"""
parser
.
add_argument
(
'
sensor
'
,
choices
=
(
'
viirs
'
,
'
atms
'
,
'
cris
'
))
parser
.
add_argument
(
'
sensor
'
,
choices
=
(
'
viirs
'
,
'
atms
'
,
'
cris
'
))
parser
.
add_argument
(
'
rdr
'
)
parser
.
add_argument
(
'
rdr
'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
0
View file @
73d54093
...
@@ -17,5 +17,6 @@ setup(
...
@@ -17,5 +17,6 @@ setup(
[console_scripts]
[console_scripts]
edosl0split = edosl0util.cli:cmd_split
edosl0split = edosl0util.cli:cmd_split
edosl0trunc = edosl0util.cli:cmd_trunc
edosl0trunc = edosl0util.cli:cmd_trunc
edosl0info = edosl0util.cli:cmd_info
"""
"""
)
)
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