Skip to content
Snippets Groups Projects
Commit 58b49711 authored by Olivier Sauter's avatar Olivier Sauter
Browse files

add gas, gash for JET and fix cdf2mat for ASTRA cdf file as well

parent bd6d4d37
No related branches found
No related tags found
1 merge request!86add gas, gash for JET and fix cdf2mat for ASTRA cdf file as well
Pipeline #63569 passed
......@@ -47,16 +47,31 @@ for i=1:length(coordnames_sorted)
matcdf.coords(i).index_allvarnames = strmatch(matcdf.coords(i).name,allvarnames,'exact');
matcdf.coords(i).index_varnames_sorted = strmatch(matcdf.coords(i).name,varnames_sorted,'exact');
matcdf.coords(i).varid = allvarids(matcdf.coords(i).index_allvarnames);
if strcmp(allinfo.Variables(matcdf.coords(i).index_allvarnames).Datatype,'single')
matcdf.coords(i).data = netcdf.getVar(funnetcdf,matcdf.coords(i).varid,'double');
if ~isempty(matcdf.coords(i).index_allvarnames)
if strcmp(allinfo.Variables(matcdf.coords(i).index_allvarnames).Datatype,'single')
matcdf.coords(i).data = netcdf.getVar(funnetcdf,matcdf.coords(i).varid,'double');
else
matcdf.coords(i).data = netcdf.getVar(funnetcdf,matcdf.coords(i).varid);
end
for ij=1:length(fields_variables_to_copy)
matcdf.coords(i).(fields_variables_to_copy{ij}) = allinfo.Variables(matcdf.coords(i).index_allvarnames).(fields_variables_to_copy{ij});
end
for jj=1:numel(allinfo.Variables(matcdf.coords(i).index_allvarnames).Attributes)
if strcmp(lower(allinfo.Variables(matcdf.coords(i).index_allvarnames).Attributes(jj).Name),'units')
matcdf.coords(i).units = strtrim(allinfo.Variables(matcdf.coords(i).index_allvarnames).Attributes(jj).Value);
end
if strcmp(lower(allinfo.Variables(matcdf.coords(i).index_allvarnames).Attributes(jj).Name),'long_name')
matcdf.coords(i).long_name = strtrim(allinfo.Variables(matcdf.coords(i).index_allvarnames).Attributes(jj).Value);
end
end
else
matcdf.coords(i).data = netcdf.getVar(funnetcdf,matcdf.coords(i).varid);
end
for ij=1:length(fields_variables_to_copy)
matcdf.coords(i).(fields_variables_to_copy{ij}) = allinfo.Variables(matcdf.coords(i).index_allvarnames).(fields_variables_to_copy{ij});
matcdf.coords(i).data = [];
for ij=1:length(fields_variables_to_copy)
matcdf.coords(i).(fields_variables_to_copy{ij}) = [];
end
matcdf.coords(i).units = '';
matcdf.coords(i).long_name = [matcdf.coords(i).name ' empty'];
end
matcdf.coords(i).units = strtrim(allinfo.Variables(matcdf.coords(i).index_allvarnames).Attributes(1).Value);
matcdf.coords(i).long_name = strtrim(allinfo.Variables(matcdf.coords(i).index_allvarnames).Attributes(2).Value);
matcdf.coords(i).label = [matcdf.coords(i).name ' ' num2str(matcdf.coords(i).Size) ': ' matcdf.coords(i).long_name];
cdf2mat_out.coords.(matcdf.coords(i).name) = matcdf.coords(i);
end
......@@ -65,16 +80,31 @@ for i=1:length(varnames_sorted)
matcdf.vars(i).name = varnames_sorted{i};
matcdf.vars(i).index_allvarnames = strmatch(matcdf.vars(i).name,allvarnames,'exact');
matcdf.vars(i).varid = allvarids(matcdf.vars(i).index_allvarnames);
if strcmp(allinfo.Variables(matcdf.vars(i).index_allvarnames).Datatype,'single')
matcdf.vars(i).data = netcdf.getVar(funnetcdf,matcdf.vars(i).varid,'double');
if ~isempty(matcdf.vars(i).index_allvarnames)
if strcmp(allinfo.Variables(matcdf.vars(i).index_allvarnames).Datatype,'single')
matcdf.vars(i).data = netcdf.getVar(funnetcdf,matcdf.vars(i).varid,'double');
else
matcdf.vars(i).data = netcdf.getVar(funnetcdf,matcdf.vars(i).varid);
end
for ij=1:length(fields_variables_to_copy)
matcdf.vars(i).(fields_variables_to_copy{ij}) = allinfo.Variables(matcdf.vars(i).index_allvarnames).(fields_variables_to_copy{ij});
end
for jj=1:numel(allinfo.Variables(matcdf.vars(i).index_allvarnames).Attributes)
if strcmp(lower(allinfo.Variables(matcdf.vars(i).index_allvarnames).Attributes(jj).Name),'units')
matcdf.vars(i).units = strtrim(allinfo.Variables(matcdf.vars(i).index_allvarnames).Attributes(jj).Value);
end
if strcmp(lower(allinfo.Variables(matcdf.vars(i).index_allvarnames).Attributes(jj).Name),'long_name')
matcdf.vars(i).long_name = strtrim(allinfo.Variables(matcdf.vars(i).index_allvarnames).Attributes(jj).Value);
end
end
else
matcdf.vars(i).data = netcdf.getVar(funnetcdf,matcdf.vars(i).varid);
end
for ij=1:length(fields_variables_to_copy)
matcdf.vars(i).(fields_variables_to_copy{ij}) = allinfo.Variables(matcdf.vars(i).index_allvarnames).(fields_variables_to_copy{ij});
matcdf.vars(i).data = [];
for ij=1:length(fields_variables_to_copy)
matcdf.vars(i).(fields_variables_to_copy{ij}) = [];
end
matcdf.vars(i).units = '';
matcdf.vars(i).long_name = [matcdf.vars(i).name ' empty'];
end
matcdf.vars(i).units = strtrim(allinfo.Variables(matcdf.vars(i).index_allvarnames).Attributes(1).Value);
matcdf.vars(i).long_name = strtrim(allinfo.Variables(matcdf.vars(i).index_allvarnames).Attributes(2).Value);
matcdf.vars(i).label = matcdf.vars(i).name;
for j=1:length(matcdf.vars(i).Dimensions)
ij = strmatch(matcdf.vars(i).Dimensions(j).Name,coordnames_sorted,'exact');
......@@ -93,13 +123,18 @@ for i=1:length(varnames_sorted)
matcdf.vars(i).label = [matcdf.vars(i).label ': ' matcdf.vars(i).long_name ' [' matcdf.vars(i).units ']'];
cdf2mat_out.allvars.(matcdf.vars(i).name) = matcdf.vars(i);
end
top_attr_names = {allinfo.Attributes(:).Name};
ij = strmatch('shot',top_attr_names,'exact');
cdf2mat_out.shot = allinfo.Attributes(ij).Value;
if ~isempty(allinfo.Attributes)
top_attr_names = {allinfo.Attributes(:).Name};
ij = strmatch('shot',top_attr_names,'exact');
cdf2mat_out.shot = allinfo.Attributes(ij).Value;
else
cdf2mat_out.shot = NaN;
end
cdf2mat_out.fname = pfname;
cdf2mat_out.id = pfname(length(pfname)-11:length(pfname)-4);
[a1,a2,a3]=fileparts(pfname);
cdf2mat_out.id = a2;
netcdf.close(funnetcdf);
netcdf.close(funnetcdf);
clear matcdf
return
......@@ -101,6 +101,11 @@ switch lower(data_request)
mapping.gdat_timedim = 2;
mapping.method = 'switchcase'; % could use function make_eqdsk directly?
mapping.expression = '';
case {'gas','gasm','gash','eler'}
mapping.label = 'eler';
mapping.timedim = 1;
mapping.method = 'signal';
mapping.expression = [{'ppf'},{'gash'},{'eler'}];
case 'halpha'
mapping.label = 'Halpha';
mapping.timedim = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment