"MahalanobisConsistency",
"OMA",
"OMB",
+ "SampledStateForQuantiles",
"SigmaBck2",
"SigmaObs2",
"SimulatedObservationAtBackground",
self.StoredVariables["MahalanobisConsistency"].store( float( 2.*J/d.size ) )
if self._toStore("SimulationQuantiles"):
nech = self._parameters["NumberOfSamplesForQuantiles"]
+ EXr = None
YfQ = None
for i in range(nech):
if self._parameters["SimulationForQuantiles"] == "Linear":
dXr = numpy.matrix(numpy.random.multivariate_normal(Xa.A1,A) - Xa.A1).T
dYr = numpy.matrix(numpy.ravel( Hm * dXr )).T
Yr = HXa + dYr
+ if selfA._toStore("SampledStateForQuantiles"): Xr = Xa+dXr
elif self._parameters["SimulationForQuantiles"] == "NonLinear":
Xr = numpy.matrix(numpy.random.multivariate_normal(Xa.A1,A)).T
Yr = numpy.matrix(numpy.ravel( Hm * Xr )).T
if YfQ is None:
YfQ = Yr
+ if selfA._toStore("SampledStateForQuantiles"): EXr = numpy.ravel(Xr)
else:
YfQ = numpy.hstack((YfQ,Yr))
+ if selfA._toStore("SampledStateForQuantiles"): EXr = numpy.vstack((EXr,numpy.ravel(Xr)))
YfQ.sort(axis=-1)
YQ = None
for quantile in self._parameters["Quantiles"]:
if YQ is None: YQ = YfQ[:,indice]
else: YQ = numpy.hstack((YQ,YfQ[:,indice]))
self.StoredVariables["SimulationQuantiles"].store( YQ )
+ if selfA._toStore("SampledStateForQuantiles"):
+ selfA.StoredVariables["SampledStateForQuantiles"].store( EXr.T )
if self._toStore("SimulatedObservationAtBackground"):
self.StoredVariables["SimulatedObservationAtBackground"].store( numpy.ravel(HXb) )
if self._toStore("SimulatedObservationAtCurrentState"):
"MahalanobisConsistency",
"OMA",
"OMB",
+ "SampledStateForQuantiles",
"SigmaBck2",
"SigmaObs2",
"SimulatedObservationAtBackground",
nech = self._parameters["NumberOfSamplesForQuantiles"]
HtM = HO["Tangent"].asMatrix(ValueForMethodForm = Xa)
HtM = HtM.reshape(Y.size,Xa.size) # ADAO & check shape
+ EXr = None
YfQ = None
for i in range(nech):
if self._parameters["SimulationForQuantiles"] == "Linear":
dXr = numpy.matrix(numpy.random.multivariate_normal(Xa.A1,A) - Xa.A1).T
dYr = numpy.matrix(numpy.ravel( HtM * dXr )).T
Yr = HXa + dYr
+ if selfA._toStore("SampledStateForQuantiles"): Xr = Xa+dXr
elif self._parameters["SimulationForQuantiles"] == "NonLinear":
Xr = numpy.matrix(numpy.random.multivariate_normal(Xa.A1,A)).T
Yr = numpy.matrix(numpy.ravel( H( Xr ) )).T
if YfQ is None:
YfQ = Yr
+ if selfA._toStore("SampledStateForQuantiles"): EXr = numpy.ravel(Xr)
else:
YfQ = numpy.hstack((YfQ,Yr))
+ if selfA._toStore("SampledStateForQuantiles"): EXr = numpy.vstack((EXr,numpy.ravel(Xr)))
YfQ.sort(axis=-1)
YQ = None
for quantile in self._parameters["Quantiles"]:
if YQ is None: YQ = YfQ[:,indice]
else: YQ = numpy.hstack((YQ,YfQ[:,indice]))
self.StoredVariables["SimulationQuantiles"].store( YQ )
+ if selfA._toStore("SampledStateForQuantiles"):
+ selfA.StoredVariables["SampledStateForQuantiles"].store( EXr.T )
if self._toStore("SimulatedObservationAtBackground"):
self.StoredVariables["SimulatedObservationAtBackground"].store( numpy.ravel(HXb) )
if self._toStore("SimulatedObservationAtCurrentState"):
- OMB : Observation moins Background : Y - Xb
- ForecastState : état prédit courant lors d'itérations
- Residu : dans le cas des algorithmes de vérification
+ - SampledStateForQuantiles : échantillons d'états pour l'estimation des quantiles
- SigmaBck2 : indicateur de correction optimale des erreurs d'ébauche
- SigmaObs2 : indicateur de correction optimale des erreurs d'observation
- SimulatedObservationAtBackground : l'état observé H(Xb) à l'ébauche
self.StoredVariables["OMA"] = Persistence.OneVector(name = "OMA")
self.StoredVariables["OMB"] = Persistence.OneVector(name = "OMB")
self.StoredVariables["Residu"] = Persistence.OneScalar(name = "Residu")
+ self.StoredVariables["SampledStateForQuantiles"] = Persistence.OneMatrix(name = "SampledStateForQuantiles")
self.StoredVariables["SigmaBck2"] = Persistence.OneScalar(name = "SigmaBck2")
self.StoredVariables["SigmaObs2"] = Persistence.OneScalar(name = "SigmaObs2")
self.StoredVariables["SimulatedObservationAtBackground"] = Persistence.OneVector(name = "SimulatedObservationAtBackground")
import ExtendedLogging ; ExtendedLogging.ExtendedLogging(level=20)
On peut éventuellement demander à l'objet de sortir aussi les messages dans
- un fichier (noms par défaut : Aidsm.log, niveau NOTSET) :
+ un fichier (noms par défaut : AdaoOutputLogfile.log, niveau NOTSET) :
import ExtendedLogging ; ExtendedLogging.ExtendedLogging().setLogfile()
Si on veut changer le nom du fichier ou le niveau global de message, il faut
import time
from daCore import PlatformInfo
-LOGFILE = os.path.join(os.path.abspath(os.curdir),"AssimilationStudy.log")
+LOGFILE = os.path.join(os.path.abspath(os.curdir),"AdaoOutputLogfile.log")
# ==============================================================================
class ExtendedLogging(object):
EnKS
"""
#
- # Initialisations
- # ---------------
- #
# Opérateurs
H = HO["Direct"].appliedControledFormTo
#
# Précalcul des inversions de B et R
RIdemi = R.sqrtmI()
#
+ # Durée d'observation et tailles
LagL = selfA._parameters["SmootherLagL"]
if (not hasattr(Y,"store")) or (not hasattr(Y,"stepnumber")):
raise ValueError("Fixed-lag smoother requires a series of observation")
raise ValueError("VariantM has to be chosen in the authorized methods list.")
#
selfA.StoredVariables["CurrentIterationNumber"].store( len(selfA.StoredVariables["Analysis"]) )
+ # ---> avec analysis
selfA.StoredVariables["Analysis"].store( Xa )
if selfA._toStore("APosterioriCovariance"):
selfA.StoredVariables["APosterioriCovariance"].store( EnsembleErrorCovariance(EXn) )
__msg += "\n%s%30s : %s" %(__prefix,"sys.getfilesystemencoding",str(sys.getfilesystemencoding()))
__msg += "\n%s%30s : %s" %(__prefix,"locale.getdefaultlocale",str(locale.getdefaultlocale()))
__msg += "\n"
+ __msg += "\n%s%30s : %s" %(__prefix,"os.cpu_count",os.cpu_count())
+ if hasattr(os, 'sched_getaffinity'):
+ __msg += "\n%s%30s : %s" %(__prefix,"len(os.sched_getaffinity(0))",len(os.sched_getaffinity(0)))
+ else:
+ __msg += "\n%s%30s : %s" %(__prefix,"len(os.sched_getaffinity(0))","Unsupported on this platform")
+ __msg += "\n"
__msg += "\n%s%30s : %s" %(__prefix,"platform.node",platform.node())
__msg += "\n%s%30s : %s" %(__prefix,"os.path.expanduser",os.path.expanduser('~'))
return __msg