From f33fae1a28228ec3b2df1ad3e95da93560b13ed1 Mon Sep 17 00:00:00 2001
From: lb584 <lb584@cam.ac.uk>
Date: Tue, 16 Jul 2024 14:46:00 +0100
Subject: [PATCH] removing the need for a spatial points file in met_extractor
 assets to check the output dimensions, now compared to the input nc that
 created the results

---
 ews/coordinator/processor_environment.py | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/ews/coordinator/processor_environment.py b/ews/coordinator/processor_environment.py
index 7fa2cab..8de8150 100644
--- a/ews/coordinator/processor_environment.py
+++ b/ews/coordinator/processor_environment.py
@@ -270,25 +270,16 @@ class ProcessorEnvironment(ProcessorBase):
                     strain_outPath = os.path.join(region_outPath, strain)
                     strain_outFile = strain_outPath + '/RIE_value.nc'
 
-                    """
-                    read in the input_spatial_points.csv file and get the number of spatial points - this is used for 
-                    sense-checking the dimensions of the output
-                    """
-                    # todo we could swap the spatial points file for a file specifying the expected dimensions - much smaller
-                    region_spatial_points_file = assetsPath + '/met_extractor/' + 'input_spatial_points_' + region + '.csv'
-                    spatial_points = pd.read_csv(region_spatial_points_file)
-                    spatial_dim = spatial_points.shape[0]
-
                     if not os.path.exists(strain_outPath):
                         os.makedirs(strain_outPath)
 
                     shutil.copy(resultFile, strain_outFile)
 
-                    # todo - Add a flag to this part of the code to enable/disable csv writing as an option
-                    # resultCSVFile = envSuitPath + 'RIE.csv'
-                    # if os.path.isfile(resultCSVFile):
-                    #     strain_outFile = strain_outPath + '/RIE_value.csv'
-                    #     shutil.copy(resultCSVFile,strain_outFile)
+                    # If we have set the flag to write the outputs as csvs, copy them to the processed dir
+                    result_csv_file = envSuitPath + 'RIE.csv'
+                    if os.path.isfile(result_csv_file):
+                        strain_outFile = strain_outPath + '/RIE_value.csv'
+                        shutil.copy(result_csv_file, strain_outFile)
 
                     logger.info(f"{strain} result successfully created and moved to {strain_outPath}/")
 
-- 
GitLab