Changeset 360 for trunk/src/series.m
- Timestamp:
- Jan 9, 2012, 1:16:35 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r358 r360 1087 1087 function RUN_Callback(hObject, eventdata, handles) 1088 1088 %------------------------------------------------------------------------ 1089 %% Read parameters from series 1090 Series=read_GUI(handles.series)%TODO: extend to all input param 1091 Series.hseries=handles.series; % handles to the series GUI 1092 1089 1093 %% read root name and field type 1090 1094 set(handles.RUN,'BusyAction','queue'); … … 1096 1100 Series.GetObject=0; 1097 1101 end 1098 SeriesData=get(handles.series,'UserData');1102 % SeriesData=get(handles.series,'UserData'); 1099 1103 1100 1104 % Series.hseries=handles.series; % handles to the series GUI 1101 1102 %% Read parameters from series1103 Series=read_GUI(handles.series);%TODO: extend to all input param1104 Series.hseries=handles.series; % handles to the series GUI1105 1106 1105 first_i=1; 1107 1106 last_i=1; … … 1129 1128 NomType=Series.InputTable(:,4); 1130 1129 FileExt=Series.InputTable(:,5); 1131 % RootPath=get(handles.RootPath,'String');% path of the root name of the first field series 1132 % RootFile=get(handles.RootFile,'String');% root name of the first field series 1133 % SubDir=get(handles.SubDir,'String');% subdirectory for netcdf files 1134 % FileExt=get(handles.FileExt,'String');%file extension 1135 if isempty(SeriesData) 1136 msgbox_uvmat('ERROR','no input file series') 1137 return 1138 end 1130 % if isempty(SeriesData) 1131 % msgbox_uvmat('ERROR','no input file series') 1132 % return 1133 % end 1139 1134 % NomType=SeriesData.NomType; 1140 if length(RootPath)==1 %string character input for user fct1141 Series.RootPath=RootPath{1};1142 Series.RootFile=RootFile{1};1143 Series.SubDir=SubDir{1};1144 Series.FileExt=FileExt{1};1145 Series.NomType=NomType{1};1146 else %cell input for user fct1147 Series.RootPath=RootPath;1148 Series.RootFile=RootFile;1149 Series.SubDir=SubDir;1150 Series.FileExt=FileExt;1151 Series.NomType=NomType;1152 end1153 if isequal(get(handles.FieldMenu,'Visible'),'on')1154 FieldMenu=get(handles.FieldMenu,'String');1155 FieldValue=get(handles.FieldMenu,'Value');1156 Series.Field=FieldMenu(FieldValue);1157 end1135 % if length(RootPath)==1 %string character input for user fct 1136 % Series.RootPath=RootPath{1}; 1137 % Series.RootFile=RootFile{1}; 1138 % Series.SubDir=SubDir{1}; 1139 % Series.FileExt=FileExt{1}; 1140 % Series.NomType=NomType{1}; 1141 % else %cell input for user fct 1142 % Series.RootPath=RootPath; 1143 % Series.RootFile=RootFile; 1144 % Series.SubDir=SubDir; 1145 % Series.FileExt=FileExt; 1146 % Series.NomType=NomType; 1147 % end 1148 % if isequal(get(handles.FieldMenu,'Visible'),'on') 1149 % FieldMenu=get(handles.FieldMenu,'String'); 1150 % FieldValue=get(handles.FieldMenu,'Value'); 1151 % Series.Field=FieldMenu(FieldValue); 1152 % end 1158 1153 menu_coord_state=get(handles.transform_fct,'Visible'); 1159 1154 Series.CoordType='';%default … … 1164 1159 Series.transform_fct=transform_list{menu_index};% transform function handles 1165 1160 end 1166 1167 %1168 % first_i=str2num(get(handles.num_first_i,'String'));1169 % last_i=str2num(get(handles.num_last_i,'String'));1170 % incr_i=str2num(get(handles.num_incr_i,'String'));1171 % first_j=str2num(get(handles.num_first_j,'String'));1172 % last_j=str2num(get(handles.num_last_j,'String'));1173 % incr_j=str2num(get(handles.num_incr_j,'String'));1174 % if ~isequal(get(handles.num_first_i,'Visible'),'on')1175 % first_i=1;1176 % last_i=1;1177 % incr_i=1;1178 % end1179 % if ~isequal(get(handles.num_first_j,'Visible'),'on')1180 % first_j=1;1181 % last_j=1;1182 % incr_j=1;1183 % end1184 1161 1185 1162 %reinitiate waitbar position … … 1202 1179 nbfield=nb(1); 1203 1180 nbfield2=nb(2); 1204 % nbfield2=cell2mat(Series.IndexRange.MaxIndex);1205 % nbfield=min(nbfield);1206 % % nbfield=[]; %default1207 % % for iview=1:length(nbfield_cell)1208 % % nb=nbfield_cell{iview};1209 % % if ~isempty(nb)1210 % % nbfield=[nbfield nb];1211 % % end1212 % % end1213 % % nbfield=min(nbfield);1214 % nbfield2_cell=get(handles.num_MaxIndex_j,'String');1215 % nbfield2=[]; %default1216 % for iview=1:length(nbfield2_cell)1217 % nb=str2num(nbfield2_cell{iview});1218 % if ~isempty(nb)1219 % nbfield2=[nbfield2 nb];1220 % end1221 % end1222 % nbfield2=min(nbfield2);1223 1181 1224 1182 %get complementary information from the 'series' interface … … 1233 1191 %determine the list of input file names 1234 1192 nbmissing=0; 1235 for iview=1:length(RootPath) 1236 %case of pairs (.nc files) 1237 fileinput=name_generator(fullfile(RootPath{iview},RootFile{iview}),first_i,first_j,FileExt{iview},NomType{iview},1,first_i+1,first_j+1,SubDir{iview}); 1238 if strcmp(get(handles.Pairs,'Visible'),'on') 1239 pair_list=get(handles.list_pair_civ,'String'); 1240 val=get(handles.list_pair_civ,'Value'); 1241 pair_string=pair_list{val}; 1242 r=regexp(pair_string,'.*\D(?<num1>[\d+|*])(?<delim>[-||])(?<num2>[\d+|*])','names'); 1243 if ~isempty(r) 1244 if strcmp(r.num1,'*')%free pairs 1245 [tild,RootFile,i1_series,i2_series,j1_series,j2_series,tild,tild,Object]=find_file_series(fileinput)% TODO: choice pair when multiple choice 1246 1247 if isempty(i2_series) %j pairs 1248 ind_sel=i1_series>=i1_series>=first_i & i1_series<=last_i & j1_series>first_j & j2_series<last_j; 1249 j2_series=j2_series(ind_sel); 1250 else%i pairs 1251 if isempty(j1_series) %j pairs 1252 ind_sel=i1_series>=first_i & i2_series<=last_i ; 1253 else 1254 ind_sel=i1_series>=first_i & i2_series<=last_i& j1_series>first_j & j1_series<last_j; 1255 j1_series=j1_series(ind_sel); 1256 i2_series=i2_series(ind_sel); 1257 end 1258 end 1259 i1_series=i1_series(ind_sel); 1260 else 1261 if strcmp(r.delim,'-') 1262 ind_shift(1)=str2num(r.num1); 1263 ind_shift(2)=str2num(r.num2); 1264 else 1265 ind_shift(1)=-str2num(r.num1); 1266 ind_shift(2)=str2num(r.num2); 1267 end 1268 [i1_series,i2_series,j1_series,j2_series,nbmissing]=find_file_indices(num_i,num_j,ind_shift,NomType{iview},mode); 1269 end 1270 end 1271 if isempty(i1_series) 1272 msgbox_uvmat('ERROR','no file in the considered range') 1273 return 1274 end 1275 if isempty(i2_series) 1276 i2_series=i1_series; 1277 end 1278 if isempty(j2_series) 1279 j2_series=j1_series; 1280 end 1281 % if isequal(NomType{iview},'_1_1-2')|| isequal(NomType{iview},'_1-2_1')|| isequal(NomType{iview},'_1-2')|| isequal(NomType{iview},'#_ab') 1282 % ind_shift=SeriesData.displ_num(iview,:); 1283 % if isequal(ind_shift,[0 0 0 0]) % undefined pairs 1284 % if isequal(NomType{iview},'#_ab') 1285 % mode='#_ab'; 1286 % end 1287 % [num_i1,i2_series,j1_series,num_j2,nbmissing]=netseries_generator(fullfile(RootPath{iview},RootFile{iview}),SubDir{iview},mode,num_first_i,num_incr_i,num_last_i,num_first_j,num_incr_j,num_last_j); 1288 % else 1289 % [num_i1,num_i2,num_j1,num_j2,num_i,num_j]=find_file_indices(num_i,num_j,ind_shift,NomType{iview},mode); 1290 % if isempty(num_i) 1291 % msgbox_uvmat('ERROR','ERROR: empty set of input files chosen') 1292 % return 1293 % end 1294 % if num_i(1)>num_first_i 1295 % set(handles.num_first_i,'String',num2str(num_i(1)))%update the display of first field 1296 % last_i_Callback(hObject, eventdata, handles) 1297 % end 1298 % if num_i(end)<num_last_i 1299 % set(handles.num_last_i,'String',num2str(num_i(end)))%update the display of last field 1300 % last_i_Callback(hObject, eventdata, handles) 1301 % end 1302 % if num_j(1)>num_first_j 1303 % set(handles.num_first_j,'String',num2str(num_j(1)))%update the display of first field 1304 % last_j_Callback(hObject, eventdata, handles) 1305 % end 1306 % if num_j(end)<num_last_j 1307 % set(handles.num_last_j,'String',num2str(num_j(end)))%update the display of last field 1308 % last_j_Callback(hObject, eventdata, handles) 1309 % end 1310 % end 1311 else%case of images 1312 [i1_series,j1_series]=meshgrid(num_i,num_j); 1313 i2_series=i1_series; 1314 j2_series=j1_series; 1315 end 1316 if length(RootPath)>1 1317 i1_series_cell{iview}=i1_series; 1318 i2_series_cell{iview}=i2_series; 1319 j1_series_cell{iview}=j1_series; 1320 j2_series_cell{iview}=j2_series; 1321 end 1322 end 1193 % for iview=1:length(RootPath) 1194 % %case of pairs (.nc files) 1195 % fileinput=name_generator(fullfile(RootPath{iview},RootFile{iview}),first_i,first_j,FileExt{iview},NomType{iview},1,first_i+1,first_j+1,SubDir{iview}); 1196 % if strcmp(get(handles.Pairs,'Visible'),'on') 1197 % pair_list=get(handles.list_pair_civ,'String'); 1198 % val=get(handles.list_pair_civ,'Value'); 1199 % pair_string=pair_list{val}; 1200 % r=regexp(pair_string,'.*\D(?<num1>[\d+|*])(?<delim>[-||])(?<num2>[\d+|*])','names'); 1201 % if ~isempty(r) 1202 % if strcmp(r.num1,'*')%free pairs 1203 % [tild,RootFile,i1_series,i2_series,j1_series,j2_series,tild,tild,Object]=find_file_series(fileinput);% TODO: choice pair when multiple choice 1204 % 1205 % if isempty(i2_series) %j pairs 1206 % ind_sel=i1_series>=i1_series>=first_i & i1_series<=last_i & j1_series>first_j & j2_series<last_j; 1207 % j2_series=j2_series(ind_sel); 1208 % else%i pairs 1209 % if isempty(j1_series) %j pairs 1210 % ind_sel=i1_series>=first_i & i2_series<=last_i ; 1211 % else 1212 % ind_sel=i1_series>=first_i & i2_series<=last_i& j1_series>first_j & j1_series<last_j; 1213 % j1_series=j1_series(ind_sel); 1214 % i2_series=i2_series(ind_sel); 1215 % end 1216 % end 1217 % i1_series=i1_series(ind_sel); 1218 % else 1219 % if strcmp(r.delim,'-') 1220 % ind_shift(1)=str2num(r.num1); 1221 % ind_shift(2)=str2num(r.num2); 1222 % else 1223 % ind_shift(1)=-str2num(r.num1); 1224 % ind_shift(2)=str2num(r.num2); 1225 % end 1226 % [i1_series,i2_series,j1_series,j2_series,nbmissing]=find_file_indices(num_i,num_j,ind_shift,NomType{iview},mode); 1227 % end 1228 % end 1229 % if isempty(i1_series) 1230 % msgbox_uvmat('ERROR','no file in the considered range') 1231 % return 1232 % end 1233 % if isempty(i2_series) 1234 % i2_series=i1_series; 1235 % end 1236 % if isempty(j2_series) 1237 % j2_series=j1_series; 1238 % end 1239 % else%case of images 1240 % [i1_series,j1_series]=meshgrid(num_i,num_j); 1241 % i2_series=i1_series; 1242 % j2_series=j1_series; 1243 % end 1244 % if length(RootPath)>1 1245 % i1_series_cell{iview}=i1_series; 1246 % i2_series_cell{iview}=i2_series; 1247 % j1_series_cell{iview}=j1_series; 1248 % j2_series_cell{iview}=j2_series; 1249 % end 1250 % end 1323 1251 1324 1252 %% defining the ACTION function handle … … 1344 1272 %% RUN ACTION 1345 1273 Series.Action=action;%name of the processing programme 1274 Series 1346 1275 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 1347 if length(RootPath)>1 1348 h_fun(i1_series_cell,i2_series_cell,j1_series_cell,j2_series_cell,Series); 1349 else 1350 h_fun(i1_series,i2_series,j1_series,j2_series,Series); 1351 end 1276 h_fun(Series); 1277 % if length(RootPath)>1 1278 % h_fun(i1_series_cell,i2_series_cell,j1_series_cell,j2_series_cell,Series); 1279 % else 1280 % h_fun(i1_series,i2_series,j1_series,j2_series,Series); 1281 % end 1352 1282 set(handles.RUN,'BackgroundColor',[1 0 0]) 1353 1283
Note: See TracChangeset
for help on using the changeset viewer.