From 2f25df2a41a098a124d847c367c3528805b25e35 Mon Sep 17 00:00:00 2001 From: dougchristie Date: Fri, 22 May 2026 21:28:41 -0600 Subject: [PATCH 1/2] Fix Simandoux Sw exponent and mud-filtrate salinity input - Simandoux water saturation used (d**2 + e) ** 0.2; the closed-form quadratic solution requires a square root (** 0.5). With the fix, Simandoux correctly reduces to Archie when Vclay = 0. - Correct the matching Simandoux docstring to use a square root instead of a square so the documented equation matches the code. - rmf68 (mud-filtrate resistivity at 68 F) was scaled by rws (water) instead of rmfs (filtrate), corrupting filtrate salinity, density, and neutron response. Now uses rmfs. Both bugs date to the initial commit (1b54d5e). Co-Authored-By: Claude Opus 4.7 --- petropy/log.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/petropy/log.py b/petropy/log.py index a714f89..d30f5d6 100755 --- a/petropy/log.py +++ b/petropy/log.py @@ -492,7 +492,7 @@ def fluid_properties(self, top = 0, bottom = 100000, mast = 67, rmf = (rmft + 6.77) / (form_temp + 6.77) * rmfs rw68 = (rwt + 6.77) / (68 + 6.77) * rws - rmf68 = (rmft + 6.77) / (68 + 6.77) * rws + rmf68 = (rmft + 6.77) / (68 + 6.77) * rmfs ### weight percent total disolved solids ### xsaltw = 10 ** (-0.5268 * (np.log10(rw68) ) ** 3 - 1.0199 * \ @@ -1254,7 +1254,7 @@ def multimineral_model(self, top = None, bottom = None, e &= \\frac{c}{RESDEEP\_LOG} - SW &= ((d^2 + e)^2 - d)^{\\frac{2}{n}} + SW &= (\sqrt{d^2 + e} - d)^{\\frac{2}{n}} III. Modified Simandoux @@ -2113,7 +2113,7 @@ def multimineral_model(self, top = None, bottom = None, c = (1.0 - vclay) * a * self['RW'][i] / (phis ** m) d = c * vclay / (2.0 * rt_clay) e = c / self['RESDEEP_N'][i] - sw_simandoux = np.clip(((d**2 + e) ** 0.2 - d) ** \ + sw_simandoux = np.clip(((d**2 + e) ** 0.5 - d) ** \ (2 / n), 0, 1) ### modified Simandoux ### From 9c38db822ec83e907c174cfb0574de8a0a07d2e3 Mon Sep 17 00:00:00 2001 From: dougchristie Date: Mon, 25 May 2026 22:59:26 -0600 Subject: [PATCH 2/2] Fix blank porosity track: use nanmean for auto Buckles parameter The auto-computed buckles_parameter used np.mean over the calc interval. Any null sample in the interval (typical of real logs) made the mean NaN, which cascaded to BVWI and BVWF being NaN at every depth. In the viewer's cumulative POROSITY track, BVWI/BVWF are stacked first, so the NaN running-sum also blanked BVH -> the entire porosity track rendered empty. Using np.nanmean repopulates BVWI/BVWF at valid depths and the porosity band displays correctly. Co-Authored-By: Claude Opus 4.7 --- petropy/log.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/petropy/log.py b/petropy/log.py index d30f5d6..1cf809d 100755 --- a/petropy/log.py +++ b/petropy/log.py @@ -2251,8 +2251,8 @@ def multimineral_model(self, top = None, bottom = None, ### since parameters depend on calculated values ### if buckles_parameter < 0: - buckles_parameter=np.mean(self['PHIE'][depth_index] * \ - self['SW'][depth_index]) + buckles_parameter=np.nanmean(self['PHIE'][depth_index] * \ + self['SW'][depth_index]) ir_denom = (self['PHIE'][depth_index] / \ (1 - self['VCLAY'][depth_index]))