Changeset 1001 for trunk/src/read_field.m
- Timestamp:
- Feb 27, 2017, 9:28:27 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/read_field.m
r980 r1001 152 152 [Field,var_detect,ichoice,errormsg]=nc2struct(FileName,'TimeVarName',ParamIn.TimeVarName,num,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVar]); 153 153 if numel(num)~=1 154 NbCoord=NbCoord+1;% adds time coordinate, except if q single time hqs been selected154 NbCoord=NbCoord+1;% adds time coordinate, except if a single time has been selected 155 155 end 156 156 else … … 160 160 return 161 161 end 162 %scan all the variables beyond the two first ones, ParamIn.Coord_x and ParamIn.Coord_y. 162 CheckStructured=1; 163 %scan all the variables beyond the two first NbCoord ones describing the coordinates. 163 164 for ilist=NbCoord+1:numel(Field.VarDimName) 164 165 if isequal(Field.VarDimName{1},Field.VarDimName{ilist}) % if a variable has the same dimension as the coordinate, it denotes a field with unstructured coordinates … … 168 169 Field.VarAttribute{3}.Role='coord_z'; 169 170 end 171 CheckUnstructured=0; 170 172 break 171 173 end 172 174 end 175 if CheckStructured 176 for ilist=NbCoord+1:numel(Field.VarDimName) 177 rank(1)=find(strcmp(ParamIn.Coord_x,Field.VarDimName{ilist})); 178 rank(2)=find(strcmp(ParamIn.Coord_y,Field.VarDimName{ilist})); 179 if NbCoord==3 180 rank(3)=find(strcmp(ParamIn.Coord_z,Field.VarDimName{ilist})); 181 end 182 rank=flip(rank); 183 VarName=Field.ListVarName{ilist}; 184 Field.(VarName)=permute(Field.(VarName),rank); 185 Field.VarDimName{ilist}=Field.VarDimName{ilist}(rank);% permute the order of dimensions 186 end 187 end 173 188 NormName=''; 174 189 UName=''; … … 225 240 Field.VarAttribute=[cell(1,numel(Field.ListDimName)) Field.VarAttribute]; 226 241 end 242 227 243 end 228 244 case 'video'
Note: See TracChangeset
for help on using the changeset viewer.