Changeset 526 for trunk/src/read_field.m
- Timestamp:
- Aug 20, 2012, 12:32:31 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/read_field.m
r521 r526 39 39 % end 40 40 A=[]; 41 if ischar(ParamIn.FieldName) 42 ParamIn.FieldName={ParamIn.FieldName}; 41 if isstruct(ParamIn) 42 if isfield(ParamIn,'FieldName')&& ischar(ParamIn.FieldName) 43 ParamIn.FieldName={ParamIn.FieldName}; 44 end 45 if isfield(ParamIn,'ColorVar') 46 InputField=[ParamIn.FieldName {ParamIn.ColorVar}]; 47 check_colorvar=1; 48 else 49 InputField= ParamIn.FieldName; 50 check_colorvar=0; 51 end 43 52 end 44 if isfield(ParamIn,'ColorVar')45 InputField=[ParamIn.FieldName {ParamIn.ColorVar}];46 check_colorvar=1;47 else48 InputField= ParamIn.FieldName;49 check_colorvar=0;50 end51 53 %% distingush different input file types 52 54 try … … 73 75 Role{numel(ListVar)}='vector_y'; 74 76 Role{numel(ListVar)-1}='vector_x'; 75 % switch r.Operator 77 % TODO; introduce that for unstructured coordinates 78 % switch r.Operator TODO; introduce that for unstructured coordinates 76 79 % case 'norm' 77 80 % FieldRequest{numel(ListVar)-1}='interp_lin';%scalar field (requires interpolation for plot) … … 85 88 Role{numel(ListVar)}='ancillary';% scalar used for color vector (not projected) 86 89 end 87 [Field,var_detect,ichoice]=nc2struct(FileName,[ParamIn.Coord NameListVar]);90 [Field,var_detect,ichoice]=nc2struct(FileName,[ParamIn.Coord_x ParamIn.Coord_y ListVar]); 88 91 for ivar=1:numel(ListVar) 89 92 Field.VarAttribute{ivar+2}.Role=Role{ivar}; 90 93 % Field.VarAttribute{ivar+2}.FieldRequest=FieldRequest{ivar}; 91 94 end 92 % GUIName='get_field'; %default name of the GUI get_field93 % if isfield(ParamIn,'GUIName')94 % GUIName=ParamIn.GUIName;95 % end96 % CivStage=0;97 % % if ~strcmp(ParamIn.FieldName,'get_field...')% if get_field is not requested, look for Civx data98 % FieldList=calc_field;%list of possible fields for Civx data99 % ParamOut.ColorVar='';%default100 % if ischar(ParamIn.FieldName)101 % FieldName=ParamIn.FieldName;102 % else103 % FieldName=ParamIn.FieldName{1};104 % end105 % field_index=strcmp(FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data106 % if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist107 % Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage');108 % % case of new civdata conventions109 % if isequal(Data.Conventions,'uvmat/civdata')110 %111 % %case of old civx conventions112 % elseif ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)113 % ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default114 % ParamOut.ColorVar='ima_cor';115 % InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}];116 % [Field,ParamOut.VelType]=read_civxdata(FileName,InputField,ParamIn.VelType);117 % if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end118 % CivStage=Field.CivStage;119 % ParamOut.CivStage=Field.CivStage;120 % % not cvix file, fields will be chosen through the GUI get_field121 % else122 % ParamOut.FieldName='get_field...';123 % hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI124 % if ~isempty(hget_field)125 % delete(hget_field)%delete get_field for reinitialisation126 % end127 % end128 % else129 % InputField=ParamOut.FieldName;130 % if ischar(InputField)131 % InputField={InputField};132 % end133 % if isfield(ParamIn,'ColorVar')134 % ParamOut.ColorVar=ParamIn.ColorVar;135 % InputField=[InputField {ParamOut.ColorVar}];136 % end137 % [Field,ParamOut.VelType,errormsg]=read_civxdata(FileName,InputField,ParamIn.VelType);138 % if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end139 % CivStage=Field.CivStage;140 % ParamOut.CivStage=Field.CivStage;141 % end142 % ParamOut.FieldList=[{'image'};FieldList;{'get_field...'}];143 % end144 % if CivStage==0% read the field names on the interface get_field.145 % hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI146 % if isempty(hget_field)% open the GUI get_field if it is not found147 % hget_field= get_field(FileName);%open the get_field GUI148 % set(hget_field,'Name',GUIName)%update the name of get_field (e.g. get_field_1)149 % end150 % hhget_field=guidata(hget_field);151 % %% update the get_field GUI152 % set(hhget_field.inputfile,'String',FileName)153 % set(hhget_field.list_fig,'Value',1)154 % if exist('num','var')&&~isnan(num)155 % set(hhget_field.TimeIndexValue,'String',num2str(num))156 % end157 % % funct_list=get(hhget_field.ACTION,'UserData');158 % % funct_index=get(hhget_field.ACTION,'Value');159 % % funct=funct_list{funct_index};%select the current action in get_field, e;g. PLOT160 % % Field=funct(hget_field); %%activate the current action selected in get_field, e;g.read the names of the variables to plot161 % [Field,errormsg]=read_get_field(hget_field);162 % Tabchar={''};%default163 % Tabcell=[];164 % set(hhget_field.inputfile,'String',FileName)165 % if isfield(Field,'ListGlobalAttribute')&& ~isempty(Field.ListGlobalAttribute)166 % for iline=1:length(Field.ListGlobalAttribute)167 % Tabcell{iline,1}=Field.ListGlobalAttribute{iline};168 % if isfield(Field, Field.ListGlobalAttribute{iline})169 % val=Field.(Field.ListGlobalAttribute{iline});170 % if ischar(val);171 % Tabcell{iline,2}=val;172 % else173 % Tabcell{iline,2}=num2str(val);174 % end175 % end176 % end177 % if ~isempty(Tabcell)178 % Tabchar=cell2tab(Tabcell,'=');179 % Tabchar=[{''};Tabchar];180 % end181 % end182 % ParamOut.CivStage=0;183 % ParamOut.VelType=[];184 % if isfield(Field,'TimeIndex')185 % ParamOut.TimeIndex=Field.TimeIndex;186 % end187 % if isfield(Field,'TimeValue')188 % ParamOut.TimeValue=Field.TimeValue;189 % end190 % ParamOut.FieldList={'get_field...'};191 95 192 96 case 'video'
Note: See TracChangeset
for help on using the changeset viewer.