),
"""
+observers_choice = """
+ ${var_name} = BLOC (condition=" '${var_name}' in set(SELECTION) ",
+ FREQUENCY = SIMP(statut = "o", typ = "TXM")
+ ),
+"""
+
+observers_method = """
+def F_Observers(statut) : return FACT(statut=statut,
+ SELECTION = SIMP(statut="o", defaut=[], typ="TXM", max="**", validators=NoRepeat(), into=(${choices})),
+${decl_choices}
+ )
+"""
+
assim_study = """
def F_variables(statut) : return FACT(statut=statut,
UserDataInit = F_Init("f"),
UserPostAnalysis = F_UserPostAnalysis("f"),
InputVariables = F_variables("f"),
- OutputVariables = F_variables("f")
+ OutputVariables = F_variables("f"),
+ Observers = F_Observers("f")
)
"""
assim_data_method = string.Template(assim_data_method)
assim_data_choice = string.Template(assim_data_choice)
assim_study = string.Template(assim_study)
+observers_method = string.Template(observers_method)
+observers_choice = string.Template(observers_choice)
#----------- End of Templates Part ---------------#
# TODO uniformiser avec le step 3
mem_file.write(init_method)
+# Step 5: Add observers
+decl_choices = ""
+for obs_var in infos.ObserversList:
+ decl_choices += observers_choice.substitute(var_name=obs_var)
+mem_file.write(observers_method.substitute(choices = infos.ObserversList,
+ decl_choices = decl_choices))
+
# Final step: Add algorithm and assim_study
algos_names = ""
decl_algos = ""
OptDict["UserPostAnalysis"] = ["String", "Script"]
OptDefaultDict = {}
OptDefaultDict["UserPostAnalysis"] = "Script"
+
+
+# Observers
+ObserversList = ["CostFunctionJ","CostFunctionJb","CostFunctionJo","GradientOfCostFunctionJ","GradientOfCostFunctionJb","GradientOfCostFunctionJo","CurrentState","Analysis","Innovation","SigmaObs2","SigmaBck2","OMA","OMB","BMA","CovarianceAPosteriori"]