TNO Intern

Commit cec4b020 authored by Hen Brett's avatar Hen Brett 🐔
Browse files

Merge branch '84-fix-no-dask-bacend-bug' into 'main'

Resolve "Fix no dask bacend bug"

Closes #84

See merge request !101
parents 604d5c15 41213c12
Loading
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@ We also recognise that having to replace the Jar file everytime we update it is
Fixing a bug caused by the update in the Jar file. calculateDoubletPerformance in the Java source code returns Null if one of the optimizers failed. 
Pythermogis was still expecting a DoubletOutput class with all values set to -9999 in case of optimizer failure. 

Additionally:
    - two functions have been added to print out the environment variables THERMOGIS_JAR and JAVA_HOME. This enables users to debug if their are issues with their installation
Another bug was fixed, this occured when sampling for transmissivity with high or low p-values which caused an indexing error. 

Additional Functionality:
    - two functions have been added to print out the environment variables THERMOGIS_JAR and JAVA_HOME. This enables users to debug if their are issues with their installation.
+2 −1
Original line number Diff line number Diff line
@@ -4830,7 +4830,7 @@ packages:
- pypi: ./
  name: pythermogis
  version: 1.2.1
  sha256: 0ae9336fdba95931a8e5b2b0ce4a61acd3bcd3c3d685b2292b11e436d43245b0
  sha256: adc786bc376cdca6369d5cb58bd4bc7597c9c00a620cbeef48d591239c4ad966
  requires_dist:
  - jpype1>=1.5.2,<2
  - xarray==2024.9.0.*
@@ -4839,6 +4839,7 @@ packages:
  - build>=1.2.2.post1,<2
  - pygridsio>=1.0,<2.0
  - python-dotenv>=1.2.1,<2
  - dask>=2025.5.1,<2026
  requires_python: '>=3.11'
  editable: true
- conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.13.3-hf636f53_101_cp313.conda
+2 −1
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@ dependencies = [
    "pytz>=2024.1,<2025",
    "build>=1.2.2.post1,<2",
    "pygridsio>=1.0,<2.0",
    "python-dotenv>=1.2.1,<2"
    "python-dotenv>=1.2.1,<2",
    "dask>=2025.5.1,<2026"
]


+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ def generate_thickness_permeability_transmissivity_for_pvalues(thickness_mean: f
    # Sampling method for transmissivity
    transmissivity_samples = np.sort(np.exp(ln_permeability_dist.rvs(nSamples) + np.log(thickness_samples)))

    sample_indexes = np.array(p_value_fractions * nSamples)
    sample_indexes = np.array(p_value_fractions * (nSamples-1))
    transmissivity_pvalues_sampled = transmissivity_samples[sample_indexes.astype(int)]

    return thickness_pvalues, permeability_pvalues, transmissivity_pvalues_sampled
 No newline at end of file
+3 −3
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ class PyThermoGIS(TestCase):

    def test_doublet_speed(self):
        input_grids = self.read_input_grids()
        p_values = [10,50,90]
        p_values = [99]

        data = input_grids["thickness_mean"].data.flatten()
        non_nan_data = data[~np.isnan(data)]
@@ -29,13 +29,13 @@ class PyThermoGIS(TestCase):

        # Run calculation across all dimensions of input_grids, and all provided P_values: The Equivalent calculation with 10 cores takes 43 seconds in the Java code
        start = timeit.default_timer()
        calculate_doublet_performance_stochastic(input_grids, chunk_size=100, rng_seed=123, p_values=p_values)
        calculate_doublet_performance_stochastic(input_grids, chunk_size=5, rng_seed=123, p_values=p_values)
        time_elapsed = timeit.default_timer() - start
        print(f"Python calculation took {time_elapsed:.1f} seconds.")


    def read_input_grids(self):
        new_cellsize=5000 # in m
        new_cellsize=10000 # in m
        input_grids = resample_grid(read_grid(self.test_files_out_path / "ROSL_ROSLU__thick.zmap"), new_cellsize=new_cellsize).to_dataset(name="thickness_mean")
        input_grids["thickness_sd"] = resample_grid(read_grid(self.test_files_out_path / "ROSL_ROSLU__thick_sd.zmap"), new_cellsize=new_cellsize)
        input_grids["ntg"] = resample_grid(read_grid(self.test_files_out_path / "ROSL_ROSLU__ntg.zmap"), new_cellsize=new_cellsize)
Loading