Changeset 107 for trunk/src/series


Ignore:
Timestamp:
Jul 26, 2010, 11:20:39 PM (14 years ago)
Author:
sommeria
Message:

aver_stat and time_series: bug repairs for reading images, for time series, the projection of images on a line now works
get_field: various bug repairs, export field on work space activated
struct2nc and struct2nc_toolbox.m: small bug repaired
nomtype2pair: test on string input introduced to avoid error
cell2tab: test on multiline input introduced
civ: pb about cell repair (bug with recent versions of matlab)

Location:
trunk/src/series
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/aver_stat.m

    r80 r107  
    323323                            A=imread(filename);
    324324                    end
    325                     Data{iview}.ListVarName={'coord_y','coord_x','A'}; %
     325                    Data{iview}.ListVarName={'AY','AX','A'}; %
    326326                    Atype{iview}=class(A);
    327327                    npy=size(A,1);
     
    329329                    nbcolor=size(A,3);
    330330                    if nbcolor==3
    331                          Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x','rgb'}};
     331                         Data{iview}.VarDimName={'AY','AX',{'AY','AX','rgb'}};
    332332                    else
    333                          Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x'}};
     333                         Data{iview}.VarDimName={'AY','AX',{'AY','AX'}};
    334334                    end 
    335                     Data{iview}.coord_y=[npy-0.5 0.5];
    336                     Data{iview}.coord_x=[0.5 npx-0.5];
     335                    Data{iview}.AY=[npy-0.5 0.5];
     336                    Data{iview}.AX=[0.5 npx-0.5];
    337337                    Data{iview}.A=double(A);
    338338                    Data{iview}.CoordType='px';
  • trunk/src/series/time_series.m

    r102 r107  
    186186end
    187187
    188 % Root name of output files (TO GENERALISE FOR TWO INPUT SERIES)
    189 % filebasesub=fullfile(RootPath{1},RootFile{1});
    190 % if NbSlice==1
    191 %     filebase_out=[filebasesub '_time'];
    192 % else
    193 %     filebase_out=[filebasesub '_' NbSlice_name 'mtim'];
    194 %     increment=num_i1{1}(2)-num_i1{1}(1);
    195 %     if ~isequal(increment,1) % if an increment is set
    196 %         answeryes=msgbox_uvmat('INPUT_Y-N',['will take time series in ' num2str(NbSlice) 'slices with increment = ' num2str(increment) '!']);
    197 %     else   
    198 %         answeryes=msgbox_uvmat('INPUT_Y-N',{['will take time series in ' num2str(NbSlice) ' slices'];['results stored as files ' filebase_out ' ...']});
    199 %     end
    200 %     if ~isequal(answeryes,'Yes')
    201 %         return
    202 %     end
    203 % end
    204188VelType_str=get(hseries.VelTypeMenu,'String');
    205189VelType_val=get(hseries.VelTypeMenu,'Value');
     
    288272% Root name of output files (TO GENERALISE FOR TWO INPUT SERIES)
    289273subdir_result='time_series';
    290 % filebasesub=fullfile(RootPath{1},subdir_result,RootFile{1});
    291 % if isempty(SubDir{1}) % create a subdirectory '/aver_stat'
    292 %     subdir_result='aver_stat';
    293 %     filebasemean=fullfile(RootPath{1},subdir_result);
    294274if ~exist(fullfile(RootPath{1},subdir_result),'dir')
    295275    dircur=pwd; %record current working directory
     
    351331                            A=imread(filename);
    352332                    end
    353                     Data{iview}.ListVarName={'coord_y','coord_x','A'}; %
     333                    Data{iview}.ListVarName={'AY','AX','A'}; %
    354334                    npy=size(A,1);
    355335                    npx=size(A,2);
    356336                    nbcolor=size(A,3);
    357337                    if nbcolor==3
    358                          Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x','rgb'}};
     338                         Data{iview}.VarDimName={'AY','AX',{'AY','AX','rgb'}};
    359339                    else
    360                          Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x'}};
     340                         Data{iview}.VarDimName={'AY','AX',{'AY','AX'}};
    361341                    end 
    362                     Data{iview}.coord_y=[npy-0.5 0.5];
    363                     Data{iview}.coord_x=[0.5 npx-0.5];
     342                    Data{iview}.AY=[npy-0.5 0.5];
     343                    Data{iview}.AX=[0.5 npx-0.5];
    364344                    Data{iview}.A=double(A);
    365345                    Data{iview}.CoordType='px';
     
    426406                        for ivar=1:nbvar
    427407                            if length(Field.VarAttribute)>=ivar && isfield(Field.VarAttribute{ivar},'Role')
     408                               %Field.ListVarName{ivar}
    428409                                var_role=Field.VarAttribute{ivar}.Role;%'role' of the variable
    429410                                if isequal(var_role,'errorflag')
     
    439420                                    testsum(ivar)=1; %constant coordinates, record without time evolution
    440421                                end
    441                                 % check whether the variable ivar is a dimension variable
    442                                 DimCell=Field.VarDimName{ivar};
    443                                 if ischar(DimCell)
    444                                     DimCell={DimCell};
    445                                 end
    446                                 if numel(DimCell)==1 && isequal(Field.ListVarName{ivar},DimCell{1})%detect dimension variables
    447                                    testsum(ivar)=1;
    448                                 end
     422                            end
     423                            % check whether the variable ivar is a dimension variable
     424                            DimCell=Field.VarDimName{ivar};
     425                            if ischar(DimCell)
     426                                DimCell={DimCell};
     427                            end
     428                            if numel(DimCell)==1 && isequal(Field.ListVarName{ivar},DimCell{1})%detect dimension variables
     429                               testsum(ivar)=1;
    449430                            end
    450431                        end
     
    506487    end
    507488        % add time dimension and update VarDimIndex:
    508    %if ~isequal(Series.ProjObject.ProjMode,'inside')% take the average in the domain for 'inside' mode
    509489        for ivar=1:length(Field.ListVarName)
    510 %              vardimindex=Field.VarDimIndex{ivar};% array of dimension indices for variable VarIndex(ivar)
    511490             DimCell=Field.VarDimName(ivar);
    512491             if testsum(ivar)==2%variable used as time series
    513 %                  RecordData.VarDimIndex{ivar}=[1 vardimindex+1];
    514492                  RecordData.VarDimName{ivar}=[{'Time'} DimCell];
    515493             elseif testsum(ivar)==1
    516 %                  RecordData.VarDimIndex{ivar}=[vardimindex+1];
    517494                 RecordData.VarDimName{ivar}=DimCell;
    518495             end
    519496        end
    520    % end
    521497    indexremove=find(~testsum);
    522498    if ~isempty(indexremove)
     
    527503        end
    528504    end
    529     %RecordData.VarDimIndex=[{[1]} RecordData.VarDimIndex]; %time dimension
     505
    530506    %shift variable attributes
    531507    if isfield(RecordData,'VarAttribute')
     
    534510    RecordData.VarDimName=[{'Time'} RecordData.VarDimName];
    535511    RecordData.Action=Series.Action;%name of the processing programme
     512   
    536513    %name of result file
    537514    [filemean]=...
     
    544521    end
    545522end
     523
    546524figure
    547525haxes=axes;
Note: See TracChangeset for help on using the changeset viewer.