Changeset 206 for trunk/src/read_civxdata.m
- Timestamp:
- Feb 27, 2011, 10:40:29 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/read_civxdata.m
r186 r206 48 48 49 49 function [Field,VelTypeOut]=read_civxdata(filename,FieldNames,VelType) 50 50 %% default input 51 51 if ~exist('VelType','var') 52 52 VelType=[]; … … 58 58 FieldNames=[]; %default 59 59 end 60 61 %% reading data 60 62 VelTypeOut=VelType;%default 61 63 [var,role,units,vel_type_out_cell]=varcivx_generator(FieldNames,VelType);%determine the names of constants and variables to read 62 [Field,vardetect,ichoice]=nc2struct(filename,var); 63 %if isfield(Field,'Txt')64 % return % error in file reading 65 %end64 [Field,vardetect,ichoice]=nc2struct(filename,var);%read the variables in the netcdf file 65 if isfield(Field,'Txt') 66 return 67 end 66 68 if vardetect(1)==0 67 69 Field.Txt=[ 'requested field not available in ' filename '/' VelType]; 70 return 68 71 end 69 72 var_ind=find(vardetect); 70 73 for ivar=1:length(var_ind) 71 74 Field.VarAttribute{ivar}.Role=role{var_ind(ivar)}; 72 Field.VarAttribute{ivar}.Mesh=0.1;%typical mesh for histograms O.1 pixel 73 % Field.VarAttribute{ivar}.units=units{var_ind(ivar)};% not necessary: set with calc_field 75 Field.VarAttribute{ivar}.Mesh=0.1;%typical mesh for histograms O.1 pixel 74 76 end 75 77 VelTypeOut=VelType; … … 78 80 end 79 81 80 % adjust for Djui:82 %% adjust for Djui: 81 83 if isfield(Field,'DjUi') 82 84 Field.ListVarName(end-2:end)=[]; … … 86 88 end 87 89 88 % renaiming for standard conventions90 %% renaming for standard conventions 89 91 Field.NbCoord=Field.nb_coord; 90 92 Field.NbDim=Field.nb_dim; 91 93 92 % CivStage94 %% CivStage 93 95 if isfield(Field,'patch2')&& isequal(Field.patch2,1) 94 96 Field.CivStage=6; … … 178 180 function [var,role,units,vel_type_out]=varcivx_generator(FieldNames,vel_type) 179 181 180 % default input values182 %% default input values 181 183 if ~exist('vel_type','var'),vel_type=[];end; 182 184 if iscell(vel_type),vel_type=vel_type{1}; end;%transform cell to string if needed 183 % if ~exist('display','var'),display=[];end;184 185 if ~exist('FieldNames','var'),FieldNames={'ima_cor'};end;%default scalar 185 186 if ischar(FieldNames), FieldNames={FieldNames}; end; 186 187 187 % select the priority order for automatic vel_type selection188 %% select the priority order for automatic vel_type selection 188 189 testder=0; 189 190 for ilist=1:length(FieldNames) … … 221 222 vel_type_out=vel_type_out'; 222 223 223 % determine names of netcdf variables to read224 %% determine names of netcdf variables to read 224 225 var={'X','Y','Z','U','V','W','C','F','FF'}; 225 226 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag'}; … … 234 235 end 235 236 236 237 %------------------------- 238 %determine var names to read 239 %-------------------------------------- 237 %------------------------------------------------------------------------ 238 %--- determine var names to read 240 239 function varin=varname1(vel_type,FieldNames) 241 240 %------------------------------------------------------------------------ 242 241 testder=0; 243 242 C1='';
Note: See TracChangeset
for help on using the changeset viewer.