From 1377f2f5eb6b7d66a2f1658611c06940d39ff153 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Tue, 4 Feb 2020 12:24:49 +0100
Subject: [PATCH] make default option to not fix homogeneous time so can check
 and fix complete_IDS_CORSICA

need to check which IDS are empty from original CORSICA database
---
 matlab/IMAS/gdat_imas.m | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/matlab/IMAS/gdat_imas.m b/matlab/IMAS/gdat_imas.m
index 49722c68..5978eb9f 100644
--- a/matlab/IMAS/gdat_imas.m
+++ b/matlab/IMAS/gdat_imas.m
@@ -405,6 +405,10 @@ elseif strcmp(mapping_for_imas.method,'switchcase')
       rmpath(ids_empty_path);
       return
     end
+    if ~isfield(params_eff,'fix_homogeneous') || isempty(params_eff.fix_homogeneous)
+      params_eff.fix_homogeneous = 0;
+      gdat_data.gdat_params.fix_homogeneous = params_eff.fix_homogeneous;
+    end
     ids_gen_ok = ~~exist('ids_gen','file');
     if ~isfield(gdat_data.gdat_params,'error_bar') || isempty(gdat_data.gdat_params.error_bar)
       gdat_data.gdat_params.error_bar = 'delta';
@@ -483,11 +487,15 @@ elseif strcmp(mapping_for_imas.method,'switchcase')
        case -999999999
 	warning([ids_top_name '.ids_properties.homogeneous_time is not defined']);
 	if isempty(gdat_data.(ids_top_name).time)
-	  gdat_data.(ids_top_name).ids_properties.homogeneous_time = 0;
-	  warning([ids_top_name '.ids_properties.homogeneous_time set to 0 since .time empty']);
+	  if gdat_data.gdat_params.fix_homogeneous
+	    gdat_data.(ids_top_name).ids_properties.homogeneous_time = 0;
+	    warning([ids_top_name '.ids_properties.homogeneous_time set to 0 since .time empty']);
+	  end
 	elseif isfinite(gdat_data.(ids_top_name).time)
-	  gdat_data.(ids_top_name).ids_properties.homogeneous_time = 1;
-	  warning([ids_top_name '.ids_properties.homogeneous_time set to 1 since .time finite']);
+	  if gdat_data.gdat_params.fix_homogeneous
+	    gdat_data.(ids_top_name).ids_properties.homogeneous_time = 1;
+	    warning([ids_top_name '.ids_properties.homogeneous_time set to 1 since .time finite']);
+	  end
 	end
        case 0
 	if ~isempty(gdat_data.(ids_top_name).time)
-- 
GitLab