From 6a7bec701c26d2a3c0ac3d94a8c3d43276fa5ab4 Mon Sep 17 00:00:00 2001
From: Malcolm  Ross <malcolmgti@gmail.com>
Date: Thu, 2 May 2024 08:49:06 -0500
Subject: [PATCH] Small changes to make Economics calculation cleaer and more
 correct; fixed bug in HTML output

---
 src/geophires_x/Economics.py      | 12 +++++++-----
 src/geophires_x/GeoPHIRESUtils.py |  2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/geophires_x/Economics.py b/src/geophires_x/Economics.py
index 92e6748f..c137750c 100644
--- a/src/geophires_x/Economics.py
+++ b/src/geophires_x/Economics.py
@@ -2332,7 +2332,7 @@ def Calculate(self, model: Model) -> None:
                     vert_depth_km = model.reserv.InputDepth.quantity().to('km').magnitude
                 model.wellbores.injection_reservoir_depth.value = vert_depth_km
 
-                tot, vert, horiz = calculate_total_drilling_lengths_m(model.wellbores.Configuration.value,
+                tot_m, tot_vert_m, tot_horiz_m = calculate_total_drilling_lengths_m(model.wellbores.Configuration.value,
                                                                       model.wellbores.numnonverticalsections.value,
                                                                       model.wellbores.Nonvertical_length.value / 1000.0,
                                                                       vert_depth_km,
@@ -2340,12 +2340,13 @@ def Calculate(self, model: Model) -> None:
                                                                       model.wellbores.ninj.value)
 
             else:
-                tot = vert = model.reserv.depth.quantity().to('km').magnitude
-                horiz = 0.0
+                tot_m = tot_vert_m = model.reserv.depth.quantity().to('km').magnitude
+                tot_horiz_m = 0.0
                 if not model.wellbores.injection_reservoir_depth.Provided:
                     model.wellbores.injection_reservoir_depth.value = model.reserv.depth.quantity().to('km').magnitude
                 else:
                     model.wellbores.injection_reservoir_depth.value = model.wellbores.injection_reservoir_depth.quantity().to('km').magnitude
+
             self.cost_one_production_well.value = calculate_cost_of_one_vertical_well(model, model.reserv.depth.quantity().to('m').magnitude,
                                                                                       self.wellcorrelation.value,
                                                                                       self.Vertical_drilling_cost_per_m.value,
@@ -2362,12 +2363,13 @@ def Calculate(self, model: Model) -> None:
                                                                                          self.injection_well_cost_adjustment_factor.value)
 
             if hasattr(model.wellbores, 'numnonverticalsections') and model.wellbores.numnonverticalsections.Provided:
-                cost_nonvertical_section = calculate_cost_of_non_vertical_section(model, horiz, self.wellcorrelation.value,
+                cost_nonvertical_section = calculate_cost_of_non_vertical_section(model, tot_horiz_m,
+                                            self.wellcorrelation.value,
                                             self.Nonvertical_drilling_cost_per_m.value,
                                             model.wellbores.numnonverticalsections.value,
                                             self.per_injection_well_cost.Name,
                                             model.wellbores.NonverticalsCased.value,
-                                            1.0)
+                                            self.production_well_cost_adjustment_factor.value)
             else:
                 cost_nonvertical_section = 0.0
             # cost of the well field
diff --git a/src/geophires_x/GeoPHIRESUtils.py b/src/geophires_x/GeoPHIRESUtils.py
index 885aebee..64a7e8b8 100644
--- a/src/geophires_x/GeoPHIRESUtils.py
+++ b/src/geophires_x/GeoPHIRESUtils.py
@@ -101,7 +101,7 @@ def InsertImagesIntoHTML(html_path: str, short_names: set, full_names: set) -> N
     insert_string = ''
     for _ in range(len(full_names)):
         name_to_use = short_names.pop()
-        insert_string = insert_string + f'<img src="{name_to_use}.png" alt="{name_to_use}">\n<br>'
+        insert_string = insert_string + f'<img src="{name_to_use}" alt="{name_to_use}">\n<br>'
 
     match_string = '</body>'
     with open(html_path, 'r+', encoding='UTF-8') as html_file: