From a1d2221f496eea9063e6cf85c1959ac77a2cd47e Mon Sep 17 00:00:00 2001 From: "Wang, Wenjing" Date: Wed, 29 Nov 2023 14:54:20 -0800 Subject: [PATCH] fix the mask issue --- SOSAT/risk_analysis/critically_oriented_fault.py | 2 +- SOSAT/risk_analysis/hydraulic_fracture.py | 2 +- SOSAT/stress_state.py | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/SOSAT/risk_analysis/critically_oriented_fault.py b/SOSAT/risk_analysis/critically_oriented_fault.py index b90508b..f287392 100644 --- a/SOSAT/risk_analysis/critically_oriented_fault.py +++ b/SOSAT/risk_analysis/critically_oriented_fault.py @@ -165,7 +165,7 @@ def PlotFailureProbability(self, fig = plt.figure(figsize=(figwidth, figwidth * 0.7)) ax = fig.add_subplot(111) ax.plot(P, Pfail, "k") - ax.set_xlabel("Pore Pressure") + ax.set_xlabel("Pore Pressure (" + self.ss.stress_unit + ")") ax.set_ylabel("Probability of Fault Activation") plt.tight_layout() diff --git a/SOSAT/risk_analysis/hydraulic_fracture.py b/SOSAT/risk_analysis/hydraulic_fracture.py index 629b8df..5c1c0e2 100644 --- a/SOSAT/risk_analysis/hydraulic_fracture.py +++ b/SOSAT/risk_analysis/hydraulic_fracture.py @@ -161,7 +161,7 @@ def PlotFailureProbability(self, fig = plt.figure(figsize=(figwidth, figwidth * 0.7)) ax = fig.add_subplot(111) ax.plot(P, Pfail, "k") - ax.set_xlabel("Pore Pressure") + ax.set_xlabel("Pore Pressure (" + self.ss.stress_unit + ")") ax.set_ylabel("Probability of Hydraulic Fracturing") plt.tight_layout() diff --git a/SOSAT/stress_state.py b/SOSAT/stress_state.py index fc59d7c..771b78c 100644 --- a/SOSAT/stress_state.py +++ b/SOSAT/stress_state.py @@ -349,6 +349,12 @@ def evaluate_posterior(self): log_posterior = log_posterior + loglikelihood self.posterior = np.exp(log_posterior) + # reset the mask to account for the problem of mask + # getting changed when ma.log(0)=Masked in the + # c.loglikelihood(self) function + # set the posterior to zero where the mask has changed + indicator = self.posterior.mask != self.shmin_grid.mask + self.posterior[indicator] = 0 # now normalize tot = ma.sum(self.posterior) self.posterior = self.posterior / tot