From 38baf7fed1d787d86601875fdb5be9b78b2a7c5a Mon Sep 17 00:00:00 2001 From: Olivier Sauter <olivier.sauter@epfl.ch> Date: Tue, 6 Aug 2024 11:04:12 +0200 Subject: [PATCH] avoid breaking if CXRS not available --- matlab/TCV_IMAS/tcv_get_ids_core_profiles.m | 31 +++++++++++++-------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m b/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m index a230c935..ef07977c 100644 --- a/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m +++ b/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m @@ -239,23 +239,32 @@ end %% ion struct % assume only D if no CXRS (need to ask how to check if H...) params_eff_fit1.data_request = 'cxrs'; -temp_1d.cxrs_rho = gdat(params_cores_profiles.shot,params_eff_fit1); -temp_1d_desc.cxrs_rho = params_eff_fit1.data_request; +try + temp_1d.cxrs_rho = gdat(params_cores_profiles.shot,params_eff_fit1); + temp_1d_desc.cxrs_rho = params_eff_fit1.data_request; +catch + temp_1d.cxrs_rho.data = []; + temp_1d_desc.cxrs_rho = ['Problem with gdat ' params_eff_fit1.data_request ' ; no data']; +end params_eff_fit1.data_request = 'results.conf:ti'; temp_1d.ti_conf_rho = gdat(params_cores_profiles.shot,params_eff_fit1); temp_1d_desc.ti_conf_rho = params_eff_fit1.data_request; params_eff_fit1.data_request = 'results.conf:ni'; temp_1d.ni_conf_rho = gdat(params_cores_profiles.shot,params_eff_fit1); temp_1d_desc.ni_conf_rho = params_eff_fit1.data_request; -data_fullpath_raw = 'Ti(C sometimes B) from cxrs system 1 to 3'; -temp_1d.ti.raw = temp_1d.cxrs_rho.ti.raw; -temp_1d.ti.raw.shot = temp_1d.cxrs_rho.shot;temp_1d.ti.raw.gdat_params = temp_1d.cxrs_rho.gdat_params; -temp_1d.ti.raw.x =temp_1d.cxrs_rho.ti.raw.rho; temp_1d.ti.raw.t =temp_1d.cxrs_rho.t; -if ~isempty(temp_1d.cxrs_rho.ti.raw.data) - data_fullpath_fit = 'Ti from fit from cxrs thus Ti(C)'; - temp_1d.ti.raw =get_grids_1d(temp_1d.ti.raw,2,1); +if ~isempty(temp_1d.cxrs_rho.data) + data_fullpath_raw = 'Ti(C sometimes B) from cxrs system 1 to 3'; + temp_1d.ti.raw = temp_1d.cxrs_rho.ti.raw; + temp_1d.ti.raw.shot = temp_1d.cxrs_rho.shot;temp_1d.ti.raw.gdat_params = temp_1d.cxrs_rho.gdat_params; + temp_1d.ti.raw.x =temp_1d.cxrs_rho.ti.raw.rho; temp_1d.ti.raw.t =temp_1d.cxrs_rho.t; + if ~isempty(temp_1d.cxrs_rho.ti.raw.data) + data_fullpath_fit = 'Ti from fit from cxrs thus Ti(C)'; + temp_1d.ti.raw =get_grids_1d(temp_1d.ti.raw,2,1); + else + data_fullpath_fit = 'Ti from fit in CONF node'; + end else - data_fullpath_fit = 'Ti from fit in CONF node, using Te/Ti and equilibrium Wmhd'; + data_fullpath_fit = 'Ti from fit in CONF node'; end temp_1d_desc.ti.raw = data_fullpath_fit; temp_1d.ti.fit = temp_1d.ti_conf_rho; @@ -312,7 +321,7 @@ for it=1:length(ids_core_profiles.time) ids_core_profiles.profiles_1d{it}.pressure_thermal = ids_core_profiles.profiles_1d{it}.pressure_ion_total ... + ids_core_profiles.profiles_1d{it}.electrons.pressure_thermal; end -if ~isempty(temp_1d.cxrs_rho.ti.fit.data) +if ~isempty(temp_1d.cxrs_rho.data) && ~isempty(temp_1d.cxrs_rho.ti.fit.data) it_raw = iround_os(temp_1d.ti.raw.t,ids_core_profiles.time); for it=1:length(ids_core_profiles.time) % ids_core_profiles.profiles_1d{it}.ion{1}.temperature_fit = temp_1d.ti.fit(:,it_ti(it)); -- GitLab