Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AossTower
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
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
MetObs
AossTower
Commits
a93d604f
Commit
a93d604f
authored
10 years ago
by
Bruce Flynn
Browse files
Options
Downloads
Patches
Plain Diff
Not needed
parent
810f3f13
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
scripts/write_data.py
+0
-52
0 additions, 52 deletions
scripts/write_data.py
with
0 additions
and
52 deletions
scripts/write_data.py
deleted
100755 → 0
+
0
−
52
View file @
810f3f13
#!/usr/bin/env python
import
argparse
from
datetime
import
datetime
,
timedelta
from
aosstower.model
import
RrdModel
averages
=
{
3
:
60
,
6
:
60
,
12
:
300
,
18
:
300
,
24
:
300
}
def
main
(
db
,
outfile
,
vars
,
hours
):
model
=
RrdModel
(
db
)
average
=
averages
[
hours
]
start
=
datetime
(
2013
,
4
,
1
)
end
=
start
+
timedelta
(
hours
=
hours
)
data
=
model
.
get_slice
(
start
,
end
,
names
=
vars
,
average
=
average
)
fptr
=
open
(
outfile
,
'
wt
'
)
fptr
.
write
(
'
Time,
'
+
'
,
'
.
join
(
vars
)
+
'
\n
'
)
for
row
in
data
:
dt
=
datetime
.
utcfromtimestamp
(
row
[
0
])
fptr
.
write
(
dt
.
strftime
(
'
%Y/%m/%d %H:%M:%S
'
))
for
val
in
row
[
1
:]:
if
val
is
None
:
fptr
.
write
(
'
,NaN
'
)
else
:
fptr
.
write
(
'
,{}
'
.
format
(
val
))
fptr
.
write
(
'
\n
'
)
if
__name__
==
'
__main__
'
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
hours
'
,
type
=
int
,
default
=
3
,
choices
=
[
3
,
6
,
12
,
18
,
24
])
parser
.
add_argument
(
'
db
'
)
parser
.
add_argument
(
'
outfile
'
)
parser
.
add_argument
(
'
var
'
,
nargs
=
'
+
'
)
args
=
parser
.
parse_args
()
print
args
.
var
main
(
args
.
db
,
args
.
outfile
,
args
.
var
,
args
.
hours
)
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