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
2d56c04d
Commit
2d56c04d
authored
Nov 27, 2018
by
Anne Philipp
Browse files
Options
Downloads
Patches
Plain Diff
automatic detection of grid and area component formats (1/1000 or normal degree format)
parent
d8785f85
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
source/python/classes/ControlFile.py
+35
-18
35 additions, 18 deletions
source/python/classes/ControlFile.py
source/python/classes/EcFlexpart.py
+5
-11
5 additions, 11 deletions
source/python/classes/EcFlexpart.py
source/python/mods/tools.py
+0
-2
0 additions, 2 deletions
source/python/mods/tools.py
with
40 additions
and
31 deletions
source/python/classes/ControlFile.py
+
35
−
18
View file @
2d56c04d
...
...
@@ -326,8 +326,8 @@ class ControlFile(object):
# check for having at least a starting date
# otherwise program is not allowed to run
if
not
self
.
start_date
:
print
(
'
start_date specified neither in command line nor
\
in CONTROL file
'
+
self
.
controlfile
)
print
(
'
start_date specified neither in command line nor
'
'
in CONTROL file
'
+
self
.
controlfile
)
print
(
'
Try
"'
+
sys
.
argv
[
0
].
split
(
'
/
'
)[
-
1
]
+
'
-h
"
to print usage information
'
)
sys
.
exit
(
1
)
...
...
@@ -365,16 +365,6 @@ class ControlFile(object):
print
(
'
Check parameter
"
LEVEL
"
or the max level of
"
LEVELIST
"
!
'
)
sys
.
exit
(
1
)
# if area was provided (only from commandline)
# decompose area into its 4 components
if
self
.
area
:
components
=
self
.
area
.
split
(
'
/
'
)
# convert float to integer coordinates
if
'
.
'
in
self
.
area
:
components
=
[
str
(
int
(
float
(
item
)
*
1000
))
for
i
,
item
in
enumerate
(
components
)]
self
.
upper
,
self
.
left
,
self
.
lower
,
self
.
right
=
components
# prepare step list if "/" signs are found
if
'
/
'
in
self
.
step
:
steps
=
self
.
step
.
split
(
'
/
'
)
...
...
@@ -385,8 +375,8 @@ class ControlFile(object):
self
.
step
=
[
'
{:0>3}
'
.
format
(
i
)
for
i
in
ilist
]
elif
'
to
'
in
self
.
step
.
lower
()
and
'
by
'
not
in
self
.
step
.
lower
():
my_error
(
self
.
mailfail
,
self
.
step
+
'
:
\n
'
+
'
if
"
to
"
is used in steps parameter,
\
please use
"
by
"
as well
'
)
'
if
"
to
"
is used in steps parameter,
'
'
please use
"
by
"
as well
'
)
else
:
self
.
step
=
steps
...
...
@@ -426,10 +416,10 @@ class ControlFile(object):
if
queue
in
_config
.
QUEUES_LIST
and
\
not
self
.
gateway
or
not
self
.
destination
or
\
not
self
.
ecuid
or
not
self
.
ecgid
:
print
(
'
\n
Environment variables GATEWAY, DESTINATION, ECUID and
\
ECGID were not set properly!
'
)
print
(
'
Please check for existence of file
"
ECMWF_ENV
"
in the
\
python directory!
'
)
print
(
'
\n
Environment variables GATEWAY, DESTINATION, ECUID and
'
'
ECGID were not set properly!
'
)
print
(
'
Please check for existence of file
"
ECMWF_ENV
"
in the
'
'
python directory!
'
)
sys
.
exit
(
1
)
if
self
.
request
!=
0
:
...
...
@@ -484,6 +474,33 @@ class ControlFile(object):
print
(
'
Use default value
"
12
"
for flux forecast!
'
)
self
.
accmaxstep
=
'
12
'
# if area was provided (only from commandline)
# decompose area into its 4 components
if
self
.
area
:
components
=
self
.
area
.
split
(
'
/
'
)
self
.
upper
,
self
.
left
,
self
.
lower
,
self
.
right
=
components
# convert grid and area components to correct format and input
if
'
N
'
in
self
.
grid
:
# Gaussian output grid
self
.
area
=
'
G
'
else
:
# check on grid format
if
float
(
self
.
grid
)
/
100.
>=
0.5
:
# grid is defined in 1/1000 degrees; old method
self
.
grid
=
'
{}/{}
'
.
format
(
float
(
self
.
grid
)
/
1000.
,
float
(
self
.
grid
)
/
1000.
)
self
.
area
=
'
{}/{}/{}/{}
'
.
format
(
float
(
self
.
upper
)
/
1000.
,
float
(
self
.
left
)
/
1000.
,
float
(
self
.
lower
)
/
1000.
,
float
(
self
.
right
)
/
1000.
)
elif
float
(
self
.
grid
)
/
100.
<
0.5
:
# grid is defined in normal degree; new method
self
.
grid
=
'
{}/{}
'
.
format
(
float
(
self
.
grid
),
float
(
self
.
grid
))
self
.
area
=
'
{}/{}/{}/{}
'
.
format
(
float
(
self
.
upper
),
float
(
self
.
left
),
float
(
self
.
lower
),
float
(
self
.
right
))
return
def
check_install_conditions
(
self
):
...
...
This diff is collapsed.
Click to expand it.
source/python/classes/EcFlexpart.py
+
5
−
11
View file @
2d56c04d
...
...
@@ -193,17 +193,8 @@ class EcFlexpart(object):
# for gaussian grid retrieval
self
.
glevelist
=
'
1/to/
'
+
c
.
level
self
.
gaussian
=
c
.
gaussian
if
'
N
'
in
c
.
grid
:
# Gaussian output grid
self
.
grid
=
c
.
grid
self
.
area
=
'
G
'
else
:
self
.
grid
=
'
{}/{}
'
.
format
(
int
(
c
.
grid
)
/
1000.
,
int
(
c
.
grid
)
/
1000.
)
self
.
area
=
'
{}/{}/{}/{}
'
.
format
(
int
(
c
.
upper
)
/
1000.
,
int
(
c
.
left
)
/
1000.
,
int
(
c
.
lower
)
/
1000.
,
int
(
c
.
right
)
/
1000.
)
self
.
area
=
c
.
area
self
.
outputfilelist
=
[]
...
...
@@ -1106,6 +1097,9 @@ class EcFlexpart(object):
my_error
(
c
.
mailfail
,
'
fort.21 is empty while parameter eta
\
is set to 1 in CONTROL file
'
)
# write out all output to log file before starting fortran programm
sys
.
stdout
.
flush
()
# Fortran program creates file fort.15 (with u,v,etadot,t,sp,q)
p
=
subprocess
.
check_call
([
os
.
path
.
join
(
c
.
exedir
,
_config
.
FORTRAN_EXECUTABLE
)],
shell
=
True
)
...
...
This diff is collapsed.
Click to expand it.
source/python/mods/tools.py
+
0
−
2
View file @
2d56c04d
...
...
@@ -106,8 +106,6 @@ def check_filepattern(filename):
return
True
return
False
def
get_cmdline_arguments
():
'''
Decomposes the command line arguments and assigns them to variables.
Apply default values for non mentioned arguments.
...
...
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