Changeset 575 for trunk/src/proj_field.m
- Timestamp:
- Feb 27, 2013, 6:39:32 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/proj_field.m
r569 r575 28 28 % .Txt: error message, transmitted to the projection 29 29 % .FieldList: cell array of strings representing the fields to calculate 30 % . Mesh: typical distance between data points (used for mouse action or display), transmitted30 % .CoordMesh: typical distance between data points (used for mouse action or display), transmitted 31 31 % .CoordUnit, .TimeUnit, .dt: transmitted 32 32 % standardised description of fields, nc-formated Matlab structure with fields: … … 321 321 ProjData.VarAttribute={}; 322 322 323 Mesh=zeros(1,numel(FieldData.ListVarName));323 CoordMesh=zeros(1,numel(FieldData.ListVarName)); 324 324 if isfield (FieldData,'VarAttribute') 325 325 %ProjData.VarAttribute=FieldData.VarAttribute;%list of variable attribute names … … 329 329 unit{iattr}=FieldData.VarAttribute{iattr}.Unit; 330 330 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; 333 333 end 334 334 end … … 462 462 ProjData.([VarName 'Min'])=min(double(FieldData.(VarName)(indsel,:))); % take the min in the selected region , for each color component 463 463 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 bins464 if isequal(CoordMesh(ivar),0) 465 [ProjData.([VarName 'Histo']),ProjData.(VarName)]=hist(double(FieldData.(VarName)(indsel,:,:)),100); % default histogram with 100 bins 466 466 else 467 eval(['ProjData.' VarName '=(ProjData.' VarName 'Min+Mesh(ivar)/2:Mesh(ivar):ProjData.' VarName 'Max);']); % list of bin values468 eval(['ProjData.' VarName 'Histo=hist(double(FieldData.' VarName '(indsel,:)),ProjData.' VarName ');']); % histogram at predefined bin positions467 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 469 469 end 470 470 ProjData.ListVarName=[ProjData.ListVarName {VarName} {[VarName 'Histo']} {[VarName 'Mean']} {[VarName 'Min']} {[VarName 'Max']}]; … … 891 891 if isfield(ObjectData,'DX') && ~isempty(ObjectData.DX) 892 892 DX=abs(ObjectData.DX);%mesh of interpolation points 893 %else894 % DX=FieldData.Mesh;893 else 894 DX=FieldData.CoordMesh; 895 895 end 896 896 if isfield(ObjectData,'DY') && ~isempty(ObjectData.DY) 897 897 DY=abs(ObjectData.DY);%mesh of interpolation points 898 %else899 % DY=FieldData.Mesh;898 else 899 DY=FieldData.CoordMesh; 900 900 end 901 901 if ~strcmp(ObjectData.ProjMode,'projection') && (isempty(DX)||isempty(DY)) … … 962 962 ProjData.VarAttribute={}; 963 963 if ~isempty(DX) && ~isempty(DY) 964 ProjData. Mesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots965 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 965 elseif isfield(FieldData,'CoordMesh') 966 ProjData.CoordMesh=FieldData.CoordMesh; 967 967 end 968 968 error=0;%default … … 1656 1656 ProjData.VarDimName={}; 1657 1657 if ~isequal(DX,0)&& ~isequal(DY,0) 1658 ProjData. Mesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots1659 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 1659 elseif isfield(FieldData,'CoordMesh') 1660 ProjData.CoordMesh=FieldData.CoordMesh; 1661 1661 end 1662 1662
Note: See TracChangeset
for help on using the changeset viewer.