Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MLWorkflowInterface
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
DestinE
MLWorkflowInterface
Commits
b25473de
Commit
b25473de
authored
Mar 27, 2024
by
Sabine Schröder
Browse files
Options
Downloads
Patches
Plain Diff
activate download of MLAir plots
parent
c6db61c6
Branches
cmake_add_soversion
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pages/dashboard.py
+25
-10
25 additions, 10 deletions
src/pages/dashboard.py
with
25 additions
and
10 deletions
src/pages/dashboard.py
+
25
−
10
View file @
b25473de
...
@@ -278,10 +278,12 @@ def generate_ml_fcast_output_body(language_id, jobnr):
...
@@ -278,10 +278,12 @@ def generate_ml_fcast_output_body(language_id, jobnr):
]
]
@callback
(
@callback
(
Output
(
'
image-container-ml-output
'
,
'
children
'
),
[
Output
(
'
image-container-ml-output
'
,
'
children
'
),
Output
(
"
plot-info
"
,
"
data
"
,
allow_duplicate
=
True
)],
Input
(
'
station-dropdown-ml-output
'
,
'
value
'
),
Input
(
'
station-dropdown-ml-output
'
,
'
value
'
),
[
State
(
"
user-info
"
,
"
data
"
),
[
State
(
"
user-info
"
,
"
data
"
),
State
(
"
job-info
"
,
"
data
"
)]
State
(
"
job-info
"
,
"
data
"
)],
prevent_initial_call
=
True
)
)
def
update_mlair_image
(
selected_station
,
users_dict
,
job_dict
):
def
update_mlair_image
(
selected_station
,
users_dict
,
job_dict
):
jobid
=
json
.
loads
(
job_dict
)[
"
jobnr
"
]
jobid
=
json
.
loads
(
job_dict
)[
"
jobnr
"
]
...
@@ -290,13 +292,28 @@ def update_mlair_image(selected_station, users_dict, job_dict):
...
@@ -290,13 +292,28 @@ def update_mlair_image(selected_station, users_dict, job_dict):
language_id
=
json
.
loads
(
users_dict
)[
"
language_id
"
]
language_id
=
json
.
loads
(
users_dict
)[
"
language_id
"
]
except
:
except
:
language_id
=
0
language_id
=
0
job_props
=
get_db_job_entry
(
jobid
)
job_props
=
get_db_job_entry
(
jobid
)
station_code
,
station_label
=
selected_station
.
split
(
'
,
'
)
station_code
=
station_code
.
strip
()
plotinfo_dict
=
{}
plotinfo_dict
[
"
station
"
]
=
station_code
ispec
=
job_props
[
'
species
'
]
species
=
guitr
.
species_options
[
0
][
ispec
]
ml_species
=
guiconst
.
ml_names
[
species
]
plotinfo_dict
[
"
species
"
]
=
ml_species
plotinfo_dict
[
"
start_date
"
]
=
job_props
[
'
start_date
'
][
0
:
10
]
forecast_length
=
job_props
[
'
forecast_length
'
]
fc_length_str
=
"
{}{}{}
"
.
format
(
forecast_length
,
guitr
.
day_label
[
language_id
],
guitr
.
day_plural_label
[
language_id
]
if
forecast_length
>
1
else
""
)
plotinfo_dict
[
"
fc_length
"
]
=
fc_length_str
plotinfo_json
=
json
.
dumps
(
plotinfo_dict
)
image_path
=
plot_ml_time_series
(
selected_station
,
language_id
,
image_path
=
plot_ml_time_series
(
selected_station
,
language_id
,
ispec
=
job_props
[
'
species
'
],
ispec
=
job_props
[
'
species
'
],
start_date
=
job_props
[
'
start_date
'
],
start_date
=
job_props
[
'
start_date
'
],
forecast_length
=
job_props
[
'
forecast_length
'
])
forecast_length
=
job_props
[
'
forecast_length
'
])
image
=
html
.
Img
(
src
=
image_path
,
className
=
'
image-fit-container
'
)
image
=
html
.
Img
(
src
=
image_path
,
className
=
'
image-fit-container
'
)
return
image
return
image
,
plotinfo_json
else
:
else
:
return
None
return
None
...
@@ -1228,15 +1245,13 @@ def mlair_output_download(download_button, job_dict):
...
@@ -1228,15 +1245,13 @@ def mlair_output_download(download_button, job_dict):
prevent_initial_call
=
True
prevent_initial_call
=
True
)
)
def
mlair_plots_download
(
download_button
,
job_dict
,
plot_dict
):
def
mlair_plots_download
(
download_button
,
job_dict
,
plot_dict
):
#
jobid
= json.loads(
job
_dict)["
jobnr
"]
species
=
json
.
loads
(
plot
_dict
)[
"
species
"
]
#
s
pecies
= json.loads(
job
_dict)["
variable
"]
s
tation
=
json
.
loads
(
plot
_dict
)[
"
station
"
]
#
start_date = json.loads(
job
_dict)["start_date"]
start_date
=
json
.
loads
(
plot
_dict
)[
"
start_date
"
]
#
station
= json.loads(plot_dict)["
station
"]
fc_length
=
json
.
loads
(
plot_dict
)[
"
fc_length
"
]
# file name according to users selection
# file name according to users selection
# output_file_name = f"mlair_{ml_species}_{station_code}_{start_date}_{fc_length_str}.png"
output_file_name
=
f
"
mlair_
{
species
}
_
{
station
}
_
{
start_date
}
_
{
fc_length
}
.png
"
# just to test
output_file_name
=
"
mlair_O3_DENW067_2018-07-18_4Tage.png
"
infile
=
str
(
ASSETS_PATH
.
joinpath
(
'
mlair
'
,
output_file_name
))
infile
=
str
(
ASSETS_PATH
.
joinpath
(
'
mlair
'
,
output_file_name
))
return
dcc
.
send_file
(
return
dcc
.
send_file
(
infile
infile
...
...
...
...
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
sign in
to comment