Changeset 1009 for trunk/src/get_field.m


Ignore:
Timestamp:
Jul 22, 2017, 7:20:02 PM (7 years ago)
Author:
sommeria
Message:

various bugs fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_field.m

    r977 r1009  
    1515% INPUT:
    1616% FileName: name (including path) of the netcdf file to open
     17% ParmIn: structure containing parameters for preselecting menus:
     18%   .Title: set the title of the GUI get_field
     19%   .SwitchVarIndexTime='file index','variable' or 'matrix index': select the default option for 'time'
     20%   .TimeAttrName: preselect the name of a global attribute for time
     21%   .SeriesInput=1 if get_field is called by the GUI series,=0 otherwise (plot options provided in the latter case)
     22%   .Coord_x,.Coord_y,.Coord_z, names of the variables used as the three coordinates
     23%   .scalar : set the default choise of the scale variable
     24%   .vector_x, .vector_y : set the default choise for the variables used for the x and y vector components
    1725
    1826%=======================================================================
     
    8593end
    8694if ~exist('ParamIn','var')
    87     ParamIn=[];
     95    ParamIn.Coord_z='';
    8896end
    8997
     
    151159    time_index=find(~cellfun('isempty',regexp(Field.Display.ListGlobalAttribute,'Time')),1);% look for global attribute containing name 'Time'
    152160end
    153 if ~isempty(time_index)
     161if isempty(time_index)
     162    set(handles.SwitchVarIndexTime,'Value',1);
     163else
    154164    set(handles.SwitchVarIndexTime,'Value',2);
    155165    set(handles.TimeName,'UserData',time_index)
    156 else
    157     set(handles.SwitchVarIndexTime,'Value',1);
    158166end
    159167set(handles.SwitchVarIndexTime,'String',ListSwitchVarIndexTime)
     
    230238    CoordIndex=CellInfo{imax}.CoordIndex;
    231239    if numel(CoordIndex)==2
     240        if isfield(ParamIn,'Coord_x')&& isfield(ParamIn,'Coord_y')
     241            YName=ParamIn.Coord_y;
     242            XName=ParamIn.Coord_x;
     243        else
    232244        YName=Field.ListVarName{CoordIndex(1)};
    233245        XName=Field.ListVarName{CoordIndex(2)};
     246        end
    234247        ListCoord=get(handles.Coord_x,'String');
    235248        XIndex=find(strcmp(XName,ListCoord));
     
    259272
    260273%% set z coordinate menu if relevant
    261 if Field.MaxDim>=3 && prod(Field.DimValue)<10^8; % 3D field (with memory content smaller than 400 Mo)
     274if Field.MaxDim>=3 && prod(Field.DimValue)<10^8 && ~isempty(ParamIn.Coord_z); % 3D field (with memory content smaller than 400 Mo)
    262275    set(handles.Check3D,'Value',1)
    263276else
Note: See TracChangeset for help on using the changeset viewer.