- Timestamp:
- Mar 15, 2010, 5:43:08 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/RUN_FIX.m
r19 r47 4 4 % 5 5 %filename: name of the netcdf file (used as input and output) 6 %field: structure specifying the field to fix (field.vel_type='civ1' or 'civ2') 6 %field: structure specifying the names of the fields to fix (depending on civ1 or civ2) 7 %.vel_type='civ1' or 'civ2'; 8 %.nb=name of the dimension common to the field to fix ('nb_vectors' for civ1); 9 %.fixflag=name of fix flag variable ('vec_FixFlag' for civ1) 7 10 %flagindex: flag specifying which values of vec_f are removed: 8 11 % if flagindex(1)=1: vec_f=-2 vectors are removed … … 21 24 error=[]; %default 22 25 vel_type{1}=field.vel_type; 23 Field=read_civxdata(filename,[],field.vel_type); 26 %check writing access 27 [errorread,message]=fileattrib(filename); 28 if ~isempty(message) && ~isequal(message.UserWrite,1) 29 msgbox_uvmat('ERROR',['no writting access to ' filename ' (RUN_FIX.m)']); 30 return 31 end 32 Field=read_civxdata(filename,'ima_cor',field.vel_type); 24 33 if isfield(Field,'Txt') 25 34 error=Field.Txt; %error in reading … … 82 91 delta_v=Field.V-vec_V_ref; 83 92 end 84 85 93 thresh_vel_x=thresh_vel; 86 94 thresh_vel_y=thresh_vel; … … 123 131 end 124 132 flagmagenta=flag1|flag2|flag3|flag4|flag5|flag7; 133 fixflag_unit=Field.FF-10*floor(Field.FF/10); %unity term of fix_flag 125 134 126 %write fix flags 127 [errorread,message]=fileattrib(filename); 128 129 if ~isempty(message) && ~isequal(message.UserWrite,1) 130 msgbox_uvmat('ERROR',['no writting access to ' filename ' (RUN_FIX.m)']); 131 return 135 %write fix flags in the netcdf file 136 hhh=which('netcdf.open');% look for built-in matlab netcdf library 137 if ~isequal(hhh,'')% case of new builtin Matlab netcdf library 138 nc=netcdf.open(filename,'NC_WRITE'); 139 netcdf.reDef(nc) 140 if iter==1 141 netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'fix1',1) 142 elseif iter==2 143 netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'fix2',1) 144 end 145 dimid = netcdf.inqDimID(nc,field.nb); 146 try 147 varid = netcdf.inqVarID(nc,field.fixflag);% look for already existing fixflag variable 148 catch 149 varid=netcdf.defVar(nc,field.fixflag,'double',dimid);%create fixflag variable if it does not exist 150 end 151 netcdf.endDef(nc) 152 netcdf.putVar(nc,varid,fixflag_unit+10*flagmagenta); 153 netcdf.close(nc) 154 else %old netcdf library 155 nc=netcdf(filename,'write'); %open netcdf file for writing 156 result=redef(nc); 157 if isempty(result), msgbox_uvmat('ERROR','##Bad redef operation.'),end 158 if iter==1 159 nc.fix=1; 160 elseif iter==2 161 nc.fix2=1; 162 end 163 nc{field.fixflag}=ncfloat(field.nb); 164 fixflag_unit=Field.FF-10*floor(Field.FF/10); %unity term of fix_flag 165 nc{field.fixflag}(:)=fixflag_unit+10*flagmagenta; 166 close(nc); 132 167 end 133 nc=netcdf(filename,'write'); %open netcdf file for writing134 result=redef(nc);135 if isempty(result), errordlg('##Bad redef operation.'),end136 if iter==1137 nc.fix=1;138 elseif iter==2139 nc.fix2=1;140 end141 %theDim=nc(field.nb) ;% get the number of velocity vectors142 nc{field.fixflag}=ncfloat(field.nb);143 fixflag_unit=Field.FF-10*floor(Field.FF/10); %unity term of fix_flag144 nc{field.fixflag}(:)=fixflag_unit+10*flagmagenta;145 close(nc); -
trunk/src/read_get_field.m
r34 r47 588 588 end 589 589 ind_select=find(npxy~=1);%look for non singleton dimensions 590 DimCellU=DimCellU(ind_select); 590 if numel(DimCellU)>=ind_select 591 DimCellU=DimCellU(ind_select); 592 end 591 593 npxy=npxy(ind_select); 592 594 dimU=[]; -
trunk/src/update_obj.m
r19 r47 68 68 name_str=get(plotfig,'Name'); 69 69 if ~isequal(name_str,'uvmat') 70 set(plotfig,'Name',['Projection on' num2str(IndexObj) '-' set_title(ObjectData.Style,ObjectData.ProjMode)]);70 set(plotfig,'Name',['Projection on' num2str(IndexObj) '-' ObjectData.Style]); 71 71 end 72 72 end
Note: See TracChangeset
for help on using the changeset viewer.