Salome HOME
Fin de l'init de l'etude de l'assimilation
[modules/adao.git] / src / daSalome / daYacsIntegration / daStudy.py
1 #-*-coding:iso-8859-1-*-
2
3 from daCore.AssimilationStudy import AssimilationStudy
4
5 class daError(Exception):
6   def __init__(self, value):
7     self.value = value
8   def __str__(self):
9     return repr(self.value)
10
11 class daStudy:
12
13   def __init__(self, name, algorithm):
14
15     self.ADD = AssimilationStudy(name)
16     self.ADD.setControls()
17     self.ADD.setAlgorithm(choice="Blue")
18
19   def getAssimilationStudy(self):
20
21     return self.ADD
22
23   # Methods to initialize AssimilationStudy
24
25   def setBackgroundType(self, Type):
26
27     if Type == "Vector":
28       self.BackgroundType = Type
29     else:
30       raise daError("[daStudy::setBackgroundType] Type is unkown : " + Type + " Types are : Vector")
31
32   def setBackground(self, Background):
33
34     try:
35       self.BackgroundType
36     except AttributeError:
37       raise daError("[daStudy::setBackground] Type is not defined !")
38
39     if self.BackgroundType == "Vector":
40       self.ADD.setBackground(asVector = Background)
41
42   def setBackgroundError(self, BackgroundError):
43
44     self.ADD.setBackgroundError(asCovariance = BackgroundError)
45
46   def setObservationType(self, Type):
47
48     if Type == "Vector":
49       self.ObservationType = Type
50     else:
51       raise daError("[daStudy::setObservationType] Type is unkown : " + Type + " Types are : Vector")
52
53   def setObservation(self, Observation):
54
55     try:
56       self.ObservationType
57     except AttributeError:
58       raise daError("[daStudy::setObservation] Type is not defined !")
59
60     if self.ObservationType == "Vector":
61       self.ADD.setObservation(asVector = Observation)
62
63   def setObservationError(self, ObservationError):
64
65     self.ADD.setObservationError(asCovariance = ObservationError)
66
67   def setObservationOperatorType(self, Type):
68
69     if Type == "Matrix":
70       self.ObservationOperatorType = Type
71     else:
72       raise daError("[daStudy::setObservationOperatorType] Type is unkown : " + Type + " Types are : Matrix")
73
74   def setObservationOperator(self, ObservationOperator):
75
76     try:
77       self.ObservationOperatorType
78     except AttributeError:
79       raise daError("[daStudy::setObservationOperator] Type is not defined !")
80
81     if self.ObservationOperatorType == "Matrix":
82       self.ADD.setObservationOperator(asMatrix = ObservationOperator)
83