]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Merge remote-tracking branch '110523-JP/new_branch_name' into V6_main
authorAndré Ribes <andre.ribes@edf.fr>
Wed, 25 May 2011 08:59:21 +0000 (10:59 +0200)
committerAndré Ribes <andre.ribes@edf.fr>
Wed, 25 May 2011 08:59:21 +0000 (10:59 +0200)
41 files changed:
doc/advanced.rst
doc/examples.rst
doc/images/adao_activate.png
doc/images/adao_exporttoyacs.png
doc/images/adao_jdcexample01.png
doc/images/adao_jdcexample02.png
doc/images/adao_scriptentry01.png
doc/images/adao_scriptentry02.png
doc/images/adao_viewer.png
doc/images/yacs_containerlog.png
doc/images/yacs_generatedscheme.png
doc/index.rst
doc/intro.rst
doc/theory.rst
doc/using.rst
src/daComposant/daAlgorithms/3DVAR.py
src/daComposant/daAlgorithms/Blue.py
src/daComposant/daAlgorithms/EnsembleBlue.py
src/daComposant/daAlgorithms/Kalman.py [deleted file]
src/daComposant/daAlgorithms/KalmanFilter.py [new file with mode: 0644]
src/daComposant/daAlgorithms/LinearLeastSquares.py
src/daComposant/daAlgorithms/__init__.py
src/daComposant/daCore/AssimilationStudy.py
src/daComposant/daCore/BasicObjects.py
src/daComposant/daCore/Logging.py
src/daComposant/daCore/Persistence.py
src/daComposant/daCore/PlatformInfo.py
src/daComposant/daCore/__init__.py
src/daComposant/daCore/version.py
src/daComposant/daDiagnostics/PlotVector.py
src/daComposant/daDiagnostics/PlotVectors.py
src/daComposant/daDiagnostics/RMS.py
src/daComposant/daDiagnostics/ReduceVariance.py
src/daComposant/daDiagnostics/__init__.py
src/daSalome/daYacsSchemaCreator/infos_daComposant.py
src/examples/daSalome/test001_ADAO_JDC_using_strings.comm [new file with mode: 0644]
src/examples/daSalome/test002_ADAO_JDC_using_strings.comm [new file with mode: 0644]
src/examples/daSalome/test003_ADAO_JDC_using_scripts.comm.in [new file with mode: 0644]
src/examples/daSalome/test003_ADAO_scripts_for_JDC.py [new file with mode: 0644]
src/examples/daSalome/test004_ADAO_JDC_using_scripts.comm.in [new file with mode: 0644]
src/examples/daSalome/test004_ADAO_scripts_for_JDC.py [new file with mode: 0644]

index 8dd33bb928eca64612101d43eecf228740c5ed97..3dc9734b80b1bfa0dfdbacbabe21ee60ec9a7505 100644 (file)
@@ -1,7 +1,7 @@
 .. _section_advanced:
 
 ================================================================================
-Advanced usage of ADAO
+Advanced usage of the ADAO module
 ================================================================================
 
 This section presents advanced methods to use the ADAO module, how to get more
@@ -17,14 +17,15 @@ procedure is the following:
 
 #.      using the SALOME application including ADAO module, launch SALOME with ``./runAppli -k``
 #.      initialise the command line session with: ``./runSession``
+#.      change to the YACS calculation scheme directory to be executed
 #.      execute the export command: ``python ${ADAO_ROOT_DIR}/bin/salome/AdaoYacsSchemaCreator.py <input Python file> <output YACS xml scheme>``
 #.      standard output comes on console, successive executions can be done
-#.     stop SALOME:  ``shutdownSalome.py`` or ``killSalome.py``
+#.     stop SALOME:  ``killSalome.py``
 #.     exit from the session: ``CTRL+D``
 
-Be careful, if the output YACS xml scheme already exists, this command replace
-it without asking the user. The command accepts files with or without path
-specifications.
+Be careful, if the output YACS xml scheme file already exists, this command
+replace it without asking the user. The command accepts files with or without
+path specifications.
 
 It is not necessary to launch and shut down SALOME each time if the application
 is already running.
@@ -44,7 +45,7 @@ The way to do that is as follows:
 #.      change to the YACS calculation scheme directory to be executed
 #.      execute the YACS supervisor:  ``driver <ADAO YACS xml scheme>``
 #.      standard output comes on console, successive executions can be done
-#.     stop SALOME:  ``shutdownSalome.py`` or ``killSalome.py``
+#.     stop SALOME:  ``killSalome.py``
 #.     exit from the session: ``CTRL+D``
 
 It is not necessary to launch and shut down SALOME each time if the application
@@ -53,14 +54,26 @@ is already running.
 Getting more information when running an assimilation calculation
 --------------------------------------------------------------------------------
 
---TODO--
-
-(Use the logging functionality of the library)
-
-
-Complex time or step treatments during an assimilation calculation
---------------------------------------------------------------------------------
-
---TODO--
-
-(Scheduling input data)
+When running, the ADAO module is logging useful data and messages. There are two
+ways to obtain theses informations.
+
+The first one, and the preferred way, is to use the built-in variable "*Debug*"
+integrated in every "*ASSIMILATION_STUDY*". It is available through the GUI of
+the module. Setting it to "*1*" will send a lot of messages in the log window of
+the YACS scheme execution.
+
+The second one consist in using the "*logging*" native module of Python (see the
+Python documentation http://docs.python.org/library/logging.html for more
+informations on this module). Everywhere in the YACS scheme, mainly through the
+scripts entries, the user can set the logging level in accordance to the needs
+of detailed informations. The different logging levels are: "*DEBUG*", "*INFO*",
+"*WARNING*", "*ERROR*", "*CRITICAL*". All the informations flagged with a
+certain level will be printed for whatever activated level above this particular
+one (included). The easiest way is to change the log level is to write the
+following Python lines::
+
+    import logging
+    logging.getLogger().setLevel(logging.DEBUG)
+
+The standard logging module default level is "*WARNING*", the default level in
+the ADAO module is "*INFO*". 
index 5ac30963cdff3c7a9eef609397a8681dc8e7687b..ff31fbeb08284fe469654c4f4992de72e78759b0 100644 (file)
@@ -4,10 +4,20 @@
 Examples on using the ADAO module
 ================================================================================
 
-This section presents some examples on using the ADAO module in SALOME.
+.. |eficas_new| image:: images/eficas_new.png
+   :align: middle
+.. |eficas_save| image:: images/eficas_save.png
+   :align: middle
+.. |eficas_yacs| image:: images/eficas_yacs.png
+   :align: middle
+
+This section presents some examples on using the ADAO module in SALOME. The
+first one shows how to build a simple data assimilation case defining
+explicitly all the required data through the GUI. The second one shows, on the
+same case, how to define data using external sources through scripts.
 
 Building a simple estimation case with explicit data definition
---------------------------------------------------------------------------------
+---------------------------------------------------------------
 
 This simple example is a demonstration one, and describes how to set a BLUE
 estimation framework in order to get *weighted least square estimated state* of
@@ -26,7 +36,7 @@ state is of value 1 in each direction, so:
 
     ``Yo = [1 1 1]``
 
-The background state, wich represent some *a priori* knowledge or a
+The background state, which represent some *a priori* knowledge or a
 regularization, is of value of 0 in each direction, which is:
 
     ``Xb = [0 0 0]``
@@ -51,8 +61,8 @@ average vector between ``Yo`` and ``Xb``, named the *analysis* and denoted by
     ``Xa = [0.5 0.5 0.5]``
 
 As en extension of this example, one can change the variances for ``B`` or ``R``
-independantly, and the analysis will move to ``Yo`` or ``Xb`` in inverse
-proportion of the variances in ``B`` and ``R``. It is also equivalent to serach
+independently, and the analysis will move to ``Yo`` or ``Xb`` in inverse
+proportion of the variances in ``B`` and ``R``. It is also equivalent to search
 for the analysis thought a BLUE algorithm or a 3DVAR one.
 
 Using the GUI to build the ADAO case
@@ -64,12 +74,10 @@ button or menu of SALOME, and you will see:
   .. _adao_activate2:
   .. image:: images/adao_activate.png
     :align: center
+    :width: 100%
   .. centered::
     **Activating the module ADAO in SALOME**
 
-.. |eficas_new| image:: images/eficas_new.png
-   :align: middle
-
 Choose the "*New*" button in this window. You will directly get the EFICAS
 interface for variables definition, along with the "*Object browser*". You can
 then click on the "*New*" button |eficas_new| to create a new ADAO case, and you
@@ -101,19 +109,20 @@ looks like this:
 
 To go further, we need now to generate the YACS scheme from the ADAO case
 definition. In order to do that, right click on the name of the file case in the
-"*Object browser*" window, and choose the "*Export to YACS*" submenu as below:
+"*Object browser*" window, and choose the "*Export to YACS*" sub-menu (or the
+"*Export to YACS*" button |eficas_yacs|) as below:
 
   .. _adao_exporttoyacs:
   .. image:: images/adao_exporttoyacs.png
     :align: center
     :scale: 75%
   .. centered::
