Changeset 408 for trunk/src/proj_field.m


Ignore:
Timestamp:
May 5, 2012, 6:34:46 PM (12 years ago)
Author:
sommeria
Message:

various bugs corrected in series and uvmat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/proj_field.m

    r402 r408  
    8282function [ProjData,errormsg]=proj_field(FieldData,ObjectData)
    8383errormsg='';%default
    84 % if ~exist('FieldName','var')
    85 %     FieldName='';
    86 % end
     84ProjData=[];
     85
    8786%% case of no projection (object is used only as graph display)
    8887if isfield(ObjectData,'ProjMode') && (isequal(ObjectData.ProjMode,'none')||isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside'))
    89     ProjData=[];
    9088    return
    9189end
    9290
     91%% check coincidence of coordinate units
     92if isfield(FieldData,'CoordUnit') && isfield(ObjectData,'CoordUnit')&&~strcmp(FieldData.CoordUnit,ObjectData.CoordUnit)
     93    errormsg='inconsistent coord units for field and projection object';
     94    return
     95end
     96   
    9397%% in the absence of object Type or projection mode, or object coordinaes, the input field is just tranfered without change
    9498if ~isfield(ObjectData,'Type')||~isfield(ObjectData,'ProjMode')
     
    10911095            if testbound
    10921096                indcut=find(testin);
     1097                if isempty(indcut)
     1098                    errormsg='data outside the bounds of the projection object';
     1099                    return
     1100                end
    10931101                for ivar=VarIndex
    10941102                    VarName=FieldData.ListVarName{ivar};
     
    11051113        switch ObjectData.ProjMode
    11061114            case 'projection'
    1107                 %the list of dimension
    1108                 %ProjData.ListDimName=[ProjData.ListDimName FieldData.VarDimName(VarIndex(1))];%add the point index to the list of dimensions
    1109                 %ProjData.DimValue=[ProjData.
    1110                 %length(coord_X)];
    1111                
    11121115                for ivar=VarIndex %transfer variables to the projection plane
    11131116                    VarName=FieldData.ListVarName{ivar};
     
    11471150                if ~isequal(ivar_FF,0)
    11481151                    VarName_FF=FieldData.ListVarName{ivar_FF};
    1149                     eval(['indsel=find(FieldData.' VarName_FF '==0);'])
     1152                    indsel=find(FieldData.(VarName_FF)==0);
    11501153                    coord_X=coord_X(indsel);
    11511154                    coord_Y=coord_Y(indsel);
Note: See TracChangeset for help on using the changeset viewer.