Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flex Extract
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Flexpart
Flex Extract
Commits
ae2756e3
Commit
ae2756e3
authored
6 years ago
by
Anne Philipp
Browse files
Options
Downloads
Patches
Plain Diff
added a check for the number parameter
parent
5364d08c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/python/classes/ControlFile.py
+3
-1
3 additions, 1 deletion
source/python/classes/ControlFile.py
source/python/mods/checks.py
+40
-0
40 additions, 0 deletions
source/python/mods/checks.py
with
43 additions
and
1 deletion
source/python/classes/ControlFile.py
+
3
−
1
View file @
ae2756e3
...
@@ -58,7 +58,7 @@ from mods.checks import (check_grid, check_area, check_levels, check_purefc,
...
@@ -58,7 +58,7 @@ from mods.checks import (check_grid, check_area, check_levels, check_purefc,
check_basetime
,
check_public
,
check_acctype
,
check_basetime
,
check_public
,
check_acctype
,
check_acctime
,
check_accmaxstep
,
check_time
,
check_acctime
,
check_accmaxstep
,
check_time
,
check_logicals_type
,
check_len_type_time_step
,
check_logicals_type
,
check_len_type_time_step
,
check_addpar
,
check_job_chunk
)
check_addpar
,
check_job_chunk
,
check_number
)
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# CLASS
# CLASS
...
@@ -645,6 +645,8 @@ class ControlFile(object):
...
@@ -645,6 +645,8 @@ class ControlFile(object):
self
.
job_chunk
=
check_job_chunk
(
self
.
job_chunk
)
self
.
job_chunk
=
check_job_chunk
(
self
.
job_chunk
)
self
.
number
=
check_number
(
self
.
number
,
self
.
mailfail
)
return
return
def
to_list
(
self
):
def
to_list
(
self
):
...
...
This diff is collapsed.
Click to expand it.
source/python/mods/checks.py
+
40
−
0
View file @
ae2756e3
...
@@ -29,6 +29,7 @@ import _config
...
@@ -29,6 +29,7 @@ import _config
import
exceptions
import
exceptions
from
tools
import
my_error
,
silent_remove
from
tools
import
my_error
,
silent_remove
from
datetime
import
datetime
from
datetime
import
datetime
import
numpy
as
np
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# FUNCTIONS
# FUNCTIONS
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
...
@@ -824,3 +825,42 @@ def check_job_chunk(job_chunk):
...
@@ -824,3 +825,42 @@ def check_job_chunk(job_chunk):
pass
pass
return
job_chunk
return
job_chunk
def
check_number
(
number
,
mailfail
):
'''
Check for correct string format of ensemble member numbers.
Parameters
----------
number : str
List of ensemble member forecast runs.
mailfail : list of str
Contains all email addresses which should be notified.
It might also contain just the ecmwf user name which will trigger
mailing to the associated email address for this user.
Return
------
number : str
String with list of ensemble member forecast runs. E.g.
'
01/02/03/04
'
'''
if
'
/
'
in
number
:
numbers
=
number
.
split
(
'
/
'
)
if
'
to
'
in
number
.
lower
()
and
'
by
'
in
number
.
lower
():
number
=
'
{:0>3}
'
.
format
(
int
(
numbers
[
0
]))
+
'
/TO/
'
+
\
'
{:0>3}
'
.
format
(
int
(
numbers
[
2
]))
+
'
/BY/
'
+
\
'
{:0>3}
'
.
format
(
int
(
numbers
[
4
]))
elif
'
to
'
in
number
.
lower
()
and
'
by
'
not
in
number
.
lower
():
number
=
'
{:0>3}
'
.
format
(
int
(
numbers
[
0
]))
+
'
/TO/
'
+
\
'
{:0>3}
'
.
format
(
int
(
numbers
[
2
]))
else
:
numbers
=
[
'
{:0>3}
'
.
format
(
i
)
for
i
in
numbers
]
number
=
'
{:0>3}/
'
.
join
(
numbers
)
elif
number
.
isdigit
():
number
=
'
{:0>3}
'
.
format
(
int
(
number
))
else
:
pass
return
number
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