Changeset 12 for trunk/src/series.m
- Timestamp:
- Feb 16, 2010, 3:19:38 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r2 r12 1999 1999 % check the content netcdf file 2000 2000 Data=nc2struct(file,'ListGlobalAttribute','patch2','fix2','civ2','patch','fix','absolut_time_T0','hart'); 2001 lastfield='civ1'; %default2002 2001 if ~isempty(Data.patch2) && isequal(Data.patch2,1) 2003 2002 lastfield='patch2'; … … 2012 2011 elseif ~isempty(Data.absolut_time_T0) && ~isempty(Data.hart) 2013 2012 lastfield='civ1'; 2014 end 2015 % Data=nc2struct(file,[]); 2016 % lastfield='civ1'; %default 2017 % if isfield(Data,'patch2') & isequal(Data.patch2,1); 2018 % lastfield='patch2'; 2019 % elseif isfield(Data,'fix2') & isequal(Data.fix2,1); 2020 % lastfield='fix2'; 2021 % elseif isfield(Data,'civ2') & isequal(Data.civ2,1); 2022 % lastfield='civ2'; 2023 % elseif isfield(Data,'patch') & isequal(Data.patch,1); 2024 % lastfield='patch1'; 2025 % elseif isfield(Data,'fix') & isequal(Data.fix,1); 2026 % lastfield='fix1'; 2027 % elseif isfield(Data,'absolut_time_T0') & isfield(Data,'hart') 2028 % lastfield='civ1'; 2029 % end 2030 2013 end 2031 2014 end 2032 2015 end … … 2222 2205 return 2223 2206 end 2224 hhget_field=guidata(hget_field);%handles of GUI elements in get_field2225 SubField=read_ var_names(hhget_field); %read the names of the variables to plot in the get_field GUI2207 %hhget_field=guidata(hget_field);%handles of GUI elements in get_field 2208 SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI 2226 2209 end 2227 2210 end … … 2566 2549 hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI 2567 2550 delete(hget_field) 2551 'TEST' 2568 2552 uvmat(filemean) 2569 2553 … … 3035 3019 if isequal(FieldName,'get_field...') 3036 3020 hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI 3037 hhget_field=guidata(hget_field);%handles of GUI elements in get_field3038 SubField=get_field('read_ var_names',hObject,eventdata,hhget_field); %read the names of the variables to plot in the get_field GUI3039 if isequal(get(hhget_field.menu_coord,'Visible'),'on')3040 list_transform=get(hhget_field.menu_coord,'String');3041 val_list=get(hhget_field.menu_coord,'Value');3042 transform=list_transform{val_list};3043 end3021 % hhget_field=guidata(hget_field);%handles of GUI elements in get_field 3022 SubField=get_field('read_get_field',hObject,eventdata,hget_field); %read the names of the variables to plot in the get_field GUI 3023 % if isequal(get(hhget_field.menu_coord,'Visible'),'on') 3024 % list_transform=get(hhget_field.menu_coord,'String'); 3025 % val_list=get(hhget_field.menu_coord,'Value'); 3026 % transform=list_transform{val_list}; 3027 % end 3044 3028 end 3045 3029 %detect whether all the files are 'images' or 'netcdf' … … 3303 3287 else 3304 3288 if length(ivar_Y)~=1 3305 msgbox_uvmat('ERROR','y coordinate missing in proj_field.m')3289 warndlg_uvmat('y coordinate missing in proj_field.m','ERROR') 3306 3290 return 3307 3291 end 3308 3292 test_grid=0; 3309 3293 end 3310 %DimIndices=Data{1}.VarDimIndex{VarIndex(1)};%indices of the dimensions of the first variable (common to all variables in the cell)3294 % DimIndices=Data{1}.VarDimIndex{VarIndex(1)};%indices of the dimensions of the first variable (common to all variables in the cell) 3311 3295 %case of input fields with unstructured coordinates 3312 3296 if ~test_grid … … 3319 3303 %case of fields defined on a structured grid 3320 3304 else 3321 % 3305 % DimValue=MergeData.DimValue(DimIndices);%set of dimension values 3322 3306 testFF=0; 3323 3307 for iview=2:nbview … … 3660 3644 if test_object%isfield(Series,'sethandles') 3661 3645 Series.ProjObject=read_set_object(Series.sethandles); 3662 answeryes=questdlg({['field series projected on ' Series.ProjObject.Style]}); 3646 %answeryes=questdlg({['field series projected on ' Series.ProjObject.Style]}); 3647 answeryes=msgbox_uvmat('INPUT_Y-N',['field series projected on ' Series.ProjObject.Style]); 3663 3648 if ~isequal(answeryes,'Yes') 3664 3649 return … … 3698 3683 %Number of input series: this function accepts only a single input file series 3699 3684 nbview=length(RootPath); 3700 if nbview>2 3701 RootPath=RootPath(1:2); 3702 set(hseries.RootPath,'String',RootPath) 3703 SubDir=SubDir(1:2); 3704 set(hseries.SubDir,'String',SubDir) 3705 RootFile=RootFile(1:2); 3706 set(hseries.RootFile,'String',RootFile) 3707 NomType=NomType(1:2); 3708 %set(hseries.NomType,'String',NomType) 3709 FileExt=FileExt(1:2); 3710 set(hseries.FileExt,'String',FileExt) 3711 nbview=2; 3685 if nbview==2 3686 %TODO: choose between difference and two series 3687 elseif nbview>2 % TODO: make multiple series 3688 % RootPath=RootPath(1:2); 3689 % set(hseries.RootPath,'String',RootPath) 3690 % SubDir=SubDir(1:2); 3691 % set(hseries.SubDir,'String',SubDir) 3692 % RootFile=RootFile(1:2); 3693 % set(hseries.RootFile,'String',RootFile) 3694 % NomType=NomType(1:2); 3695 % %set(hseries.NomType,'String',NomType) 3696 % FileExt=FileExt(1:2); 3697 % set(hseries.FileExt,'String',FileExt) 3698 % nbview=2; 3712 3699 end 3713 3700 hhh=which('mmreader'); … … 3722 3709 end 3723 3710 filebase{1}=fullfile(RootPath{1},RootFile{1}); 3724 % FileDisplay=fullfile(RootPath{1},SubDir{1},RootFile{1});3725 3711 3726 3712 % number of slices … … 3739 3725 if isequal(FieldName,{'get_field...'}) 3740 3726 hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI 3741 if length(hget_field)>13742 delete(hget_field(2:end)) 3727 if numel(hget_field)>1 3728 delete(hget_field(2:end)) % delete multiple occurerence of the GUI get_fioeld 3743 3729 elseif isempty(hget_field) 3744 filename=... 3745 name_generator(filebase{1},num_i1{1}(1),num_j1{1}(1),FileExt{1},NomType{1},1,num_i2{1}(1),num_j2{1}(1),SubDir{1}); 3730 filename=name_generator(filebase{1},num_i1{1}(1),num_j1{1}(1),FileExt{1},NomType{1},1,num_i2{1}(1),num_j2{1}(1),SubDir{1}); 3746 3731 idetect(iview)=exist(filename,'file'); 3747 3732 hget_field=get_field(filename); 3748 3733 return 3749 3734 end 3750 hhget_field=guidata(hget_field);%handles of GUI elements in get_field 3751 SubField=read_var_names(hhget_field); %read the names of the variables to plot in the get_field GUI 3752 if isequal(get(hhget_field.menu_coord,'Visible'),'on') 3753 list_transform=get(hhget_field.menu_coord,'String'); 3754 val_list=get(hhget_field.menu_coord,'Value'); 3755 transform=list_transform{val_list}; 3756 end 3735 %hhget_field=guidata(hget_field);%handles of GUI elements in get_field 3736 SubField=read_get_field(hget_field) %read the names of the variables to plot in the get_field GUI 3737 if isempty(SubField) 3738 delete(hget_field) 3739 filename=name_generator(filebase{1},num_i1{1}(1),num_j1{1}(1),FileExt{1},NomType{1},1,num_i2{1}(1),num_j2{1}(1),SubDir{1}); 3740 hget_field=get_field(filename); 3741 SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI 3742 end 3743 % if isequal(get(hhget_field.menu_coord,'Visible'),'on') 3744 % list_transform=get(hhget_field.menu_coord,'String'); 3745 % val_list=get(hhget_field.menu_coord,'Value'); 3746 % transform=list_transform{val_list}; 3747 % end 3757 3748 end 3758 3749 … … 3794 3785 increment=num_i1{1}(2)-num_i1{1}(1); 3795 3786 if ~isequal(increment,1) % if an increment is set 3796 answeryes=msgbox_uvmat('INPUT_Y-N',['will take time series in ' num2str(NbSlice) 'slices with increment = ' num2str(increment) '!']) 3787 answeryes=msgbox_uvmat('INPUT_Y-N',['will take time series in ' num2str(NbSlice) 'slices with increment = ' num2str(increment) '!']); 3797 3788 else 3798 3789 answeryes=msgbox_uvmat('INPUT_Y-N',{['will take time series in ' num2str(NbSlice) ' slices'];['results stored as files ' filebase_out ' ...']}); … … 3930 3921 nbcolor=size(A,3); 3931 3922 if nbcolor==3 3932 % Data{iview}.ListDimName={'coord_y','coord_x','rgb'}; 3933 % Data{iview}.DimValue=[npy npx 3]; 3934 % Data{iview}.VarDimIndex={[1 2 3]}; 3935 Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x','rgb'}}; 3923 Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x','rgb'}}; 3936 3924 else 3937 % Data{iview}.ListDimName={'coord_y','coord_x'};3938 % Data{iview}.DimValue=[npy npx];3939 % Data{iview}.VarDimIndex={[1 2]};3940 % Data{iview}.VarAttribute{1}.Coord_1=[npy-0.5 0.5];3941 % Data{iview}.VarAttribute{1}.Coord_2=[0.5 npx-0.5];3942 3925 Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x'}}; 3943 3926 end … … 3980 3963 end 3981 3964 if isfield(Series,'ProjObject') 3965 Series.ProjObject 3982 3966 [Field,errormsg]=proj_field(Field,Series.ProjObject); 3983 3967 if ~isempty(errormsg) … … 4022 4006 DimCell={DimCell}; 4023 4007 end 4024 if numel(DimCell)==1 && isequal(Field.ListVarName{ivar},DimCell)%TODO generalise with attribute 4025 % if length(Field.ListDimName)>=index & isequal(Field.ListVarName{ivar},Field.ListDimName{index})%detect dimension variables 4008 if numel(DimCell)==1 && isequal(Field.ListVarName{ivar},DimCell{1})%detect dimension variables 4026 4009 testsum(ivar)=1; 4027 4010 end … … 4034 4017 end 4035 4018 end 4036 % RecordData.ListDimName=[{'Time'} RecordData.ListDimName];%name of dimension4037 4019 RecordData.ListVarName=[{'Time'} RecordData.ListVarName]; 4038 4020 end … … 4050 4032 end 4051 4033 VarVal=shiftdim(VarVal,-1); %shift dimension 4052 eval(['RecordData.' VarName '=cat(1,RecordData.' VarName ',VarVal);']);%concanete the current field to the time series 4034 eval(['RecordData.' VarName '=cat(1,RecordData.' VarName ',VarVal);']);%concanete the current field to the time series 4053 4035 elseif testsum(ivar)==1% variable representing fixed coordinates 4054 4036 eval(['VarInit=RecordData.' VarName ';']); … … 4117 4099 [filemean]=... 4118 4100 name_generator(filebase_out,num_i1{1}(i_slice),num_j1{1}(i_slice),'.nc','_i1-i2_j1-j2',1,num_i2{end}(ifile),num_j2{end}(ifile),SubDir{1}); 4119 RecordData4120 RecordData.VarDimName{1}4121 RecordData.VarDimName{2}4122 RecordData.VarDimName{3}4123 4101 errormsg=struct2nc(filemean,RecordData); %save result file 4124 4102 if isempty(errormsg) … … 4442 4420 time_first=Attrib.absolut_time_T0; 4443 4421 end 4444 if isfield(Attrib,'absolut_time_T0_2')& ~(isequal(VelType,'civ1')|isequal(VelType,'interp1')|isequal(VelType,'filter1'))4422 if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) 4445 4423 time_first=Attrib.absolut_time_T0_2; 4446 4424 end … … 4456 4434 time_last=Attrib.absolut_time_T0; 4457 4435 end 4458 if isfield(Attrib,'absolut_time_T0_2')& ~(isequal(VelType,'civ1')|isequal(VelType,'interp1')|isequal(VelType,'filter1'))4436 if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) 4459 4437 time_last=Attrib.absolut_time_T0_2; 4460 4438 end
Note: See TracChangeset
for help on using the changeset viewer.