Loading src/tranissmivity/calculate_thick_perm_trans.py +2 −3 Original line number Diff line number Diff line Loading @@ -26,14 +26,13 @@ def generate_thickness_permeability_transmissivity_for_pvalues(thickness_mean: f if isinstance(p_values, np.int64) or isinstance(p_values, int): if p_values == 50: return np.array([thickness_mean]), np.array([ln_permeability_mean]), np.array([np.exp(np.log(thickness_mean) + ln_permeability_mean)]) return np.array([thickness_mean]), np.array([np.exp(ln_permeability_mean)]), np.array([thickness_mean * np.exp(ln_permeability_mean)]) else: if len(p_values) == 1 and p_values[0] == 50: # The only value where we analytically know the output is the P50 return np.array([thickness_mean]), np.array([ln_permeability_mean]), np.array([np.exp(np.log(thickness_mean) + ln_permeability_mean)]) return np.array([thickness_mean]), np.array([np.exp(ln_permeability_mean)]), np.array([thickness_mean * np.exp(ln_permeability_mean)]) p_value_fractions = 1 - p_values / 100 if thickness_sd == 0: thickness_pvalues = np.full(len(p_value_fractions), thickness_mean) thickness_samples = np.full(nSamples, thickness_mean) Loading tests/resources/test_output/trans_test.pngdeleted 100644 → 0 −95.4 KiB Loading image diff... tests/test_doublet.py +1 −1 Original line number Diff line number Diff line Loading @@ -130,7 +130,7 @@ class PyThermoGIS(TestCase): xr.testing.assert_allclose(output_grids.power, read_grid(benchmark_path / f"simplified__power_P{p_value}{scenario}.nc"), atol=1.0) xr.testing.assert_allclose(output_grids.utc, read_grid(benchmark_path / f"simplified__utc_P{p_value}{scenario}.nc"), atol=0.1) xr.testing.assert_allclose(output_grids.npv, read_grid(benchmark_path / f"simplified__npv_P{p_value}{scenario}.nc"), atol=0.5) xr.testing.assert_allclose(output_grids.hprod, read_grid(benchmark_path / f"simplified__hprod_P{p_value}{scenario}.nc"), atol=30000) xr.testing.assert_allclose(output_grids.hprod, read_grid(benchmark_path / f"simplified__hprod_P{p_value}{scenario}.nc"), atol=40000) xr.testing.assert_allclose(output_grids.cop, read_grid(benchmark_path / f"simplified__cop_P{p_value}{scenario}.nc"), atol=1.0) xr.testing.assert_allclose(output_grids.pres, read_grid(benchmark_path / f"simplified__pres_P{p_value}{scenario}.nc"), atol=2.0) xr.testing.assert_allclose(output_grids.flow_rate, read_grid(benchmark_path / f"simplified__flowr_P{p_value}{scenario}.nc"), atol=5) Loading tests/test_transmissivity_calculation.py +5 −4 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ from thermogis_classes.jvm_start import start_jvm class PyThermoGIS(TestCase): test_files_out_path = Path(path.dirname(path.dirname(__file__)), "tests", "resources") / "test_output" def test_transmissivity_calculation(self): """ When calculating the Transmissivity values in the python code, we get a different value than the values from the java benchmark; Loading @@ -26,7 +27,7 @@ class PyThermoGIS(TestCase): thickness_sd = 5 ln_perm_mean = 5 ln_perm_sd = 0.5 nSamples = 10000000 nSamples = 100000 p_values_list = [10, 20, 30, 40, 50, 60, 70, 80, 90] # Loading Loading @@ -63,7 +64,7 @@ class PyThermoGIS(TestCase): # # Plotting # plot = False plot = True if plot: # Plot the transmissivity as a function of pvalue for both the python and Java implementation fig, axes = plt.subplots(1, 4, figsize=(20, 10)) Loading @@ -86,11 +87,11 @@ class PyThermoGIS(TestCase): axes[3].set_title("Difference between Python and Java Transmissivity") axes[3].scatter(p_values_list, trans_p_value_java - transmissivity) [ax.legend() for ax in axes] [ax.legend() for ax in axes[:-1]] plt.savefig(self.test_files_out_path / "trans_test") # Assert self.assertTrue(np.allclose(transmissivity.values, trans_p_value_java, atol=1000)) self.assertTrue(np.allclose(transmissivity.values, trans_p_value_java, atol=200)) def generate_transmissivity_java(self, ln_perm_mean, ln_perm_sd, nSamples, p_values_list, thickness_mean, thickness_sd): start_jvm() Loading Loading
src/tranissmivity/calculate_thick_perm_trans.py +2 −3 Original line number Diff line number Diff line Loading @@ -26,14 +26,13 @@ def generate_thickness_permeability_transmissivity_for_pvalues(thickness_mean: f if isinstance(p_values, np.int64) or isinstance(p_values, int): if p_values == 50: return np.array([thickness_mean]), np.array([ln_permeability_mean]), np.array([np.exp(np.log(thickness_mean) + ln_permeability_mean)]) return np.array([thickness_mean]), np.array([np.exp(ln_permeability_mean)]), np.array([thickness_mean * np.exp(ln_permeability_mean)]) else: if len(p_values) == 1 and p_values[0] == 50: # The only value where we analytically know the output is the P50 return np.array([thickness_mean]), np.array([ln_permeability_mean]), np.array([np.exp(np.log(thickness_mean) + ln_permeability_mean)]) return np.array([thickness_mean]), np.array([np.exp(ln_permeability_mean)]), np.array([thickness_mean * np.exp(ln_permeability_mean)]) p_value_fractions = 1 - p_values / 100 if thickness_sd == 0: thickness_pvalues = np.full(len(p_value_fractions), thickness_mean) thickness_samples = np.full(nSamples, thickness_mean) Loading
tests/test_doublet.py +1 −1 Original line number Diff line number Diff line Loading @@ -130,7 +130,7 @@ class PyThermoGIS(TestCase): xr.testing.assert_allclose(output_grids.power, read_grid(benchmark_path / f"simplified__power_P{p_value}{scenario}.nc"), atol=1.0) xr.testing.assert_allclose(output_grids.utc, read_grid(benchmark_path / f"simplified__utc_P{p_value}{scenario}.nc"), atol=0.1) xr.testing.assert_allclose(output_grids.npv, read_grid(benchmark_path / f"simplified__npv_P{p_value}{scenario}.nc"), atol=0.5) xr.testing.assert_allclose(output_grids.hprod, read_grid(benchmark_path / f"simplified__hprod_P{p_value}{scenario}.nc"), atol=30000) xr.testing.assert_allclose(output_grids.hprod, read_grid(benchmark_path / f"simplified__hprod_P{p_value}{scenario}.nc"), atol=40000) xr.testing.assert_allclose(output_grids.cop, read_grid(benchmark_path / f"simplified__cop_P{p_value}{scenario}.nc"), atol=1.0) xr.testing.assert_allclose(output_grids.pres, read_grid(benchmark_path / f"simplified__pres_P{p_value}{scenario}.nc"), atol=2.0) xr.testing.assert_allclose(output_grids.flow_rate, read_grid(benchmark_path / f"simplified__flowr_P{p_value}{scenario}.nc"), atol=5) Loading
tests/test_transmissivity_calculation.py +5 −4 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ from thermogis_classes.jvm_start import start_jvm class PyThermoGIS(TestCase): test_files_out_path = Path(path.dirname(path.dirname(__file__)), "tests", "resources") / "test_output" def test_transmissivity_calculation(self): """ When calculating the Transmissivity values in the python code, we get a different value than the values from the java benchmark; Loading @@ -26,7 +27,7 @@ class PyThermoGIS(TestCase): thickness_sd = 5 ln_perm_mean = 5 ln_perm_sd = 0.5 nSamples = 10000000 nSamples = 100000 p_values_list = [10, 20, 30, 40, 50, 60, 70, 80, 90] # Loading Loading @@ -63,7 +64,7 @@ class PyThermoGIS(TestCase): # # Plotting # plot = False plot = True if plot: # Plot the transmissivity as a function of pvalue for both the python and Java implementation fig, axes = plt.subplots(1, 4, figsize=(20, 10)) Loading @@ -86,11 +87,11 @@ class PyThermoGIS(TestCase): axes[3].set_title("Difference between Python and Java Transmissivity") axes[3].scatter(p_values_list, trans_p_value_java - transmissivity) [ax.legend() for ax in axes] [ax.legend() for ax in axes[:-1]] plt.savefig(self.test_files_out_path / "trans_test") # Assert self.assertTrue(np.allclose(transmissivity.values, trans_p_value_java, atol=1000)) self.assertTrue(np.allclose(transmissivity.values, trans_p_value_java, atol=200)) def generate_transmissivity_java(self, ln_perm_mean, ln_perm_sd, nSamples, p_values_list, thickness_mean, thickness_sd): start_jvm() Loading