FLEXPART Testing Environment CTBTO WO8
Main Page
Related Pages
Packages
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Pages
git
ctbto
flexpart-testing
distrotest
Distribution.py
Go to the documentation of this file.
1
# -*- coding: utf-8 -*-
2
"""
3
Created on Wed Aug 12 00:25:32 2015
4
5
@author: morton
6
7
Don Morton
8
Boreal Scientific Computing LLC, Fairbanks, Alaska, USA
9
Don.Morton@borealscicomp.com
10
"""
11
12
import
os
13
14
import
distrotest.BasicTest
as
BasicTest
15
import
distrotest.RunCase
as
RunCase
16
import
distrotest.MetCase
as
MetCase
17
18
class
Distribution
(object):
19
20
21
"""
22
Distribution() - container that stores properties of a particular FLEXPART
23
distribution test, which will contain one or more MetCase objects, which
24
will contain one or more RunCase objects, which will contain one or more
25
BasicTest objects.
26
Container includes description, path to distribution,
27
path to par_mod.f90 file, and a list of MetCase objects to be applied.
28
"""
29
30
def
__init__
(self, descr=None, distro_path=None,
31
parmod_path=
None
,
32
exec_name=
None
, met_case_list=
None
):
33
34
"""
35
descr : Description string
36
distro_path : path to source code directory
37
parmod_path : (option) Path to par_mod.f90. If no arg, uses the one
38
in the distribution
39
exec_name : name of executable
40
met_case_list : (optional) List of MetCase objects. Defaults to empty
41
list.
42
"""
43
44
if
descr:
45
self.
_description
= descr
46
47
if
distro_path:
48
if
os.path.isdir(distro_path):
49
self.
_distro_path
= distro_path
50
else
:
51
raise
Exception(
'Cannot find distro_path: '
+ distro_path)
52
else
:
53
raise
Exception(
'distro_path not defined'
)
54
55
# If parmod_path is not defined, then par_mod.f90 is assumed to be in the
56
# source distribution
57
if
parmod_path:
58
if
os.path.isfile(parmod_path):
59
self.
_parmod_path
= parmod_path
60
else
:
61
raise
Exception(
'Cannot find parmod_path: '
+ parmod_path)
62
else
:
63
self.
_parmod_path
= self.
_distro_path
+
'/par_mod.f90'
64
if
not
os.path.isfile(self.
_parmod_path
):
65
raise
Exception(
'Cannot find parmod_path in distribution: '
+ self.
_parmod_path
)
66
67
68
# Make sure all elements of met_case_list are indeed MetCase objects
69
if
met_case_list:
70
for
the_case
in
met_case_list:
71
if
not
isinstance(the_case, (
MetCase.MetCase
)):
72
raise
Exception(
'item in met_case_list not a MetCase obj'
)
73
self.
_met_case_list
= met_case_list
74
else
:
75
self.
_met_case_list
= []
76
77
78
if
exec_name:
79
self.
_exec_name
= exec_name
80
else
:
81
raise
Exception(
"No executable name provided..."
)
82
83
84
def
get_descr
(self):
85
return
self.
_description
86
87
def
get_distro_path
(self):
88
return
self.
_distro_path
89
90
def
get_parmod_path
(self):
91
return
self.
_parmod_path
92
93
def
get_exec_name
(self):
94
return
self.
_exec_name
95
96
def
get_met_case_list
(self):
97
return
self.
_met_case_list
98
distrotest.BasicTest
Definition:
BasicTest.py:1
distrotest.Distribution.Distribution._met_case_list
_met_case_list
Definition:
Distribution.py:73
distrotest.MetCase.MetCase
Definition:
MetCase.py:24
distrotest.Distribution.Distribution.get_met_case_list
def get_met_case_list
Definition:
Distribution.py:96
distrotest.Distribution.Distribution._parmod_path
_parmod_path
Definition:
Distribution.py:59
distrotest.Distribution.Distribution.get_parmod_path
def get_parmod_path
Definition:
Distribution.py:90
distrotest.Distribution.Distribution
Definition:
Distribution.py:18
distrotest.Distribution.Distribution.get_exec_name
def get_exec_name
Definition:
Distribution.py:93
distrotest.Distribution.Distribution.get_descr
def get_descr
Definition:
Distribution.py:84
distrotest.Distribution.Distribution.get_distro_path
def get_distro_path
Definition:
Distribution.py:87
distrotest.MetCase
Definition:
MetCase.py:1
distrotest.Distribution.Distribution._description
_description
Definition:
Distribution.py:45
distrotest.Distribution.Distribution._exec_name
_exec_name
Definition:
Distribution.py:79
distrotest.RunCase
Definition:
RunCase.py:1
distrotest.Distribution.Distribution.__init__
def __init__
Definition:
Distribution.py:32
distrotest.Distribution.Distribution._distro_path
_distro_path
Definition:
Distribution.py:49
Generated on Sun Mar 27 2016 01:16:01 for FLEXPART Testing Environment CTBTO WO8 by
1.8.6