Changeset 413 for trunk/src/view_field.m


Ignore:
Timestamp:
May 8, 2012, 2:27:50 PM (12 years ago)
Author:
sommeria
Message:

various bugs corrected and improvement in civ1_TEST

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/view_field.m

    r408 r413  
    9292AxeData.LimEditBox=1; %initialise AxeData, the parent figure sets plot parameters
    9393set(handles.axes3,'UserData',AxeData)
    94 if ~exist('Field','var')
    95     return
    96 end
    97 [PlotType,PlotParamOut]= plot_field(Field,handles.axes3);%,PlotParam,KeepLim,PosColorbar)
    98 
    99 if isfield(PlotParamOut,'Vectors')
    100     set(handles.Vectors,'Visible','on')
    101 end
    102 write_plot_param(handles,PlotParamOut);% update the display of the plotting parameters
    103 
     94if exist('Field','var')
     95    [PlotType,PlotParamOut]= plot_field(Field,handles.axes3);%,PlotParam,KeepLim,PosColorbar)
     96    set(handles.Coordinates,'Visible','on')
     97    if isfield(PlotParamOut,'Vectors')
     98        set(handles.Vectors,'Visible','on')
     99    end
     100    write_plot_param(handles,PlotParamOut);% update the display of the plotting parameters
     101end
    104102%------------------------------------------------------------------------
    105103% --- Outputs from this function are returned to the command menuline.
     
    140138        end
    141139    end
     140end
     141hciv=findobj(allchild(0),'Tag','civ');%find the current civ GUI
     142if ~isempty(hciv)
     143    hhciv=guidata(hciv);
     144    set(hhciv.TestCiv1,'Value',0)% desactivate  TestCiv1 if on
     145    set(hhciv.TestCiv1,'BackgroundColor',[1 0 0])%
     146end
     147corrfig=findobj(allchild(0),'tag','corrfig');% look for a civ correlation window used with TesCiv1
     148if ~isempty(corrfig)
     149    delete(corrfig)
    142150end
    143151
     
    317325if test
    318326    set(handles.CheckFixEqual,'BackgroundColor',[1 1 0])
    319     cla(handles.axes3)
    320327else
    321328    set(handles.CheckFixEqual,'BackgroundColor',[0.7 0.7 0.7])
     
    328335% --- Executes on button press in 'zoom'.
    329336%-------------------------------------------------------------------
    330 function zoom_Callback(hObject, eventdata, handles)
    331 if (get(handles.zoom,'Value') == 1);
    332     set(handles.zoom,'BackgroundColor',[1 1 0])
    333     set(handles.FixLimits,'Value',1)% propose by default fixed limits for the plotting axes
    334     set(handles.FixLimits,'BackgroundColor',[1 1 0])
    335 else
    336     set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
    337 end
    338 
    339 %-------------------------------------------------------------------
    340 %----Executes on button press in 'record': records the current flags of manual correction.
    341 %-------------------------------------------------------------------
    342 function record_Callback(hObject, eventdata, handles)
    343 % [filebase,num_i1,num_j1,num_i2,num_j2,Ext,NomType,SubDir]=read_input_file(handles);
    344 filename=read_file_boxes(handles);
    345 AxeData=get(gca,'UserData');
    346 [erread,message]=fileattrib(filename);
    347 if ~isempty(message) && ~isequal(message.UserWrite,1)
    348      msgbox_view_field('ERROR',['no writting access to ' filename])
    349      return
    350 end
    351 test_civ2=isequal(get(handles.civ2,'BackgroundColor'),[1 1 0]);
    352 test_civ1=isequal(get(handles.civ1,'BackgroundColor'),[1 1 0]);
    353 if ~test_civ2 && ~test_civ1
    354     msgbox_view_field('ERROR','manual correction only possible for CIV1 or CIV2 velocity fields')
    355 end
    356 if test_civ2
    357     nbname='nb_vectors2';
    358    flagname='vec2_FixFlag';
    359    attrname='fix2';
    360 end
    361 if test_civ1
    362     nbname='nb_vectors';
    363    flagname='vec_FixFlag';
    364    attrname='fix';
    365 end
    366 %write fix flags in the netcdf file
    367 hhh=which('netcdf.open');% look for built-in matlab netcdf library
    368 if ~isequal(hhh,'')% case of new builtin Matlab netcdf library
    369     nc=netcdf.open(filename,'NC_WRITE');
    370     netcdf.reDef(nc)
    371     netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1)
    372     dimid = netcdf.inqDimID(nc,nbname);
    373     try
    374         varid = netcdf.inqVarID(nc,flagname);% look for already existing fixflag variable
    375     catch
    376         varid=netcdf.defVar(nc,flagname,'double',dimid);%create fixflag variable if it does not exist
    377     end
    378     netcdf.endDef(nc)
    379     netcdf.putVar(nc,varid,AxeData.FF);
    380     netcdf.close(nc) 
    381 else %old netcdf library
    382     netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)
    383 end
    384 
    385 function netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)
    386 nc=netcdf(filename,'write'); %open netcdf file
    387 result=redef(nc);
    388 eval(['nc.' attrname '=1;']);
    389 theDim=nc(nbname) ;% get the number of velocity vectors
    390 nb_vectors=size(theDim);
    391 var_FixFlag=ncvar(flagname,nc);% var_FixFlag will be written as the netcdf variable vec_FixFlag
    392 var_FixFlag(1:nb_vectors)=AxeData.FF;%
    393 fin=close(nc);
     337function CheckZoom_Callback(hObject, eventdata, handles)
     338if (get(handles.CheckZoom,'Value') == 1);
     339    set(handles.CheckZoom,'BackgroundColor',[1 1 0])
     340    set(handles.CheckFixLimits,'Value',1)% propose by default fixed limits for the plotting axes
     341    set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
     342else
     343    set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
     344end
     345
     346% %-------------------------------------------------------------------
     347% %----Executes on button press in 'record': records the current flags of manual correction.
     348% %-------------------------------------------------------------------
     349% function record_Callback(hObject, eventdata, handles)
     350% % [filebase,num_i1,num_j1,num_i2,num_j2,Ext,NomType,SubDir]=read_input_file(handles);
     351% filename=read_file_boxes(handles);
     352% AxeData=get(gca,'UserData');
     353% [erread,message]=fileattrib(filename);
     354% if ~isempty(message) && ~isequal(message.UserWrite,1)
     355%      msgbox_view_field('ERROR',['no writting access to ' filename])
     356%      return
     357% end
     358% test_civ2=isequal(get(handles.civ2,'BackgroundColor'),[1 1 0]);
     359% test_civ1=isequal(get(handles.civ1,'BackgroundColor'),[1 1 0]);
     360% if ~test_civ2 && ~test_civ1
     361%     msgbox_view_field('ERROR','manual correction only possible for CIV1 or CIV2 velocity fields')
     362% end
     363% if test_civ2
     364%     nbname='nb_vectors2';
     365%    flagname='vec2_FixFlag';
     366%    attrname='fix2';
     367% end
     368% if test_civ1
     369%     nbname='nb_vectors';
     370%    flagname='vec_FixFlag';
     371%    attrname='fix';
     372% end
     373% %write fix flags in the netcdf file
     374% hhh=which('netcdf.open');% look for built-in matlab netcdf library
     375% if ~isequal(hhh,'')% case of new builtin Matlab netcdf library
     376%     nc=netcdf.open(filename,'NC_WRITE');
     377%     netcdf.reDef(nc)
     378%     netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1)
     379%     dimid = netcdf.inqDimID(nc,nbname);
     380%     try
     381%         varid = netcdf.inqVarID(nc,flagname);% look for already existing fixflag variable
     382%     catch
     383%         varid=netcdf.defVar(nc,flagname,'double',dimid);%create fixflag variable if it does not exist
     384%     end
     385%     netcdf.endDef(nc)
     386%     netcdf.putVar(nc,varid,AxeData.FF);
     387%     netcdf.close(nc) 
     388% else %old netcdf library
     389%     netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)
     390% end
     391%
     392% function netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)
     393% nc=netcdf(filename,'write'); %open netcdf file
     394% result=redef(nc);
     395% eval(['nc.' attrname '=1;']);
     396% theDim=nc(nbname) ;% get the number of velocity vectors
     397% nb_vectors=size(theDim);
     398% var_FixFlag=ncvar(flagname,nc);% var_FixFlag will be written as the netcdf variable vec_FixFlag
     399% var_FixFlag(1:nb_vectors)=AxeData.FF;%
     400% fin=close(nc);
    394401
    395402
     
    500507set_vec_col_bar(handles)
    501508update_plot(handles)
    502 %------------------------------------------------------------
    503 %update the slider values after displaying vectors
    504 %--------------------------------------------------------
    505 % function slider_update(handles,auto,minC,colcode1,colcode2,maxC)
    506 % set(handles.slider1,'Min',minC)
    507 % set(handles.slider1,'Max',maxC)
    508 % set(handles.slider2,'Min',minC)
    509 % set(handles.slider2,'Max',maxC)
    510 % set(handles.min_C_title_vec,'String',num2str(minC))
    511 % set(handles.max_vec,'String',num2str(maxC))
    512 % if auto
    513 %         set(handles.colcode1,'String',num2str(colcode1,3))%update display
    514 %         set(handles.colcode2,'String',num2str(colcode2,3))
    515 % end
    516 % set(handles.slider1,'Value',colcode1)%update slider with constant display
    517 % set(handles.slider2,'Value',colcode2)
    518 % set_vec_col_bar(handles)
    519 
    520509
    521510%-------------------------------------------------------
     
    719708set(handles.vec_col_bar,'Cdata',A)
    720709
    721 % %------------------------------------------------------------------------
    722 % function PlotType=update_plot(handles)
    723 % %------------------------------------------------------------------------
    724 % haxes= handles.axes3;
    725 %
    726 % %ProjField=get(haxes,'UserData');
    727 % ViewFieldData=get(handles.view_field,'UserData');
    728 % ProjField=ViewFieldData.axes3;
    729 % %ProjField=get(haxes,'UserData');
    730 % PlotParam=read_GUI(handles.view_field);
    731 % [PlotType,PlotParamOut]= plot_field(ProjField,haxes,PlotParam,1);
    732 % write_plot_param(handles,PlotParamOut); %update the auto plot parameters
    733 
    734710%-------------------------------------------------------------------
    735711function update_plot(handles)
     
    768744
    769745
    770 
    771 
    772746% --- Executes on selection change in ColorCode.
    773747function ColorCode_Callback(hObject, eventdata, handles)
Note: See TracChangeset for help on using the changeset viewer.