print "Name is", Name
print "Algorithm is", Algorithm
+# Create Assimilation study
+from daYacsIntegration.daStudy import *
+assim_study = daStudy(Name, Algorithm)
# Data
print "Data entered are:"
else:
print "Background is", Background
print "BackgroundType is", BackgroundType
+ assim_study.setBackgroundType(BackgroundType)
+ assim_study.setBackground(Background)
# BackgroundError
try:
else:
print "BackgroundError is", BackgroundError
print "BackgroundErrorType is", BackgroundErrorType
+ assim_study.setBackgroundError(BackgroundError)
# Observation
try:
else:
print "Observation is", Observation
print "ObservationType is", ObservationType
+ assim_study.setObservationType(ObservationType)
+ assim_study.setObservation(Observation)
# ObservationError
try:
else:
print "ObservationError is", ObservationError
print "ObservationErrorType is", ObservationErrorType
+ assim_study.setObservationError(ObservationError)
# ObservationOperator
try:
else:
print "ObservationOperator is", ObservationOperator
print "ObservationOperatorType is", ObservationOperatorType
+ assim_study.setObservationOperatorType(ObservationOperatorType)
+ assim_study.setObservationOperator(ObservationOperator)
-from daYacsIntegration.daStudy import *
-assim_study = daStudy(Name, Algorithm)
]]>
</code></script>
from daCore.AssimilationStudy import AssimilationStudy
+class daError(Exception):
+ def __init__(self, value):
+ self.value = value
+ def __str__(self):
+ return repr(self.value)
+
class daStudy:
def __init__(self, name, algorithm):
self.ADD.setControls()
self.ADD.setAlgorithm(choice="Blue")
- def getAssimilationStudy():
+ def getAssimilationStudy(self):
+
return self.ADD
+
+ # Methods to initialize AssimilationStudy
+
+ def setBackgroundType(self, Type):
+
+ if Type == "Vector":
+ self.BackgroundType = Type
+ else:
+ raise daError("[daStudy::setBackgroundType] Type is unkown : " + Type + " Types are : Vector")
+
+ def setBackground(self, Background):
+
+ try:
+ self.BackgroundType
+ except AttributeError:
+ raise daError("[daStudy::setBackground] Type is not defined !")
+
+ if self.BackgroundType == "Vector":
+ self.ADD.setBackground(asVector = Background)
+
+ def setBackgroundError(self, BackgroundError):
+
+ self.ADD.setBackgroundError(asCovariance = BackgroundError)
+
+ def setObservationType(self, Type):
+
+ if Type == "Vector":
+ self.ObservationType = Type
+ else:
+ raise daError("[daStudy::setObservationType] Type is unkown : " + Type + " Types are : Vector")
+
+ def setObservation(self, Observation):
+
+ try:
+ self.ObservationType
+ except AttributeError:
+ raise daError("[daStudy::setObservation] Type is not defined !")
+
+ if self.ObservationType == "Vector":
+ self.ADD.setObservation(asVector = Observation)
+
+ def setObservationError(self, ObservationError):
+
+ self.ADD.setObservationError(asCovariance = ObservationError)
+
+ def setObservationOperatorType(self, Type):
+
+ if Type == "Matrix":
+ self.ObservationOperatorType = Type
+ else:
+ raise daError("[daStudy::setObservationOperatorType] Type is unkown : " + Type + " Types are : Matrix")
+
+ def setObservationOperator(self, ObservationOperator):
+
+ try:
+ self.ObservationOperatorType
+ except AttributeError:
+ raise daError("[daStudy::setObservationOperator] Type is not defined !")
+
+ if self.ObservationOperatorType == "Matrix":
+ self.ADD.setObservationOperator(asMatrix = ObservationOperator)
+
study_config["Name"] = "test000_Blue"
study_config["Algorithm"] = "Blue"
-
Background_config = {}
Background_config["Data"] = "0,1,2"
Background_config["Type"] = "Vector"
BackgroundError_config["From"] = "string"
study_config["BackgroundError"] = BackgroundError_config
-
Observation_config = {}
Observation_config["Data"] = "0.5,1.5,2.5"
Observation_config["Type"] = "Vector"
Observation_config["From"] = "string"
study_config["Observation"] = Observation_config
-
ObservationError_config = {}
ObservationError_config["Data"] = "1 0 0;0 1 0;0 0 1"
ObservationError_config["Type"] = "Matrix"