Changeset 12 for trunk/src/series.m


Ignore:
Timestamp:
Feb 16, 2010, 3:19:38 PM (14 years ago)
Author:
gostiaux
Message:

The files from uvmat.2.2.beta that differed from the current version have been updated.
Now the /raid/soft/UVMAT/src should be operational

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r2 r12  
    19991999                            % check the content  netcdf file
    20002000                            Data=nc2struct(file,'ListGlobalAttribute','patch2','fix2','civ2','patch','fix','absolut_time_T0','hart');
    2001                             lastfield='civ1'; %default
    20022001                            if ~isempty(Data.patch2) && isequal(Data.patch2,1)
    20032002                                lastfield='patch2';
     
    20122011                            elseif ~isempty(Data.absolut_time_T0) && ~isempty(Data.hart)
    20132012                                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                         
    20312014                        end
    20322015                    end
     
    22222205           return
    22232206        end
    2224         hhget_field=guidata(hget_field);%handles of GUI elements in get_field
    2225         SubField=read_var_names(hhget_field); %read the names of the variables to plot in the get_field GUI
     2207        %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
    22262209    end
    22272210end
     
    25662549hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI
    25672550delete(hget_field)
     2551'TEST'
    25682552uvmat(filemean)
    25692553
     
    30353019if isequal(FieldName,'get_field...')
    30363020    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_field
    3038     SubField=get_field('read_var_names',hObject,eventdata,hhget_field); %read the names of the variables to plot in the get_field GUI
    3039     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     end
     3021   % 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
    30443028end
    30453029%detect whether all the files are 'images' or 'netcdf'
     
    33033287    else
    33043288        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')
    33063290                return
    33073291        end
    33083292        test_grid=0;
    33093293    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)
    33113295    %case of input fields with unstructured coordinates
    33123296    if ~test_grid
     
    33193303    %case of fields defined on a structured  grid
    33203304    else 
    3321 %         DimValue=MergeData.DimValue(DimIndices);%set of dimension values
     3305%        DimValue=MergeData.DimValue(DimIndices);%set of dimension values
    33223306        testFF=0;
    33233307        for iview=2:nbview
     
    36603644if test_object%isfield(Series,'sethandles')
    36613645    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]);
    36633648    if ~isequal(answeryes,'Yes')
    36643649        return
     
    36983683%Number of input series: this function  accepts only a single input file series
    36993684nbview=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;
     3685if nbview==2
     3686    %TODO: choose between difference and two series
     3687elseif 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;
    37123699end
    37133700hhh=which('mmreader');
     
    37223709end
    37233710filebase{1}=fullfile(RootPath{1},RootFile{1});
    3724 % FileDisplay=fullfile(RootPath{1},SubDir{1},RootFile{1});
    37253711
    37263712% number of slices
     
    37393725if isequal(FieldName,{'get_field...'})
    37403726    hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI
    3741     if length(hget_field)>1
    3742         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
    37433729    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});
    37463731       idetect(iview)=exist(filename,'file');
    37473732       hget_field=get_field(filename);
    37483733       return
    37493734    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
    37573748end
    37583749
     
    37943785    increment=num_i1{1}(2)-num_i1{1}(1);
    37953786    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) '!']);
    37973788    else   
    37983789        answeryes=msgbox_uvmat('INPUT_Y-N',{['will take time series in ' num2str(NbSlice) ' slices'];['results stored as files ' filebase_out ' ...']});
     
    39303921                    nbcolor=size(A,3);
    39313922                    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'}};
    39363924                    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];
    39423925                         Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x'}};
    39433926                    end 
     
    39803963            end
    39813964            if isfield(Series,'ProjObject')
     3965                Series.ProjObject
    39823966                [Field,errormsg]=proj_field(Field,Series.ProjObject);
    39833967                if ~isempty(errormsg)
     
    40224006                                    DimCell={DimCell};
    40234007                                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
    40264009                                   testsum(ivar)=1;
    40274010                                end
     
    40344017                        end
    40354018                    end
    4036                  %   RecordData.ListDimName=[{'Time'} RecordData.ListDimName];%name of dimension
    40374019                    RecordData.ListVarName=[{'Time'} RecordData.ListVarName];
    40384020                end
     
    40504032                        end
    40514033                        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   
    40534035                    elseif testsum(ivar)==1% variable representing fixed coordinates
    40544036                        eval(['VarInit=RecordData.' VarName ';']);
     
    41174099    [filemean]=...
    41184100               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     RecordData
    4120      RecordData.VarDimName{1}
    4121      RecordData.VarDimName{2}
    4122       RecordData.VarDimName{3}
    41234101    errormsg=struct2nc(filemean,RecordData); %save result file
    41244102    if isempty(errormsg)
     
    44424420                            time_first=Attrib.absolut_time_T0;
    44434421                        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'))
    44454423                            time_first=Attrib.absolut_time_T0_2;
    44464424                        end
     
    44564434                            time_last=Attrib.absolut_time_T0;
    44574435                        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'))
    44594437                            time_last=Attrib.absolut_time_T0_2;
    44604438                        end
Note: See TracChangeset for help on using the changeset viewer.