Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Grid ADASMELIAE
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
Models
GRID
Grid ADASMELIAE
Commits
1a186793
Commit
1a186793
authored
5 months ago
by
Lene Wasskog
Browse files
Options
Downloads
Patches
Plain Diff
feat: Ensure model is not run after model period end
parent
11217d46
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
ADASMELIAE.py
+14
-4
14 additions, 4 deletions
ADASMELIAE.py
with
14 additions
and
4 deletions
ADASMELIAE.py
+
14
−
4
View file @
1a186793
...
...
@@ -165,14 +165,24 @@ if __name__ == "__main__":
start_date
=
model_start_date
end_date
=
today
+
timedelta
(
days
=
2
)
if
start_date
>
end_date
:
logging
.
error
(
"
Model period not started. Quit
.
"
)
sys
.
exit
(
)
logging
.
info
(
f
"
Model start date
{
model_start_date
}
. Model end date
{
model_end_date
}
.
"
)
logging
.
info
(
f
"
Start running
model
{
model_id
}
for start date
{
start_date
}
and end date
{
end_date
}
"
f
"
Attempt to run
model
{
model_id
}
for start date
{
start_date
}
and end date
{
end_date
}
(today + 2 days)
"
)
# Ensure that model is not run after model run period (include 2 extra days at the end to replace forecast with reanalysed)
if
model_end_date
+
timedelta
(
days
=
2
)
<
end_date
:
logging
.
error
(
f
"
{
end_date
}
is after model period end (+ 2 days)
{
model_end_date
+
timedelta
(
days
=
2
)
}
. Quit.
"
)
sys
.
exit
()
# Ensure that model is not run before model run period
if
today
<
start_date
:
logging
.
error
(
"
Model period not started. Quit.
"
)
sys
.
exit
()
weather_data_file
=
weather_data_dir
+
today
.
strftime
(
weather_data_filename_pattern
)
max_temp_in_period_file
=
f
"
{
tmp_dir
}{
year
}
_max_temp_for_period.nc
"
unmasked_result_file
=
f
"
{
tmp_dir
}{
year
}
_unmasked_result.nc
"
...
...
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