-    **"*Export to YACS*" submenu to generate the YACS scheme from the ADAO case**
+    **"Export to YACS" submenu to generate the YACS scheme from the ADAO case**
 
 This command will generate the YACS scheme, activate YACS module in SALOME, and
-open the new scheme in the YACS module GUI [#]. After reordering the nodes by
-using the "*arrange local node*" submenu of the YACS graphical view of the
-scheme, you get the following representation of the generated ADAO scheme:
+open the new scheme in the GUI of the YACS module [#]. After reordering the
+nodes by using the "*arrange local node*" sub-menu of the YACS graphical view of
+the scheme, you get the following representation of the generated ADAO scheme:
 
   .. _yacs_generatedscheme:
   .. image:: images/yacs_generatedscheme.png
@@ -124,17 +133,17 @@ scheme, you get the following representation of the generated ADAO scheme:
 
 After that point, all the modifications, executions and post-processing of the
 data assimilation scheme will be done in YACS. In order to check the result in a
-simple way, we create here a new YACS node by using the "*inline script node*"
-submenu of the YACS graphical view, and we name it "*PostProcessing*".
+simple way, we create here a new YACS node by using the "*in-line script node*"
+sub-menu of the YACS graphical view, and we name it "*PostProcessing*".
 
 This script will retrieve the data assimilation analysis from the
 "*algoResults*" output port of the computation bloc (which gives access to a
 SALOME Python Object), and will print it on the standard output. 
 
-To obtain this, the inline script node need to have an input port of type
-"*pyobj*" named "*results*", that have to be linked graphically to the
-"*algoResults*" output port of the computation bloc. Then the code to fill in
-the script node is::
+To obtain this, the in-line script node need to have an input port of type
+"*pyobj*" named "*results*" for example, that have to be linked graphically to
+the "*algoResults*" output port of the computation bloc. Then the code to fill
+in the script node is::
 
     Xa = results.ADD.get("Analysis").valueserie(-1)
 
@@ -143,10 +152,10 @@ the script node is::
     print
 
 The augmented YACS scheme can be saved (overwriting the generated scheme if the
-simple "*Save*" command or button is used, or with a new name). Then,
+simple "*Save*" command or button are used, or with a new name). Then,
 classically in YACS, it have to be prepared for run, and then executed. After
 completion, the printing on standard output is available in the "*YACS Container
-Log*", obtained throught the right click menu of the "*proc*" window in the YACS
+Log*", obtained through the right click menu of the "*proc*" window in the YACS
 scheme as shown below:
 
   .. _yacs_containerlog:
@@ -156,8 +165,8 @@ scheme as shown below:
   .. centered::
     **YACS menu for Container Log, and dialog window showing the log**
 
-We verify that the result is correct by checking that the log contains the
-following line::
+We verify that the result is correct by checking that the log dialog window
+contains the following line::
 
     Analysis = [0.5, 0.5, 0.5]
 
@@ -166,20 +175,20 @@ as shown in the image above.
 As a simple extension of this example, one can notice that the same problem
 solved with a 3DVAR algorithm gives the same result. This algorithm can be
 chosen at the ADAO case building step, before entering in YACS step. The
-ADAO 3DVAR case will look completly similar to the BLUE algoritmic case, as
+ADAO 3DVAR case will look completely similar to the BLUE algorithmic case, as
 shown by the following figure:
 
-  .. _adao_jdcexample01:
+  .. _adao_jdcexample02:
   .. image:: images/adao_jdcexample02.png
     :align: center
     :width: 100%
   .. centered::
-    **Defining an ADAO 3DVAR case looks completly similar to a BLUE case**
+    **Defining an ADAO 3DVAR case looks completely similar to a BLUE case**
 
-There is only one keyword changing, with "*ThreeDVAR*" instead of "*Blue*".
+There is only one command changing, with "*3DVAR*" value instead of "*Blue*".
 
 Building a simple estimation case with external data definition by functions
---------------------------------------------------------------------------------
+----------------------------------------------------------------------------
 
 It is useful to get parts or all of the data from external definition, using
 Python script files to provide access to the data. As an example, we build here
@@ -190,8 +199,8 @@ data form a single one external Python script file.
 First, we write the following script file, using conventional names for the
 desired variables. Here, all the input variables are defined in the script, but
 the user can choose to split the file in several ones, or to mix explicit data
-definition in the ADAO GUI and implicit data definition by external files. This
-script looks like::
+definition in the ADAO GUI and implicit data definition by external files. The
+present script looks like::
 
     #-*-coding:iso-8859-1-*-
     import numpy
@@ -222,12 +231,11 @@ functions, etc. with other names. It shows different ways to define arrays and
 matrices, using list, string (as in Numpy or Octave), Numpy array type or Numpy
 matrix type, and Numpy special functions. All of these syntaxes are valid.
 
-After saving this script somewhere in your path (named here
-"*test003_ADAO_example_scripts.py*" for the example), we use the GUI to build
-the ADAO case. The procedure to fill in the case is similar except that, instead
-of selecting the "*String*" option for the "*FROM*" keyword, we select the
-"*Script*" one. This leads to a "*SCRIPT_DATA/SCRIPT_FILE*" entry in the tree,
-allowing to choose a file as:
+After saving this script somewhere in your path (named here "*script.py*" for
+the example), we use the GUI to build the ADAO case. The procedure to fill in
+the case is similar except that, instead of selecting the "*String*" option for
+the "*FROM*" keyword, we select the "*Script*" one. This leads to a
+"*SCRIPT_DATA/SCRIPT_FILE*" entry in the tree, allowing to choose a file as:
 
   .. _adao_scriptentry01:
   .. image:: images/adao_scriptentry01.png
@@ -239,32 +247,47 @@ allowing to choose a file as:
 Other steps and results are exactly the same as in the `Building a simple
 estimation case with explicit data definition`_ previous example.
 
-In fact, this script methodology allows to retrieve data from inline or previous
+In fact, this script methodology allows to retrieve data from in-line or previous
 calculations, from static files, from database or from stream, all of them
 outside of SALOME. It allows also to modify easily some input data, for example
-debug purpose or for repetitive process. **But be careful, it is not a "safe"
-process, in the sense that erroneous data, or errors in calculations, can be
-directly injected into the YACS scheme execution.**
+for debug purpose or for repetitive execution process, and it is the most
+versatile method in order to parametrize the input data. **But be careful,
+script methodology is not a "safe" procedure, in the sense that erroneous
+data, or errors in calculations, can be directly injected into the YACS scheme
+execution.**
 
 Adding parameters to control the data assimilation algorithm
---------------------------------------------------------------------------------
+------------------------------------------------------------
 
 One can add some optional parameters to control the data assimilation algorithm
 calculation. This is done by using the "*AlgorithmParameters*" keyword in the
-definition of the ADAO case, which is an option of the algorithm. This keyword
-requires a Python dictionary containing some key/value pairs.
+definition of the ADAO case, which is an keyword of the ASSIMILATION_STUDY. This
+keyword requires a Python dictionary, containing some key/value pairs.
 
 For example, with a 3DVAR algorithm, the possible keys are "*Minimizer*",
-"*MaximumNumberOfSteps*", "*Bounds*". Bounds can be given by a list of list of
-pairs of lower/upper bounds for each variable, with possibly ``None`` every time
-there is no bound. If no bounds at all are required on the control variables,
-then one can choose the "BFGS" or "CG" minimisation algorithm for the 3DVAR
-algorithm.
-
-This dictionary has to be defined in an external Python script file, using the
-mandatory variable name "*AlgorithmParameters*" for the dictionary. All the keys
-inside the dictionary are optional, they all have default values, and can exist
-without being used. For example::
+"*MaximumNumberOfSteps*", and "*Bounds*":
+
+#.   The "*Minimizer*" key allows to choose the optimisation minimizer, the
+     default choice being "LBFGSB", and the possible ones "LBFGSB" (nonlinear
+     constrained minimizer, see [Byrd95] and [Zhu97]), "TNC" (nonlinear
+     constrained minimizer), "CG" (nonlinear unconstrained minimizer), "BFGS"
+     (nonlinear unconstrained minimizer).
+#.   The "*MaximumNumberOfSteps*" key indicates the maximum number of iterations
+     allowed for iterative optimisation. The default is 15000, which very
+     similar of no limit on iterations. It is then recommended to adapt this
+     parameter to the needs on real problems.
+#.   The "*Bounds*" key allows to define upper and lower bounds for every
+     control variable being optimized. Bounds can be given by a list of list of
+     pairs of lower/upper bounds for each variable, with possibly ``None`` every
+     time there is no bound.
+
+If no bounds at all are required on the control variables, then one can choose
+the "BFGS" or "CG" minimisation algorithm for the 3DVAR algorithm.
+
+This dictionary has to be defined, for example, in an external Python script
+file, using the mandatory variable name "*AlgorithmParameters*" for the
+dictionary. All the keys inside the dictionary are optional, they all have
+default values, and can exist without being used. For example::
 
     #-*-coding:iso-8859-1-*-
     #
@@ -284,7 +307,7 @@ Then the script can be added to the ADAO case, in a file entry describing the
     **Adding parameters to control the algorithm**
 
 Other steps and results are exactly the same as in the `Building a simple
-estimation case with explicit data definition`_ previous example.
+estimation case with explicit data definition`_ previous example. The dictionary
+can also be directly given in the input field associated with the keyword.
 
 .. [#] For more information on YACS, see the the *YACS User Guide* available in the main "*Help*" menu of SALOME GUI.
-
index 442ced65d03363a9e28b86b3dc0d55449eb0aaff..dac7bc0504c82f7d094a1b0260e1359716a77788 100644 (file)
Binary files a/doc/images/adao_activate.png and b/doc/images/adao_activate.png differ
index 77552f93112bc27f563b09f7c97f5da58a0c6355..a20de325b06f0e167499a4643a54459b233c876b 100644 (file)
Binary files a/doc/images/adao_exporttoyacs.png and b/doc/images/adao_exporttoyacs.png differ
index 75a367f03d5c8dcf0f7cc11028c19723ba736296..8f1cce5ab71e29aeb35df44c88bbae0b0bbe2f5a 100644 (file)
Binary files a/doc/images/adao_jdcexample01.png and b/doc/images/adao_jdcexample01.png differ
index 7e3ddcc9051dbd405687c91f388030983416a654..02e144026b5c9617dc039ccc1343d95a5cf40365 100644 (file)
Binary files a/doc/images/adao_jdcexample02.png and b/doc/images/adao_jdcexample02.png differ
index 18056f5134dffe6a9346eb43d13239b2d31c86ab..c2be12dec814605b822099a55671e17c9f2403de 100644 (file)
Binary files a/doc/images/adao_scriptentry01.png and b/doc/images/adao_scriptentry01.png differ
index ca295d379c83461f45ddf2658d9babb26e77c4e0..762fb003ba33a58d411fccc99dcff29c1533d671 100644 (file)
Binary files a/doc/images/adao_scriptentry02.png and b/doc/images/adao_scriptentry02.png differ
index 12824b498e693aed180bbf6ce0d89b7ec4e695fb..0764e59170caea8eb273c329603a047723d9c5f1 100644 (file)
Binary files a/doc/images/adao_viewer.png and b/doc/images/adao_viewer.png differ
index ccf0cc6e14b6a23c69cdfcbde63cc20c66543708..0fe0eb66b484627f4a511fde0a0242864373104e 100644 (file)
Binary files a/doc/images/yacs_containerlog.png and b/doc/images/yacs_containerlog.png differ
index a14dbb9e15102031c020115c34a59df58c449c42..240671687ddbd67c6ca69a3a27f7f5f5fa3cf5c8 100644 (file)
Binary files a/doc/images/yacs_generatedscheme.png and b/doc/images/yacs_generatedscheme.png differ
index 0385fcfb860a402eff42efe37a0fea0d91d8ec2a..68bfc25eec21a9f477ca55ba964c108e243968e8 100644 (file)
@@ -26,8 +26,8 @@ come back regularly the section :ref:`section_using`.
 
 In all this documentation, we use standard notations of data assimilation.
 Moreover, vectors are written horizontally or vertically without difference.
-Matrices are written either normally, either with a condensed notation,
-consisting in the use of a "``;``" to separate the rows in a continuous line.
+Matrices are written either normally, or with a condensed notation, consisting
+in the use of a "``;``" to separate the rows in a continuous line.
 
 .. toctree::
    :maxdepth: 2
index 4b88fee9555ddb40557a13df50a4ae1036a04982..aa6a8ad2e70b8c06c5b8d3d90d213224a58519b9 100644 (file)
@@ -2,8 +2,7 @@
 Introduction to ADAO
 ================================================================================
 
-The aim of ADAO module is to help using *data assimilation* methodology in
-conjunction with other calculation modules in SALOME.
-
-
---TODO--
+The aim of the ADAO module is to help using *data assimilation* methodology in
+conjunction with other calculation modules in SALOME. The module provides
+interface to some standard algorithms of data assimilation or optimization, and
+allows integration of them in a SALOME study.
index bb465cb58112bfeb12731a862f23cc36a6f7045e..5d7a417ec9d9d349fd0fc3f966b1245886d84661 100644 (file)
@@ -88,16 +88,16 @@ output exactly the observations (assuming that the errors are zero and the model
 exact).
 
 In the simplest case, static, the steps of simulation and of observation can be
-combined into a single operator noted :math:`H` (linear or nonlinear), which
-transforms the input parameters :math:`\mathbf{x}` to results :math:`\mathbf{y}`
-to be compared to observations :math:`\mathbf{y}^o`. Moreover, we use the
-linearized operator :math:`\mathbf{H}` to represent the effect of the full
-operator :math:`H` around a linearization point (and we omit thereafter to
-mention :math:`H` even if it is possible to keep it). In reality, we have already
-indicated that the stochastic nature of variables is essential, coming from the
-fact that model, background and observations are incorrect. We therefore
-introduce errors of observations additively, in the form of a random vector
-:math:`\mathbf{\epsilon}^o` such that:
+combined into a single observation operator noted :math:`H` (linear or
+nonlinear), which transforms the input parameters :math:`\mathbf{x}` to results
+:math:`\mathbf{y}` to be compared to observations :math:`\mathbf{y}^o`.
+Moreover, we use the linearized operator :math:`\mathbf{H}` to represent the
+effect of the full operator :math:`H` around a linearization point (and we omit
+thereafter to mention :math:`H` even if it is possible to keep it). In reality,
+we have already indicated that the stochastic nature of variables is essential,
+coming from the fact that model, background and observations are incorrect. We
+therefore introduce errors of observations additively, in the form of a random
+vector :math:`\mathbf{\epsilon}^o` such that:
 
 .. math:: \mathbf{y}^o = \mathbf{H} \mathbf{x}^t + \mathbf{\epsilon}^o
 
@@ -193,11 +193,11 @@ bibliographical searches.
 
 .. [Bouttier99] Bouttier B., Courtier P., *Data assimilation concepts and methods*, Meteorological Training Course Lecture Series, ECMWF, 1999, http://www.ecmwf.int/newsevents/training/rcourse_notes/pdf_files/Assim_concepts.pdf
 
-.. [Bocquet04] Bocquet M., *Introduction aux principes et méthodes de l'assimilation de données en géophysique*, Lecture Notes, 2004-2008, http://cerea.enpc.fr/HomePages/bocquet/assim.pdf
+.. [Bocquet04] Bocquet M., *Introduction aux principes et méthodes de l'assimilation de données en géophysique*, Lecture Notes, 2004-2008, http://cerea.enpc.fr/HomePages/bocquet/assim.pdf
 
 .. [Tarantola87] Tarantola A., *Inverse Problem: Theory Methods for Data Fitting and Parameter Estimation*, Elsevier, 1987
 
-.. [Talagrand97] Talagrand O., *Assimilation of Observations, an Introduction*, Journal of the Meteorological Society of Japan, 75(1B), pp. 191-209, 1997
+.. [Talagrand97] Talagrand O., *Assimilation of Observations, an Introduction*, Journal of the Meteorological Society of Japan, 75(1B), pp.191-209, 1997
 
 .. [Kalnay03] Kalnay E., *Atmospheric Modeling, Data Assimilation and Predictability*, Cambridge University Press, 2003
 
index 71b23d638a2ffb5540d795d0477f1913a9f0fbb8..8d282bf8029c531c561af36584d4b5af8c2f7ed6 100644 (file)
@@ -1,10 +1,19 @@
 .. _section_using:
 
 ================================================================================
-Using the module ADAO
+Using the ADAO module
 ================================================================================
 
-This section presents the usage of the ADAO module in SALOME.
+.. |eficas_new| image:: images/eficas_new.png
+   :align: middle
+.. |eficas_save| image:: images/eficas_save.png
+   :align: middle
+.. |eficas_yacs| image:: images/eficas_yacs.png
+   :align: middle
+
+This section presents the usage of the ADAO module in SALOME. It is complemented
+by advanced usage procedures the section :ref:`section_advanced`, and by some
+examples in the section :ref:`section_examples`.
 
 Logical procedure to build an ADAO test case
 --------------------------------------------
@@ -40,18 +49,14 @@ choose between creating a new study, or opening an already existing one:
   .. _adao_activate1:
   .. image:: images/adao_activate.png
     :align: center
+    :width: 100%
   .. centered::
     **Activating the module ADAO in SALOME**
 
-.. |eficas_new| image:: images/eficas_new.png
-   :align: middle
-.. |eficas_save| image:: images/eficas_save.png
-   :align: middle
-
 Choosing the "*New*" button, an embedded case editor EFICAS [#]_ will be opened,
 along with the standard "*Object browser*". You can then click on the "*New*"
-button |eficas_new| (or choose the "*New*" entry in the "*File*" menu) to create
-a new ADAO case, and you will see:
+button |eficas_new| (or choose the "*New*" entry in the "*ADAO*" main menu) to
+create a new ADAO case, and you will see:
 
   .. _adao_viewer:
   .. image:: images/adao_viewer.png
@@ -61,75 +66,261 @@ a new ADAO case, and you will see:
     **The EFICAS editor for cases definition in module ADAO**
 
 It is a good habit to save the ADAO case now, by pushing the "*Save*" button
-|eficas_save| or by choosing the "*Save/Save as*" entry in the "*File*" menu.
+|eficas_save| or by choosing the "*Save/Save as*" entry in the "*ADAO*" menu.
 You will be prompted for a location in your file tree and a name, that will be
 completed by a "*.comm*" extension used for JDC EFICAS files.
 
 Build and modify the ADAO case and save it
 ++++++++++++++++++++++++++++++++++++++++++
 
-To build a case using EFICAS, you have to go through a series of steps for
-selecting a keyword and then filling in its value. The structured editor
-indicates hierarchical types, values or keywords allowed. Incomplete or
-incorrect keywords are identified by a visual error red flag.
-
+To build a case using EFICAS, you have to go through a series of steps, by
+selecting a keyword and then filling in its value.
 
+The structured editor indicates hierarchical types, values or keywords allowed.
+Incomplete or incorrect keywords are identified by a visual error red flag.
+Possible values are indicated for keywords defined with a limited list of
+values, and adapted entries are given for the other keywords. All the mandatory
+command or keyword are already present, and optionnal commands can be added.
 
+A new case is set up with the minimal list of commands. No mandatory command can
+be suppressed, but others can be added as allowed keywords for an
+"*ASSIMILATION_STUDY*" command. As an example, one can add an
+"*AlgorithmParameters*" keyword, as described in the last part of the section
+:ref:`section_examples`.
 
+At the end, when all fields or keywords have been correctly defined, each line
+of the commands tree must have a green flag. This indicates that the whole case
+is valid and completed.
 
+  .. _adao_jdcexample00:
+  .. image:: images/adao_jdcexample01.png
+    :align: center
+    :width: 50%
+  .. centered::
+    **Example of a valid ADAO case**
 
-At the end, you have to save your ADAO case.
+Finally, you have to save your ADAO case by pushing the "*Save*" button
+|eficas_save| or by choosing the "*Save/Save as*" entry in the "*ADAO*" menu.
 
 Export the ADAO case as a YACS scheme
 +++++++++++++++++++++++++++++++++++++
 
+When the ADAO case is completed, you have to export it as a YACS scheme [#]_ in
+order to execute the data assimilation calculation. This can be easily done by
+using the "*Export to YACS*" button |eficas_yacs|, or equivalently choose the
+"*Export to YACS*" entry in the "*ADAO*" main menu, or in the contextual case
+menu in the object browser.
+
+  .. _adao_exporttoyacs:
+  .. image:: images/adao_exporttoyacs.png
+    :align: center
+    :scale: 75%
+  .. centered::
+    **"Export to YACS" submenu to generate the YACS scheme from the ADAO case**
 
+This will lead to automatically generate an XML file for the YACS scheme, and
+open YACS module on this file. The YACS file will be stored in the same
+directory and with the same name as the ADAO saved case, only changing its
+extension from "*.comm*" to "*.xml*". *Be careful, if the name already exist, it
+will overwrite it without prompting for replacing the file*. In the same time,
+an intermediary python file is also stored in the same place, with a "*.py*"
+extension replacing the "*.comm*" one [#]_.
 
 Modify and supplement the YACS scheme and save it
 +++++++++++++++++++++++++++++++++++++++++++++++++
 
+When the YACS scheme is generated and opened in SALOME through the YACS module
+GUI, you can modify or supplement the scheme like any YACS scheme. It is
+recommended to save the modified scheme with a new name, in order to preserve in
+the case you re-export to YACS the ADAO case.
 
-Execute the YACS case and obtain the results
-++++++++++++++++++++++++++++++++++++++++++++
-
-
-
-
-
-
-Reference description of the commands and keywords available throught the GUI
------------------------------------------------------------------------------
+The main supplement needed in the YACS scheme is a postprocessing step. The
+evaluation of the results has to be done in the physical context of the
+simulation used by the data assimilation procedure.
 
---TODO--
+The YACS scheme has an "*algoResults*" output port of the computation bloc,
+which gives access to a "*pyobj*" containing all the results. These results can
+be obtained by retrieving the named variables stored along the calculation. The
+main is the "*Analysis*" one, that can be obtained by the python command (for
+example in an in-line script node)::
 
+    Analysis = results.ADD.get("Analysis").valueserie(-1)
 
-ASSIM_STUDY
+This is a complex object, similar to a list of values calculated at each step of
+data assimilation calculation. In order to get the last data assimilation
+analysis, one can use::
 
-String
+    Xa = results.ADD.get("Analysis").valueserie(-1)
 
-Script
+This ``Xa`` is a vector of values, that represents the solution of the data
+assimilation evaluation problem, noted as :math:`\mathbf{x}^a` in the section
+:ref:`section_theory`.
 
-Vector
+Such command can be used to print results, or to convert these ones to
+structures that can be used in the native or external SALOME postprocessing. A
+simple example is given in the section :ref:`section_examples`.
 
-Matrix
-
-Function
-
-Dict
-
-Background
-
-BackgroundError
+Execute the YACS case and obtain the results
+++++++++++++++++++++++++++++++++++++++++++++
 
-Observation
+The YACS scheme is now complete and can be executed. Parametrisation and
+execution of a YACS case is fully compliant with the standard way to deal with a
+YACS scheme, and is described in the *YACS User Guide*.
+
+Results can be obtained, through the "*algoResults*" output port, using YACS
+nodes to retrieve all the informations in the "*pyobj*" object, to transform
+them, to convert them, to save part of them, etc.
+
+The data assimilation results and complementary calculations can be retrieved
+using the "*get*" method af the "*algoResults.ADD*" object. This method pick the
+different output variables identified by their name. Indicating in parenthesis
+their availability as automatic (for every algorithm) or optional (depending on
+the algorithm), and their notation coming from section :ref:`section_theory`,
+the main available output variables are the following:
+
+#.  "Analysis" (automatic): the control state evaluated by the data assimilation
+    procedure, noted as :math:`\mathbf{x}^a`.
+#.  "Innovation" (automatic): the difference between the observations and the
+    control state transformed by the observation operator, noted as
+    :math:`\mathbf{y}^o - \mathbf{H}\mathbf{x}^b`.
+#.  "OMB" (optional): the difference between the observations and the
+    background, similar to the innovation.
+#.  "BMA" (optional): the difference between the background and the analysis,
+    noted as :math:`\mathbf{x}^b - \mathbf{x}^a`.
+#.  "OMA" (optional): the difference between the observations and the analysis,
+    noted as :math:`\mathbf{y}^o - \mathbf{H}\mathbf{x}^a`.
+
+Input variables are also available as output in order to gather all the
+information at the end of the procedure.
+
+All the variables are list of typed values, each item of the list
+corresponding to the value of the variable at a time step or an iteration step
+in the data assimilation optimisation procedure. The variable value at a given
+"*i*" step can be obtained by the method "*valueserie(i)*". The last one
+(consisting in the solution of the evaluation problem) can be obtained using the
+step "*-1*" as in a standard list.
+
+Reference description of the commands and keywords available through the GUI
+-----------------------------------------------------------------------------
 
-ObservationError
+Each command or keyword to be defined through the ADAO GUI has some properties.
+The first property is to be a required command, an optional command or a keyword
+describing a type. The second property is to be an "open" variable with a fixed
+type but with any value allowed by the type, or a "restricted" variable, limited
+to some specified values. The mathematical notations are explained in the
+section :ref:`section_theory`.
+
+The different type-style commands are:
+
+:Dict:
+    Type of an input. This indicates a variable that has to be filled by a
+    dictionary, usually given as a script.
+
+:Function:
+    Type of an input. This indicates a variable that has to be filled by a
+    function, usually given as a script.
+
+:Matrix:
+    Type of an input. This indicates a variable that has to be filled by a
+    matrix, usually given either as a string or as a script.
+
+:String:
+    Type of an input. This indicates a string, such as a name or a literal
+    representation of a matrix or vector, such as "1 2 ; 3 4".
+
+:Script:
+    Type of an input. This indicates a script given as an external file.
+
+:Vector:
+    Type of an input. This indicates a variable that has to be filled by a
+    vector, usually given either as a string or as a script.
+    
+The different commands are the following:
+
+:ASSIM_STUDY:
+    Required command. This is the general command describing an ADAO case. It
+    hierarchicaly contains all the other commands.
+
+:Algorithm:
+    Required command. This is a string to indicates the data assimilation
+    algorithm chosen. The choices are limited and available through the GUI.
+    There exists for example: "3DVAR", "Blue", "EnsembleBlue", "KalmanFilter".
+
+:AlgorithmParameters:
+    Optional command. This command allows to add some optional parameters to
+    control the data assimilation algorithm calculation. It is defined as a
+    "*Dict*" type object. 
+
+:Background:
+    Required command. This indicates the backgroud vector used for data
+    assimilation, previously noted as :math:`\mathbf{x}^b`. It is defined as a
+    "*Vector*" type object, that is, given either as a string or as a script.
+
+:BackgroundError:
+    Required command. This indicates the backgroud error covariance matrix,
+    previously noted as :math:`\mathbf{B}`.It is defined as a "*Matrix*" type
+    object, that is, given either as a string or as a script.
+
+:Debug:
+    Required command. This let choose the level of trace and intermediary debug
+    informations.The choices are limited between 0 (for False) and 1 (for True)
+    and available through the GUI.
+
+:InputVariables:
+    Optional command. This command allows to indicates the name and size of
+    physical variables that are bundled together in the control vector. This
+    information is dedicated to data processed inside of data assimilation
+    algorithm.
+
+:Observation:
+    Required command. This indicates the observation vector used for data
+    assimilation, previously noted as :math:`\mathbf{y}^o`. It is defined as a
+    "*Vector*" type object, that is, given either as a string or as a script.
+
+:ObservationError:
+    Required command. This indicates the observation error covariance matrix,
+    previously noted as :math:`\mathbf{R}`.It is defined as a "*Matrix*" type
+    object, that is, given either as a string or as a script.
+
+:ObservationOperator:
+    Required command. This indicates the observation operator, previously
+    noted :math:`H`, which transforms the input parameters :math:`\mathbf{x}`
+    to results :math:`\mathbf{y}` to be compared to observations
+    :math:`\mathbf{y}^o`.
+
+:OutputVariables:
+    Optional command. This command allows to indicates the name and size of
+    physical variables that are bundled together in the output observation
+    vector. This information is dedicated to data processed inside of data
+    assimilation algorithm.
+
+:Study_name:
+    Required command. This is an open string to describe the study by a name or
+    a sentence.
+
+:Study_repertory:
+    Optional command. If available, this repertory is used to find all the
+    script files that can be used to define some other commands by scripts.
+
+:UserDataInit:
+    Optional command. This commands allows to initialise some parameters or data
+    automatically before data assimilation algorithm processing.
+
+:UserPostAnalysis:
+    Optional command. This commands allows to process some parameters or data
+    automatically after data assimilation algorithm processing. It is defined as
+    a script or a string, allowing to put simple code directly inside the ADAO
+    case.
+
+Examples of using these commands are available in the section
+:ref:`section_examples` and in examples files installed with ADAO module.
 
-ObservationOperator
+.. [#] For more information on EFICAS, see the the *EFICAS User Guide* available in the main "*Help*" menu of SALOME GUI.
 
-AlgorithmParameters
+.. [#] For more information on YACS, see the the *YACS User Guide* available in the main "*Help*" menu of SALOME GUI.
 
-Algorithm : "ThreeDVAR", "Blue", "EnsembleBlue", "Kalman"...
+.. [#] This intermediary python file can be safely removed after YACS export, but can also be used as described in the section :ref:`section_advanced`.
 
-.. [#] For more information on EFICAS, see the the *EFICAS User Guide* available in the main "*Help*" menu of SALOME GUI.
+.. [Byrd95] Byrd R. H., Lu P., Nocedal J., *A Limited Memory Algorithm for Bound Constrained Optimization*, SIAM Journal on Scientific and Statistical Computing, 16(5), pp.1190-1208, 1995
 
+.. [Zhu97] Zhu C., Byrd R. H., Nocedal J., *L-BFGS-B: Algorithm 778: L-BFGS-B, FORTRAN routines for large scale bound constrained optimization*, ACM Transactions on Mathematical Software, Vol 23(4), pp.550-560, 1997
index d42ce6515f46fa3c015b669281b7c50cdaae88d4..b073851bb572c6ae2df66ccb5106ffdd8214e5a5 100644 (file)
@@ -1,6 +1,6 @@
 #-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-2010  EDF R&D
+#  Copyright (C) 2008-2011  EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-__doc__ = """
-    Algorithme variationnel statique (3D-VAR)
-"""
-__author__ = "Jean-Philippe ARGAUD - Mars 2009"
 
 import logging
 from daCore import BasicObjects, PlatformInfo
@@ -53,6 +49,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         logging.debug("%s Lancement"%self._name)
         logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("Mo")))
         #
+        # Opérateur d'observation
+        # -----------------------
         Hm = H["Direct"].appliedTo
         Ht = H["Adjoint"].appliedInXTo
         #
@@ -122,6 +120,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         #
         # Paramètres de pilotage
         # ----------------------
+        # Potentiels : "Bounds", "Minimizer", "MaximumNumberOfSteps"
         if Parameters.has_key("Bounds") and (type(Parameters["Bounds"]) is type([]) or type(Parameters["Bounds"]) is type(())) and (len(Parameters["Bounds"]) > 0):
             Bounds = Parameters["Bounds"]
         else:
@@ -136,7 +135,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
             maxiter = int( Parameters["MaximumNumberOfSteps"] )
         else:
             maxiter = 15000
-        logging.debug("%s Nombre maximal de pas d'optimisation = %s"%(self._name, maxiter))
+        logging.debug("%s Nombre maximal de pas d'optimisation = %s"%(self._name, str(maxiter)))
         #
         # Minimisation de la fonctionnelle
         # --------------------------------
index 04efa6fd2a68728fd6d6f9581882497190e634b6..0dcd6d44a4c75f08d6435e4ef4502f6748413937 100644 (file)
@@ -1,6 +1,6 @@
 #-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-2010  EDF R&D
+#  Copyright (C) 2008-2011  EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-__doc__ = """
-    Algorithme de Kalman simple (BLUE)
-"""
-__author__ = "Jean-Philippe ARGAUD - Mars 2008"
 
 import logging
 from daCore import BasicObjects, PlatformInfo
index f09c2a0609e5f2ba0700040ad8552f330dc48260..d4c13fba2f5c4abdd2e729137c555ec098f89bc0 100644 (file)
@@ -1,6 +1,6 @@
 #-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-2010  EDF R&D
+#  Copyright (C) 2008-2011  EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-__doc__ = """
-    Algorithme de methode d'ensemble simple
-"""
-__author__ = "Sebastien MASSART, Jean-Philippe ARGAUD - Novembre 2008"
 
 import logging
 from daCore import BasicObjects, PlatformInfo
diff --git a/src/daComposant/daAlgorithms/Kalman.py b/src/daComposant/daAlgorithms/Kalman.py
deleted file mode 100644 (file)
index cccfd35..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-#-*-coding:iso-8859-1-*-
-#
-#  Copyright (C) 2008-2010  EDF R&D
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-__doc__ = """
-    Algorithme de Kalman pour un système discret
-    
-    Remarque : les observations sont exploitées à partir du pas de temps 1, et
-    sont utilisées dans Yo comme rangées selon ces indices. Donc le pas 0 n'est
-    pas utilisé puisque la première étape de Kalman passe de 0 à 1 avec
-    l'observation du pas 1.
-"""
-__author__ = "Jean-Philippe ARGAUD - Septembre 2008"
-
-import logging
-from daCore import BasicObjects, PlatformInfo
-m = PlatformInfo.SystemUsage()
-
-# ==============================================================================
-class ElementaryAlgorithm(BasicObjects.Algorithm):
-    def __init__(self):
-        BasicObjects.Algorithm.__init__(self)
-        self._name = "KALMAN"
-        logging.debug("%s Initialisation"%self._name)
-
-    def run(self, Xb=None, Y=None, H=None, M=None, R=None, B=None, Q=None, Parameters=None):
-        """
-        Calcul de l'estimateur de Kalman
-        """
-        logging.debug("%s Lancement"%self._name)
-        logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("Mo")))
-        #
-        # Opérateur d'observation
-        # -----------------------
-        Hm = H["Direct"].asMatrix()
-        Ht = H["Adjoint"].asMatrix()
-        #
-        # Opérateur d'évolution
-        # ---------------------
-        Mm = M["Direct"].asMatrix()
-        Mt = M["Adjoint"].asMatrix()
-        #
-        duration = Y.stepnumber()
-        #
-        # Initialisation
-        # --------------
-        Xn = Xb
-        Pn = B
-        self.StoredVariables["Analysis"].store( Xn.A1 )
-        self.StoredVariables["CovarianceAPosteriori"].store( Pn )
-        #
-        for step in range(duration-1):
-            logging.debug("%s Etape de Kalman %i (i.e. %i->%i) sur un total de %i"%(self._name, step+1, step,step+1, duration-1))
-            #
-            # Etape de prédiction
-            # -------------------
-            Xn_predicted = Mm * Xn
-            Pn_predicted = Mm * Pn * Mt + Q
-            #
-            # Etape de correction
-            # -------------------
-            d  = Y.valueserie(step+1) - Hm * Xn_predicted
-            K  = Pn_predicted * Ht * (Hm * Pn_predicted * Ht + R).I
-            Xn = Xn_predicted + K * d
-            Pn = Pn_predicted - K * Hm * Pn_predicted
-            #
-            self.StoredVariables["Analysis"].store( Xn.A1 )
-            self.StoredVariables["CovarianceAPosteriori"].store( Pn )
-            self.StoredVariables["Innovation"].store( d.A1 )
-        #
-        logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("Mo")))
-        logging.debug("%s Terminé"%self._name)
-        #
-        return 0
-
-# ==============================================================================
-if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
diff --git a/src/daComposant/daAlgorithms/KalmanFilter.py b/src/daComposant/daAlgorithms/KalmanFilter.py
new file mode 100644 (file)
index 0000000..e7b9284
--- /dev/null
@@ -0,0 +1,90 @@
+#-*-coding:iso-8859-1-*-
+#
+#  Copyright (C) 2008-2011  EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import logging
+from daCore import BasicObjects, PlatformInfo
+m = PlatformInfo.SystemUsage()
+
+# ==============================================================================
+class ElementaryAlgorithm(BasicObjects.Algorithm):
+    def __init__(self):
+        BasicObjects.Algorithm.__init__(self)
+        self._name = "KALMANFILTER"
+        logging.debug("%s Initialisation"%self._name)
+
+    def run(self, Xb=None, Y=None, H=None, M=None, R=None, B=None, Q=None, Parameters=None):
+        """
+        Calcul de l'estimateur du filtre de Kalman
+
+        Remarque : les observations sont exploitées à partir du pas de temps 1,
+        et sont utilisées dans Yo comme rangées selon ces indices. Donc le pas 0
+        n'est pas utilisé puisque la première étape de Kalman passe de 0 à 1
+        avec l'observation du pas 1.
+        """
+        logging.debug("%s Lancement"%self._name)
+        logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("Mo")))
+        #
+        # Opérateur d'observation
+        # -----------------------
+        Hm = H["Direct"].asMatrix()
+        Ht = H["Adjoint"].asMatrix()
+        #
+        # Opérateur d'évolution
+        # ---------------------
+        Mm = M["Direct"].asMatrix()
+        Mt = M["Adjoint"].asMatrix()
+        #
+        duration = Y.stepnumber()
+        #
+        # Initialisation
+        # --------------
+        Xn = Xb
+        Pn = B
+        self.StoredVariables["Analysis"].store( Xn.A1 )
+        self.StoredVariables["CovarianceAPosteriori"].store( Pn )
+        #
+        for step in range(duration-1):
+            logging.debug("%s Etape de Kalman %i (i.e. %i->%i) sur un total de %i"%(self._name, step+1, step,step+1, duration-1))
+            #
+            # Etape de prédiction
+            # -------------------
+            Xn_predicted = Mm * Xn
+            Pn_predicted = Mm * Pn * Mt + Q
+            #
+            # Etape de correction
+            # -------------------
+            d  = Y.valueserie(step+1) - Hm * Xn_predicted
+            K  = Pn_predicted * Ht * (Hm * Pn_predicted * Ht + R).I
+            Xn = Xn_predicted + K * d
+            Pn = Pn_predicted - K * Hm * Pn_predicted
+            #
+            self.StoredVariables["Analysis"].store( Xn.A1 )
+            self.StoredVariables["CovarianceAPosteriori"].store( Pn )
+            self.StoredVariables["Innovation"].store( d.A1 )
+        #
+        logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("Mo")))
+        logging.debug("%s Terminé"%self._name)
+        #
+        return 0
+
+# ==============================================================================
+if __name__ == "__main__":
+    print '\n AUTODIAGNOSTIC \n'
index 7d6fa982ad8a46d926d55883fad35c6c36962ffc..e7cff5672731e7a5f8ffe6d6e8c85e7089a8c2f6 100644 (file)
@@ -1,6 +1,6 @@
 #-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-2010  EDF R&D
+#  Copyright (C) 2008-2011  EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-__doc__ = """
-    Algorithme de moindre carres pondérés (analyse sans ebauche)
-"""
-__author__ = "Sophie RICCI, Jean-Philippe ARGAUD - Septembre 2008"
 
 import logging
 from daCore import BasicObjects, PlatformInfo
@@ -35,7 +31,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
     def run(self, Xb=None, Y=None, H=None, M=None, R=None, B=None, Q=None, Parameters=None):
         """
-        Calcul de l'estimateur au sens des moindres carres sans ebauche
+        Calcul de l'estimateur moindres carrés pondérés linéaires
+        (assimilation variationnelle sans ébauche)
         """
         logging.debug("%s Lancement"%self._name)
         logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("Mo")))
@@ -56,5 +53,3 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 # ==============================================================================
 if __name__ == "__main__":
     print '\n AUTODIAGNOSTIC \n'
-
-
index 7602fc1a7e5aadbcbc92fcaacde0b96089f17a2b..01e8d687c65e22c0f9f4498b1134c53f7539286c 100644 (file)
@@ -1,5 +1,6 @@
+#-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-2010  EDF R&D
+#  Copyright (C) 2008-2011  EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
index 8a691815cbf8c6b8d30db56b94e6c0a6002efa71..950b7058329c0d0866a3e8fcfef9b2a30be63ae2 100644 (file)
@@ -1,6 +1,6 @@
 #-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-2010  EDF R&D
+#  Copyright (C) 2008-2011  EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
@@ -22,9 +22,9 @@ __doc__ = """
     Définit les outils généraux élémentaires.
     
     Ce module est destiné à etre appelée par AssimilationStudy pour constituer
-    les objets élémentaires de l'algorithme.
+    les objets élémentaires de l'étude.
 """
-__author__ = "Jean-Philippe ARGAUD - Mars 2008"
+__author__ = "Jean-Philippe ARGAUD"
 
 import os, sys
 import numpy
@@ -706,6 +706,25 @@ class AssimilationStudy:
                 HookFunction   = HookFunction,
                 )
 
+    # -----------------------------------------------------------
+    def setDebug(self, level=10):
+        """
+        Utiliser par exemple "import logging ; level = logging.DEBUG" avant cet
+        appel pour changer le niveau de verbosité, avec :
+        NOTSET=0 < DEBUG=10 < INFO=20 < WARNING=30 < ERROR=40 < CRITICAL=50
+        """
+        import logging
+        log = logging.getLogger()
+        log.setLevel( level )
+
+    def unsetDebug(self):
+        """
+        Remet le logger au niveau par défaut
+        """
+        import logging
+        log = logging.getLogger()
+        log.setLevel( logging.WARNING )
+
     def prepare_to_pickle(self):
         self.__algorithmFile = None
         self.__diagnosticFile = None
@@ -763,3 +782,13 @@ if __name__ == "__main__":
         print "Action sur la variable observée, étape :",i
         ADD.get('Analysis').store( [i, i, i] )
     print
+
+    print "Mise en debug et hors debug"
+    print "Nombre d'analyses  :", ADD.get("Analysis").stepnumber()
+    ADD.setDebug()
+    ADD.analyze()
+    ADD.unsetDebug()
+    print "Nombre d'analyses  :", ADD.get("Analysis").stepnumber()
+    ADD.analyze()
+    print "Nombre d'analyses  :", ADD.get("Analysis").stepnumber()
+    print
index df117ad2a69dc66a911ec4de10de20ea870edeac..e9c3ce4974a939f3974db836e0b1d8de46ce5c50 100644 (file)
@@ -1,6 +1,6 @@
 #-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-2010  EDF R&D
+#  Copyright (C) 2008-2011  EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
@@ -24,7 +24,7 @@ __doc__ = """
     Ce module est destiné à etre appelée par AssimilationStudy pour constituer
     les objets élémentaires de l'algorithme.
 """
-__author__ = "Jean-Philippe ARGAUD - Mars 2008"
+__author__ = "Jean-Philippe ARGAUD"
 
 import numpy
 import Persistence
index b2075492a3d240daf0d4a786fa42d46119e32005..a3e41d8c3266ceaeb3a909c8afc24ae7ced574bd 100644 (file)
@@ -1,6 +1,6 @@
 #-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-2010  EDF R&D
+#  Copyright (C) 2008-2011  EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
@@ -62,12 +62,13 @@ __doc__ = """
     Dans une application, à n'importe quel endroit et autant de fois qu'on veut,
     on peut changer le niveau global de message en utilisant par exemple :
         import logging
-        logging.setLevel(logging.DEBUG)
+        log = logging.getLogger(NAME) # Avec rien (recommandé) ou un nom NAME
+        log.setLevel(logging.DEBUG)
     
     On rappelle les niveaux (attributs de "logging") et leur ordre :
         NOTSET=0 < DEBUG=10 < INFO=20 < WARNING=30 < ERROR=40 < CRITICAL=50
 """
-__author__ = "Jean-Philippe ARGAUD - Octobre 2008"
+__author__ = "Jean-Philippe ARGAUD"
 
 import os
 import sys
index b8d100d142f7376725f66fc4a7f97f904397c63e..57bbdace4718a16d50e433196cfcb8a7afd84624 100644 (file)
@@ -1,6 +1,6 @@
 #-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-2010  EDF R&D
+#  Copyright (C) 2008-2011  EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
@@ -22,7 +22,7 @@ __doc__ = """
     Définit des outils de persistence et d'enregistrement de séries de valeurs
     pour analyse ultérieure ou utilisation de calcul.
 """
-__author__ = "Jean-Philippe ARGAUD - Mars 2008"
+__author__ = "Jean-Philippe ARGAUD"
 
 import numpy
 
@@ -132,16 +132,30 @@ class Persistence:
         else:
             return self.__steps
 
-    def valueserie(self, item=None, step=None):
+    def valueserie(self, item=None, step=None, allSteps = False):
         """
         Renvoie par défaut toute la liste des valeurs/objets. Si l'argument
         "step" existe dans la liste des pas de stockage effectués, renvoie la
         valeur stockée à ce pas "step". Si l'argument "item" est correct,
-        renvoie la valeur stockée au numéro "item".
+        renvoie la valeur stockée au numéro "item". Si "allSteps" est vrai,
+        renvoie l'ensemble des valeurs et non pas seulement la première.
         """
         if step is not None and step in self.__steps:
-            index = self.__steps.index(step)
-            return self.__values[index]
+            if allSteps:
+                allIndexes = []
+                searchFrom = 0
+                try:
+                    while self.__steps.index(step,searchFrom) >= 0:
+                        searchFrom = self.__steps.index(step,searchFrom)
+                        allIndexes.append( searchFrom )
+                        searchFrom +=1
+                except ValueError, e:
+                    pass
+                allValues = [self.__values[index] for index in allIndexes]
+                return allValues
+            else:
+                index = self.__steps.index(step)
+                return self.__values[index]
         elif item is not None and item < len(self.__values):
             return self.__values[item]
         else:
@@ -641,6 +655,7 @@ class CompositePersistence:
         #
         # Definition des objets par defaut
         # --------------------------------
+        self.__StoredObjects["Informations"]     = OneNoType("Informations")
         self.__StoredObjects["Background"]       = OneVector("Background", basetype=numpy.array)
         self.__StoredObjects["BackgroundError"]  = OneMatrix("BackgroundError")
         self.__StoredObjects["Observation"]      = OneVector("Observation", basetype=numpy.array)
@@ -809,6 +824,26 @@ if __name__ == "__main__":
     del OBJET_DE_TEST
     print
 
+    print "======> Un flottant"
+    OBJET_DE_TEST = OneScalar("My float", unit="cm")
+    OBJET_DE_TEST.store( 5., step="azerty")
+    OBJET_DE_TEST.store(-5., step="poiuyt")
+    OBJET_DE_TEST.store( 1., step="azerty")
+    OBJET_DE_TEST.store( 0., step="xxxxxx")
+    OBJET_DE_TEST.store( 5., step="poiuyt")
+    OBJET_DE_TEST.store(-5., step="azerty")
+    OBJET_DE_TEST.store( 1., step="poiuyt")
+    print "Les pas de stockage :", OBJET_DE_TEST.stepserie()
+    print "Les valeurs         :", OBJET_DE_TEST.valueserie()
+    print "La 2ème valeur      :", OBJET_DE_TEST.valueserie(1)
+    print "La dernière valeur  :", OBJET_DE_TEST.valueserie(-1)
+    print "Premier index       :", OBJET_DE_TEST.valueserie( step = "azerty", allSteps = False )
+    print "Valeurs identiques  :", OBJET_DE_TEST.valueserie( step = "azerty", allSteps = True )
+    print "Premier index       :", OBJET_DE_TEST.valueserie( step = "poiuyt", allSteps = False )
+    print "Valeurs identiques  :", OBJET_DE_TEST.valueserie( step = "poiuyt", allSteps = True )
+    del OBJET_DE_TEST
+    print
+
     print "======> Un entier"
     OBJET_DE_TEST = OneScalar("My int", unit="cm", basetype=int)
     OBJET_DE_TEST.store( 5 )
index 06bb5df6d876a454d00b87af369e7c5d7b42d94d..6230c912b692b01e17f91a826893556fc837a20f 100644 (file)
@@ -1,6 +1,6 @@
 #-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-2010  EDF R&D
+#  Copyright (C) 2008-2011  EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
@@ -34,7 +34,7 @@ __doc__ = """
     simplement cette classe, sans meme récupérer d'objet :
         PathManagement()
 """
-__author__ = "Jean-Philippe ARGAUD - Mars 2008"
+__author__ = "Jean-Philippe ARGAUD"
 
 import os
 
index 7602fc1a7e5aadbcbc92fcaacde0b96089f17a2b..01e8d687c65e22c0f9f4498b1134c53f7539286c 100644 (file)
@@ -1,5 +1,6 @@
+#-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-2010  EDF R&D
+#  Copyright (C) 2008-2011  EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
index 487717a9e41187d632d1ae571c827c0847019d7e..2ec581ef6d460de7a193eff5bfa4c9ba2f53d261 100644 (file)
@@ -1,6 +1,6 @@
 #-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-2010  EDF R&D
+#  Copyright (C) 2008-2011  EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
@@ -19,5 +19,5 @@
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 name    = "Data Assimilation Package"
-version = "0.3.0"
+version = "0.3.0-SP630"
 date    = "lundi 15 octobre 2010, 11:11:11 (UTC+0200)"
index 7a42538c17138e10b02ac064f32c36488562263d..05ab7b520c1e63e1d0cfa528327c5cca985910f6 100644 (file)
@@ -1,6 +1,6 @@
 #-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-201 EDF R&D
+#  Copyright (C) 2008-2011 EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-__doc__ = """
-    Classe pour tracer simplement un vecteur à chaque pas
-"""
-__author__ = "Jean-Philippe ARGAUD - Juillet 2008"
 
-import os.path
 import numpy
 from daCore import BasicObjects
+import os.path
 
 # ==============================================================================
 class ElementaryDiagnostic(BasicObjects.Diagnostic):
+    """
+    Classe pour tracer simplement un vecteur à chaque pas
+    """
     def __init__(self, name = "", unit = "", basetype = None, parameters = {}):
         BasicObjects.Diagnostic.__init__(self, name, parameters)
         try:
index 727ead70803c480195df0e29e840f03cbab07ad5..7c67a67fced75c493f0da701b8ab7cf0f8d94c9b 100644 (file)
@@ -1,6 +1,6 @@
 #-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-201 EDF R&D
+#  Copyright (C) 2008-2011 EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-__doc__ = """
-    Classe pour tracer simplement une liste de vecteurs à chaque pas
-"""
-__author__ = "Jean-Philippe ARGAUD - Septembre 2008"
 
-import os.path
 import numpy
 from daCore import BasicObjects
+import os.path
 
 # ==============================================================================
 class ElementaryDiagnostic(BasicObjects.Diagnostic):
+    """
+    Classe pour tracer simplement une liste de vecteurs à chaque pas
+    """
     def __init__(self, name = "", unit = "", basetype = None, parameters = {}):
         BasicObjects.Diagnostic.__init__(self, name, parameters)
         try:
index 8c91d9d579afd9285bdfa1526c26d64c6838f4f3..56516a0902090b05ff2dc966e7646e8861f3dc27 100644 (file)
@@ -1,6 +1,6 @@
 #-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-201 EDF R&D
+#  Copyright (C) 2008-2011 EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-__doc__ = """
-    Calcul d'une RMS
-"""
-__author__ = "Jean-Philippe ARGAUD - Juillet 2008"
 
 import math, numpy
 from daCore import BasicObjects, Persistence
 
 # ==============================================================================
 class ElementaryDiagnostic(BasicObjects.Diagnostic,Persistence.OneScalar):
+    """
+    Calcul d'une RMS
+    """
     def __init__(self, name = "", unit = "", basetype = None, parameters = {}):
         BasicObjects.Diagnostic.__init__(self, name, parameters)
         Persistence.OneScalar.__init__( self, name, unit, basetype = float)
index 805f8aef9246baa2b22ce137d064958feb3606dd..cdbe0414f849389ee3c578b577f2cdefcb1a0966 100644 (file)
@@ -1,6 +1,6 @@
 #-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-201 EDF R&D
+#  Copyright (C) 2008-2011 EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-__doc__ = """
-    Diagnostic sur la reduction de la variance lors de l'analyse
-"""
-__author__ = "Jean-Philippe ARGAUD - Septembre 2008"
 
 import numpy
 from daCore import BasicObjects, Persistence
 
 # ==============================================================================
 class ElementaryDiagnostic(BasicObjects.Diagnostic,Persistence.OneScalar):
+    """
+    Diagnostic sur la reduction de la variance lors de l'analyse
+    """
     def __init__(self, name = "", unit = "", basetype = None, parameters = {}):
         BasicObjects.Diagnostic.__init__(self, name, parameters)
         Persistence.OneScalar.__init__( self, name, unit, basetype = bool )
index 7602fc1a7e5aadbcbc92fcaacde0b96089f17a2b..6beeba4be592ca0dca82e2c527f36cc7c6106687 100644 (file)
@@ -1,5 +1,6 @@
+#-*-coding:iso-8859-1-*-
 #
-#  Copyright (C) 2008-201 EDF R&D
+#  Copyright (C) 2008-2011 EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
index 04096757c4964c141de84ca712b6e60224ecd3d8..e38aa05cf89d048a7a6a2200682b6648a8ad8e63 100644 (file)
@@ -52,7 +52,7 @@ FromNumpyList["Function"] = ["FunctionDict"]
 FromNumpyList["Dict"] = ["Script"]
 
 # -- Infos from daAlgorithms --
-AssimAlgos = ["Blue", "EnsembleBlue", "Kalman", "LinearLeastSquares", "3DVAR"]
+AssimAlgos = ["Blue", "EnsembleBlue", "KalmanFilter", "LinearLeastSquares", "3DVAR"]
 
 AlgoDataRequirements = {}
 AlgoDataRequirements["Blue"] = ["Background", "BackgroundError",
@@ -64,7 +64,7 @@ AlgoType = {}
 AlgoType["Blue"] = "Optim"
 AlgoType["3DVAR"] = "Optim"
 AlgoType["EnsembleBlue"] = "Optim"
-AlgoType["Kalman"] = "Optim"
+AlgoType["KalmanFilter"] = "Optim"
 AlgoType["LinearLeastSquares"] = "Optim"
 #AlgoType["Blue"] = "Direct"
 
diff --git a/src/examples/daSalome/test001_ADAO_JDC_using_strings.comm b/src/examples/daSalome/test001_ADAO_JDC_using_strings.comm
new file mode 100644 (file)
index 0000000..8455aa5
--- /dev/null
@@ -0,0 +1,19 @@
+
+ASSIMILATION_STUDY(Study_name='Test',
+                   Debug=0,
+                   Algorithm='Blue',
+                   Background=_F(INPUT_TYPE='Vector',
+                                 data=_F(FROM='String',
+                                         STRING='0 0 0',),),
+                   BackgroundError=_F(INPUT_TYPE='Matrix',
+                                      data=_F(FROM='String',
+                                              STRING='1 0 0 ; 0 1 0 ; 0 0 1',),),
+                   Observation=_F(INPUT_TYPE='Vector',
+                                  data=_F(FROM='String',
+                                          STRING='1 1 1',),),
+                   ObservationError=_F(INPUT_TYPE='Matrix',
+                                       data=_F(FROM='String',
+                                               STRING='1 0 0 ; 0 1 0 ; 0 0 1',),),
+                   ObservationOperator=_F(INPUT_TYPE='Matrix',
+                                          data=_F(FROM='String',
+                                                  STRING='1 0 0 ; 0 1 0 ; 0 0 1',),),);
diff --git a/src/examples/daSalome/test002_ADAO_JDC_using_strings.comm b/src/examples/daSalome/test002_ADAO_JDC_using_strings.comm
new file mode 100644 (file)
index 0000000..752fbf4
--- /dev/null
@@ -0,0 +1,19 @@
+
+ASSIMILATION_STUDY(Study_name='Test',
+                   Debug=0,
+                   Algorithm='3DVAR',
+                   Background=_F(INPUT_TYPE='Vector',
+                                 data=_F(FROM='String',
+                                         STRING='0 0 0',),),
+                   BackgroundError=_F(INPUT_TYPE='Matrix',
+                                      data=_F(FROM='String',
+                                              STRING='1 0 0 ; 0 1 0 ; 0 0 1',),),
+                   Observation=_F(INPUT_TYPE='Vector',
+                                  data=_F(FROM='String',
+                                          STRING='1 1 1',),),
+                   ObservationError=_F(INPUT_TYPE='Matrix',
+                                       data=_F(FROM='String',
+                                               STRING='1 0 0 ; 0 1 0 ; 0 0 1',),),
+                   ObservationOperator=_F(INPUT_TYPE='Matrix',
+                                          data=_F(FROM='String',
+                                                  STRING='1 0 0 ; 0 1 0 ; 0 0 1',),),);
diff --git a/src/examples/daSalome/test003_ADAO_JDC_using_scripts.comm.in b/src/examples/daSalome/test003_ADAO_JDC_using_scripts.comm.in
new file mode 100644 (file)
index 0000000..5b26a32
--- /dev/null
@@ -0,0 +1,20 @@
+
+ASSIMILATION_STUDY(Study_name='Test',
+                   Study_repertory='@prefix@/examples/daSalome',
+                   Debug=0,
+                   Algorithm='3DVAR',
+                   Background=_F(INPUT_TYPE='Vector',
+                                 data=_F(FROM='Script',
+                                         SCRIPT_FILE='test003_ADAO_scripts_for_JDC.py',),),
+                   BackgroundError=_F(INPUT_TYPE='Matrix',
+                                      data=_F(FROM='Script',
+                                              SCRIPT_FILE='test003_ADAO_scripts_for_JDC.py',),),
+                   Observation=_F(INPUT_TYPE='Vector',
+                                  data=_F(FROM='Script',
+                                          SCRIPT_FILE='test003_ADAO_scripts_for_JDC.py',),),
+                   ObservationError=_F(INPUT_TYPE='Matrix',
+                                       data=_F(FROM='Script',
+                                               SCRIPT_FILE='test003_ADAO_scripts_for_JDC.py',),),
+                   ObservationOperator=_F(INPUT_TYPE='Matrix',
+                                          data=_F(FROM='Script',
+                                                  SCRIPT_FILE='test003_ADAO_scripts_for_JDC.py',),),);
diff --git a/src/examples/daSalome/test003_ADAO_scripts_for_JDC.py b/src/examples/daSalome/test003_ADAO_scripts_for_JDC.py
new file mode 100644 (file)
index 0000000..0b2a50c
--- /dev/null
@@ -0,0 +1,22 @@
+#-*-coding:iso-8859-1-*-
+import numpy
+#
+# Definition of the Background as a vector
+# ----------------------------------------
+Background = [0, 0, 0]
+#
+# Definition of the Observation as a vector
+# -----------------------------------------
+Observation = "1 1 1"
+#
+# Definition of the Background Error covariance as a matrix
+# ---------------------------------------------------------
+BackgroundError = numpy.array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])
+#
+# Definition of the Observation Error covariance as a matrix
+# ----------------------------------------------------------
+ObservationError = numpy.matrix("1 0 0 ; 0 1 0 ; 0 0 1")
+#
+# Definition of the Observation Operator as a matrix
+# --------------------------------------------------
+ObservationOperator = numpy.identity(3)
diff --git a/src/examples/daSalome/test004_ADAO_JDC_using_scripts.comm.in b/src/examples/daSalome/test004_ADAO_JDC_using_scripts.comm.in
new file mode 100644 (file)
index 0000000..9ad99eb
--- /dev/null
@@ -0,0 +1,29 @@
+
+ASSIMILATION_STUDY(Study_name='Test',
+                   Study_repertory='@prefix@/examples/daSalome',
+                   Debug=0,
+                   Algorithm='Blue',
+                   Background=_F(INPUT_TYPE='Vector',
+                                 data=_F(FROM='Script',
+                                         SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),),
+                   BackgroundError=_F(INPUT_TYPE='Matrix',
+                                      data=_F(FROM='Script',
+                                              SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),),
+                   Observation=_F(INPUT_TYPE='Vector',
+                                  data=_F(FROM='Script',
+                                          SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),),
+                   ObservationError=_F(INPUT_TYPE='Matrix',
+                                       data=_F(FROM='Script',
+                                               SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),),
+                   ObservationOperator=_F(INPUT_TYPE='Matrix',
+                                          data=_F(FROM='Script',
+                                                  SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),),
+                   UserPostAnalysis=_F(FROM='String',
+                                       STRING=
+"""import numpy
+Xa = ADD.get("Analysis").valueserie(-1)
+print
+print "Size of Analysis = %i"%len(Xa)
+print "Min, mean, max   = %8.3f, %8.3f, %8.3f"%(min(Xa),numpy.mean(Xa),max(Xa))
+print
+""",),);
diff --git a/src/examples/daSalome/test004_ADAO_scripts_for_JDC.py b/src/examples/daSalome/test004_ADAO_scripts_for_JDC.py
new file mode 100644 (file)
index 0000000..e94a254
--- /dev/null
@@ -0,0 +1,25 @@
+#-*-coding:iso-8859-1-*-
+import numpy
+#
+n = 100
+#
+# Definition of the Background as a vector
+# ----------------------------------------
+Background = n * [0]
+#
+# Definition of the Observation as a vector
+# -----------------------------------------
+Observation = n * "1 "
+Observation = Observation.strip()
+#
+# Definition of the Background Error covariance as a matrix
+# ---------------------------------------------------------
+BackgroundError = numpy.identity(n)
+#
+# Definition of the Observation Error covariance as a matrix
+# ----------------------------------------------------------
+ObservationError = numpy.identity(n)
+#
+# Definition of the Observation Operator as a matrix
+# --------------------------------------------------
+ObservationOperator = numpy.identity(n)