1 # -*- coding: utf-8 -*-
3 # Copyright (C) 2008-2020 EDF R&D
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/
21 # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
23 =====================================================
24 ADAO: A module for Data Assimilation and Optimization
25 =====================================================
30 **The ADAO module provides data assimilation and optimization**
31 features in Python or SALOME context (see
32 http://www.salome-platform.org/). Briefly stated, Data Assimilation is
33 a methodological framework to compute the optimal estimate of the
34 inaccessible true value of a system state, eventually over time. It
35 uses information coming from experimental measurements or observations,
36 and from numerical *a priori* models, including information about their
37 errors. Parts of the framework are also known under the names of
38 *parameter estimation*, *inverse problems*, *Bayesian estimation*,
39 *optimal interpolation*, etc. More details can be found in the full
40 ADAO documentation (see http://www.salome-platform.org/).
42 Only the use of ADAO text programming interface (API/TUI) is introduced
43 here. This interface gives ability to create a calculation object in a
44 similar way than the case building obtained through the graphical
45 interface (GUI). When one wants to elaborate "by hand" the TUI
46 calculation case, it is recommended to extensively use all the ADAO
47 module documentation, and to go back if necessary to the graphical
48 interface (GUI), to get all the elements allowing to correctly set the
51 A simple setup example of an ADAO TUI calculation case
52 ------------------------------------------------------
54 To introduce the TUI interface, lets begin by a simple but complete
55 example of ADAO calculation case. All the data are explicitly defined
56 inside the script in order to make the reading easier. The whole set of
57 commands is the following one::
59 from numpy import array, matrix
60 from adao import adaoBuilder
61 case = adaoBuilder.New()
62 case.set( 'AlgorithmParameters', Algorithm='3DVAR' )
63 case.set( 'Background', Vector=[0, 1, 2] )
64 case.set( 'BackgroundError', ScalarSparseMatrix=1.0 )
65 case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) )
66 case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' )
67 case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' )
68 case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" )
71 The result of running these commands in SALOME (either as a SALOME
72 "*shell*" command, in the Python command window of the interface, or by
73 the script execution entry of the menu) is the following::
75 Analysis [ 0.25000264 0.79999797 0.94999939]
77 More advanced examples of ADAO TUI calculation case
78 ---------------------------------------------------
80 Real cases involves observations loaded from files, operators
81 explicitly defined as generic functions including physical simulators,
82 time dependant information in order to deal with forecast analysis in
83 addition to calibration or re-analysis. More details can be found in
84 the full ADAO documentation (see http://www.salome-platform.org/).
86 License and requirements
87 ------------------------
89 The license for this module is the GNU Lesser General Public License
90 (Lesser GPL), as stated here and in the source files::
92 <ADAO, a module for Data Assimilation and Optimization>
94 Copyright (C) 2008-2020 EDF R&D
96 This library is free software; you can redistribute it and/or
97 modify it under the terms of the GNU Lesser General Public
98 License as published by the Free Software Foundation; either
99 version 2.1 of the License, or (at your option) any later version.
101 This library is distributed in the hope that it will be useful,
102 but WITHOUT ANY WARRANTY; without even the implied warranty of
103 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
104 Lesser General Public License for more details.
106 You should have received a copy of the GNU Lesser General Public
107 License along with this library; if not, write to the Free Software
108 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
110 See http://www.salome-platform.org/
112 In addition, we require that all publication or presentation describing
113 work using this software, or all commercial or not products using it,
114 quote at least one of the references given below:
116 * ADAO, a module for Data Assimilation and Optimization,
117 http://www.salome-platform.org/
119 * SALOME The Open Source Integration Platform for Numerical Simulation,
120 http://www.salome-platform.org/
122 The documentation of the module is also covered by the license and the
123 requirement of quoting.
126 import os, sys, logging
127 adao_py_dir = os.path.abspath(os.path.dirname(__file__))
128 sys.path.insert(0, adao_py_dir)
130 from daCore.version import name, version, year, date
132 from daYacsIntegration.daOptimizerLoop import *
134 logging.debug("INIT Pas de chargement initial de daOptimizerLoop")