TNO Intern

Commit 8ca48b51 authored by Hen Brett's avatar Hen Brett 🐔
Browse files

Testing performance

parent 21dd9b85
Loading
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ def calculate_performance_of_single_location(mask: float, depth: float, thicknes
    if not np.isnan(mask) or temperature < utc_properties.minProdTemp():
        return (mask_value,) * 14

    use_java_backend = False
    use_java_backend = True
    if use_java_backend:
        doublet = instantiate_thermogis_doublet(utc_properties, rng_seed)
        JavaDoubletInput = JClass("thermogis.calc.utc.doublet.records.DoubletInput")
@@ -172,8 +172,7 @@ def calculate_performance_of_single_location(mask: float, depth: float, thicknes
    else:
        utc_cut = utc_properties.utcCutoff()

    hprod = results.hprod
    npv = 1e-6 * (utc_cut - results.utc) * 3.6 * hprod * (1 - utc_properties.taxRate())
    npv = 1e-6 * (utc_cut - results.utc) * 3.6 * results.hprod * (1 - utc_properties.taxRate())

    # get values from doublet
    output_values = {"power": results.power,
@@ -182,7 +181,7 @@ def calculate_performance_of_single_location(mask: float, depth: float, thicknes
                     "opex": results.opex,
                     "utc": results.utc,
                     "npv": npv,
                     "hprod": hprod,
                     "hprod": results.hprod,
                     "cop": results.cop,
                     "cophp": results.cophp,
                     "pres": results.pres,
+2 −2
Original line number Diff line number Diff line
@@ -29,12 +29,12 @@ class PyThermoGIS(TestCase):

        # Run calculation across all dimensions of input_grids, and all provided P_values
        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=10, 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=15e3 # in m
        new_cellsize=10e3 # 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)