Commit d4522c04 authored by Ingrid Luijkx's avatar Ingrid Luijkx
Browse files

Small fix logging localization when set to None

parent b13b5851
...@@ -48,12 +48,13 @@ class CtOptimizer(Optimizer): ...@@ -48,12 +48,13 @@ class CtOptimizer(Optimizer):
else: else:
self.localization = False self.localization = False
self.localizetype = 'None' self.localizetype = 'None'
self.tvalue = 0
logging.info("Current localization option is set to %s" % self.localizetype) logging.info("Current localization option is set to %s" % self.localizetype)
logging.info("Used critical tvalue %0.05f is based on 95%% probability and %i ensemble members in a two-tailed student's T-test"%(self.tvalue,self.nmembers))
if self.tvalue == 0: if self.tvalue == 0:
logging.error("Critical tvalue for localization not set for %i ensemble members"%(self.nmembers)) logging.error("Critical tvalue for localization not set for %i ensemble members"%(self.nmembers))
sys.exit(2) sys.exit(2)
else: logging.info("Used critical tvalue %0.05f is based on 95%% probability and %i ensemble members in a two-tailed student's T-test"%(self.tvalue,self.nmembers))
def localize(self, n): def localize(self, n):
""" localize the Kalman Gain matrix """ """ localize the Kalman Gain matrix """
...@@ -66,7 +67,7 @@ class CtOptimizer(Optimizer): ...@@ -66,7 +67,7 @@ class CtOptimizer(Optimizer):
count_localized = 0 count_localized = 0
for r in range(self.nlag * self.nparams): for r in range(self.nlag * self.nparams):
corr = np.corrcoef(self.HX_prime[n, :], self.X_prime[r, :].squeeze())[0, 1] corr = np.corrcoef(self.HX_prime[n, :], self.X_prime[r, :].squeeze())[0, 1]
prob = corr / np.sqrt((1.0 - corr ** 2) / (self.nmembers - 2)) prob = corr / np.sqrt((1.000000001 - corr ** 2) / (self.nmembers - 2))
if abs(prob) < self.tvalue: if abs(prob) < self.tvalue:
self.KG[r, n] = 0.0 self.KG[r, n] = 0.0
count_localized = count_localized + 1 count_localized = count_localized + 1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment