<inport name="Study" type="pyobj"/>
<outport name="Study" type="pyobj"/>
</inline>
+
+ <inline name="SimpleUserAnalysis">
+ <script><code><![CDATA[
+#-*-coding:iso-8859-1-*-
+print "Entering in SimpleUserAnalysis"
+from daYacsIntegration.daStudy import *
+ADD = Study.getAssimilationStudy()
+# User code is below
+
+]]></code></script>
+ <inport name="Study" type="pyobj"/>
+ </inline>
</proc>
if key in AssimData:
check_data(key, study_config[key])
+ # Analyse
+ if "Analysis" in study_config.keys():
+ analysis_config = study_config["Analysis"]
+ if "From" not in analysis_config:
+ logging.fatal("Analysis found but From is not defined in the analysis configuration !")
+ sys.exit(1)
+ else:
+ if analysis_config["From"] != "string":
+ logging.fatal("Analysis From defined in the study configuration does not have a correct type : " + str(analysis_config["From"])
+ + "\n You can have : string")
+ sys.exit(1)
+ if "Data" not in analysis_config:
+ logging.fatal("Analysis found but Data is not defined in the analysis configuration !")
+ sys.exit(1)
+
+
def check_data(data_name, data_config):
logging.debug("[check_data] " + data_name)
proc.edAddDFLink(CAS_node.getOutputPort("Study"), execute_node.getInputPort("Study"))
# Step 4: create post-processing from user configuration
+ if "Analysis" in study_config.keys():
+ analysis_config = study_config["Analysis"]
+ if analysis_config["From"] == "string":
+ factory_analysis_node = catalogAd._nodeMap["SimpleUserAnalysis"]
+ analysis_node = factory_analysis_node.cloneNode("User Analysis")
+ default_script = analysis_node.getScript()
+ final_script = default_script + analysis_config["Data"]
+ analysis_node.setScript(final_script)
+ proc.edAddChild(analysis_node)
+ proc.edAddCFLink(compute_bloc, analysis_node)
+ proc.edAddDFLink(execute_node.getOutputPort("Study"), analysis_node.getInputPort("Study"))
return proc
+#-*-coding:iso-8859-1-*-
study_config = {}
study_config["Name"] = "test000_Blue"
study_config["Algorithm"] = "Blue"
ObservationOperator_config["Type"] = "Matrix"
ObservationOperator_config["From"] = "string"
study_config["ObservationOperator"] = ObservationOperator_config
+
+Analysis_config = {}
+Analysis_config["Data"] = """
+import numpy
+precision = 1.e-13
+
+Xa = ADD.get("Analysis")
+print
+print " Nombre d'analyses :",Xa.stepnumber()
+print " Analyse résultante :",Xa.valueserie(0)
+#
+# Vérification du résultat
+# ------------------------
+if max(numpy.array(Xa.valueserie(0))-numpy.array([0.25, 1.25, 2.25])) > precision:
+ raise ValueError("Résultat du test erroné")
+else:
+ print " Test correct, erreur maximale inférieure à %s"%precision
+ print
+"""
+Analysis_config["From"] = "string"
+study_config["Analysis"] = Analysis_config