Changeset 575 for trunk/src/proj_field.m


Ignore:
Timestamp:
Feb 27, 2013, 6:39:32 PM (8 years ago)
Author:
sommeria
Message:

various bugs corrected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/proj_field.m

    r569 r575  
    2828%    .Txt: error message, transmitted to the projection
    2929%    .FieldList: cell array of strings representing the fields to calculate
    30 %    .Mesh: typical distance between data points (used for mouse action or display), transmitted
     30%    .CoordMesh: typical distance between data points (used for mouse action or display), transmitted
    3131%    .CoordUnit, .TimeUnit, .dt: transmitted
    3232% standardised description of fields, nc-formated Matlab structure with fields:
     
    321321ProjData.VarAttribute={};
    322322
    323 Mesh=zeros(1,numel(FieldData.ListVarName));
     323CoordMesh=zeros(1,numel(FieldData.ListVarName));
    324324if isfield (FieldData,'VarAttribute')
    325325    %ProjData.VarAttribute=FieldData.VarAttribute;%list of variable attribute names
     
    329329            unit{iattr}=FieldData.VarAttribute{iattr}.Unit;
    330330        end
    331         if isfield(FieldData.VarAttribute{iattr},'Mesh')
    332             Mesh(iattr)=FieldData.VarAttribute{iattr}.Mesh;
     331        if isfield(FieldData.VarAttribute{iattr},'CoordMesh')
     332            CoordMesh(iattr)=FieldData.VarAttribute{iattr}.CoordMesh;
    333333        end
    334334    end
     
    462462        ProjData.([VarName 'Min'])=min(double(FieldData.(VarName)(indsel,:))); % take the min in the selected region , for each color component
    463463        ProjData.([VarName 'Max'])=max(double(FieldData.(VarName)(indsel,:))); % take the max in the selected region , for each color component
    464         if isequal(Mesh(ivar),0)
    465             eval(['[ProjData.' VarName 'Histo,ProjData.' VarName ']=hist(double(FieldData.' VarName '(indsel,:,:)),100);']); % default histogram with 100 bins
     464        if isequal(CoordMesh(ivar),0)
     465            [ProjData.([VarName 'Histo']),ProjData.(VarName)]=hist(double(FieldData.(VarName)(indsel,:,:)),100); % default histogram with 100 bins
    466466        else
    467             eval(['ProjData.' VarName '=(ProjData.' VarName 'Min+Mesh(ivar)/2:Mesh(ivar):ProjData.' VarName 'Max);']); % list of bin values
    468             eval(['ProjData.' VarName 'Histo=hist(double(FieldData.' VarName '(indsel,:)),ProjData.' VarName ');']); % histogram at predefined bin positions
     467            ProjData.(VarName)=ProjData.([VarName 'Min'])+CoordMesh(ivar)/2:CoordMesh(ivar):ProjData.([VarName 'Max']); % list of bin values
     468            ProjData.([VarName 'Histo'])=hist(double(FieldData.(VarName)(indsel,:)),ProjData.(VarName)); % histogram at predefined bin positions
    469469        end
    470470        ProjData.ListVarName=[ProjData.ListVarName {VarName} {[VarName 'Histo']} {[VarName 'Mean']} {[VarName 'Min']} {[VarName 'Max']}];
     
    891891if isfield(ObjectData,'DX') && ~isempty(ObjectData.DX)
    892892     DX=abs(ObjectData.DX);%mesh of interpolation points
    893 % else
    894 %     DX=FieldData.Mesh;
     893else
     894     DX=FieldData.CoordMesh;
    895895end
    896896if isfield(ObjectData,'DY') && ~isempty(ObjectData.DY)
    897897     DY=abs(ObjectData.DY);%mesh of interpolation points
    898 % else
    899 %     DY=FieldData.Mesh;
     898else
     899     DY=FieldData.CoordMesh;
    900900end
    901901if  ~strcmp(ObjectData.ProjMode,'projection') && (isempty(DX)||isempty(DY))
     
    962962ProjData.VarAttribute={};
    963963if ~isempty(DX) && ~isempty(DY)
    964     ProjData.Mesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots
    965 elseif isfield(FieldData,'Mesh')
    966     ProjData.Mesh=FieldData.Mesh;
     964    ProjData.CoordMesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots
     965elseif isfield(FieldData,'CoordMesh')
     966    ProjData.CoordMesh=FieldData.CoordMesh;
    967967end
    968968error=0;%default
     
    16561656ProjData.VarDimName={};
    16571657if ~isequal(DX,0)&& ~isequal(DY,0)
    1658     ProjData.Mesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots
    1659 elseif isfield(FieldData,'Mesh')
    1660     ProjData.Mesh=FieldData.Mesh;
     1658    ProjData.CoordMesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots
     1659elseif isfield(FieldData,'CoordMesh')
     1660    ProjData.CoordMesh=FieldData.CoordMesh;
    16611661end
    16621662
Note: See TracChangeset for help on using the changeset viewer.