From 356a853459b7efd7bb081d4e94a87ad5ef99fa99 Mon Sep 17 00:00:00 2001 From: bretth Date: Fri, 21 Nov 2025 12:46:40 +0100 Subject: [PATCH] Adding two functions which print the location of the java virtual machine and the thermogis jar path --- src/pythermogis/__init__.py | 2 +- src/pythermogis/thermogis_classes/doublet.py | 3 +++ src/pythermogis/thermogis_classes/jvm_start.py | 14 ++++++++++++++ tests/test_java_installation.py | 9 +++++++-- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/pythermogis/__init__.py b/src/pythermogis/__init__.py index e8b76fd..6d77ee8 100644 --- a/src/pythermogis/__init__.py +++ b/src/pythermogis/__init__.py @@ -8,4 +8,4 @@ from pythermogis.doublet_simulation.deterministic_doublet import * from pythermogis.doublet_simulation.stochastic_doublet import * from pythermogis.plotting.plot_exceedance import plot_exceedance from pythermogis.dask_utils.auto_chunk import auto_chunk_dataset -from pythermogis.dask_utils.assess_optimal_chunk_size import assess_optimal_chunk_size \ No newline at end of file +from pythermogis.dask_utils.assess_optimal_chunk_size import assess_optimal_chunk_size diff --git a/src/pythermogis/thermogis_classes/doublet.py b/src/pythermogis/thermogis_classes/doublet.py index 3360a82..c82e3fe 100644 --- a/src/pythermogis/thermogis_classes/doublet.py +++ b/src/pythermogis/thermogis_classes/doublet.py @@ -122,6 +122,9 @@ def calculate_performance_of_single_location(mask: float, depth: float, thicknes results = doublet.calculateDoubletPerformance(input) # If calculation was not successful, return mask value + if results is None: + return (mask_value,) * 14 + if results.utc() == -9999.0: return (mask_value,) * 14 diff --git a/src/pythermogis/thermogis_classes/jvm_start.py b/src/pythermogis/thermogis_classes/jvm_start.py index a4f72f3..2bff185 100644 --- a/src/pythermogis/thermogis_classes/jvm_start.py +++ b/src/pythermogis/thermogis_classes/jvm_start.py @@ -48,3 +48,17 @@ def close_jvm(): """ if jpype.isJVMStarted(): jpype.shutdownJVM() + +def print_java_path(): + """ + This method prints the path to the JVM being used + :return: + """ + print(os.getenv("JAVA_HOME")) + +def print_thermogis_jar_path(): + """ + This method prints the path to the Thermogis Jar being used + :return: + """ + print(get_thermogis_jar_path()) diff --git a/tests/test_java_installation.py b/tests/test_java_installation.py index e9dccde..1dea75f 100644 --- a/tests/test_java_installation.py +++ b/tests/test_java_installation.py @@ -1,4 +1,9 @@ -from pythermogis import start_jvm +from pythermogis import print_java_path, print_thermogis_jar_path, start_jvm + def test_JVM_start(): - start_jvm() \ No newline at end of file + start_jvm() + +def test_JVM_JAR_print(): + print_java_path() + print_thermogis_jar_path() \ No newline at end of file -- GitLab