Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aeri_quality_control
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
aeri
aeri_quality_control
Commits
80145c98
Commit
80145c98
authored
8 years ago
by
Coda Phillips
Browse files
Options
Downloads
Patches
Plain Diff
Finish up the interpreter
parent
75d2ebfa
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
interpret_qc.py
+52
-4
52 additions, 4 deletions
interpret_qc.py
templates/index.html
+12
-0
12 additions, 0 deletions
templates/index.html
templates/qc.html
+11
-0
11 additions, 0 deletions
templates/qc.html
with
75 additions
and
4 deletions
interpret_qc.py
+
52
−
4
View file @
80145c98
...
...
@@ -2,21 +2,64 @@ import netCDF4
import
pandas
as
pd
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
mpld3
from
aeri_tools.io.dmv.housekeeping
import
get_all_housekeeping
from
main
import
files_to_update
from
glob
import
glob
import
os
import
flask
from
flask
import
render_template
from
datetime
import
datetime
app
=
flask
.
Flask
(
__name__
)
global_ftp_dir
=
None
@app.route
(
'
/
'
)
def
index
():
ae_dirs
=
glob
(
os
.
path
.
join
(
global_ftp_dir
,
'
AE*/*.qc
'
))
ae_dirs
=
[
a
.
lstrip
(
'
/
'
)
for
a
in
ae_dirs
]
return
flask
.
render_template
(
'
index.html
'
,
ae_dirs
=
ae_dirs
)
@app.route
(
'
/qc/<path:qc_path>
'
)
def
qc_day
(
qc_path
):
qc_path
=
'
/
'
+
qc_path
cxs_path
=
qc_path
.
replace
(
'
.qc
'
,
'
B1.CXS
'
)
sum_path
=
qc_path
.
replace
(
'
.qc
'
,
'
.SUM
'
)
cxs
=
get_all_housekeeping
(
cxs_path
)
frame
=
cxs
.
combine_first
(
get_all_housekeeping
(
sum_path
))
frame
=
frame
.
combine_first
(
get_qc_frame
(
qc_path
))
plots
=
[]
for
qc_variable
in
([
'
ABBapexTemp
'
,
'
ABBtopTemp
'
,
'
ABBbottomTemp
'
,
'
HBBapexTemp
'
,
'
HBBtopTemp
'
,
'
HBBbottomTemp
'
,
'
calibrationAmbientTemp
'
]):
plot
=
plot_variable_qc
(
frame
,
qc_variable
)
if
plot
is
not
None
:
plots
.
append
(
plot
)
return
flask
.
render_template
(
'
qc.html
'
,
qc_path
=
qc_path
,
plots
=
plots
)
def
save_plot
(
filename
):
print
(
'
saving {}
'
.
format
(
filename
))
plt
.
savefig
(
filename
,
transparent
=
True
)
def
plot_variable_qc
(
frame
,
loc
,
filename
):
def
plot_variable_qc
(
frame
,
loc
,
filename
=
None
):
qc_loc
=
'
qc_
'
+
loc
if
sum
(
frame
[
qc_loc
])
>
0
:
plt
.
figure
()
fig
=
plt
.
figure
(
figsize
=
(
50
,
5
)
)
plot_outliers
(
frame
,
frame
[
qc_loc
]
==
0
,
loc
)
save_plot
(
filename
)
if
filename
is
not
None
:
save_plot
(
filename
)
else
:
return
mpld3
.
fig_to_html
(
fig
)
def
plot_outliers
(
frame
,
qc_mask
,
loc
):
if
(
~
qc_mask
).
any
():
...
...
@@ -60,8 +103,13 @@ if __name__ == '__main__':
import
argparse
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
ftp
'
)
parser
.
add_argument
(
'
--serve
'
,
action
=
'
store_true
'
)
args
=
parser
.
parse_args
()
generate_all_plots
(
args
.
ftp
)
if
not
args
.
serve
:
generate_all_plots
(
args
.
ftp
)
else
:
global_ftp_dir
=
args
.
ftp
app
.
run
(
debug
=
True
)
This diff is collapsed.
Click to expand it.
templates/index.html
0 → 100644
+
12
−
0
View file @
80145c98
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<ul>
{% for d in ae_dirs %}
<a
href=
"/qc/{{d}}"
><li>
/{{d}}
</li></a>
{% endfor %}
</ul>
</body
</html
>
This diff is collapsed.
Click to expand it.
templates/qc.html
0 → 100644
+
11
−
0
View file @
80145c98
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>
{{qc_path}}
</h1>
{% for plot in plots %}
{{plot|safe}}
{% endfor %}
</body
</html
>
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