/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_global.m
ViewVC logotype

Diff of /MITgcm_contrib/gael/matlab_class/gcmfaces_global.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.4 by gforget, Fri Mar 20 14:09:49 2015 UTC revision 1.12 by gforget, Mon Apr 2 17:44:59 2018 UTC
# Line 1  Line 1 
1  function []=gcmfaces_global(varargin);  function []=gcmfaces_global(varargin);
2  %object:    take care of path and global variables (mygrid and myenv),  %object:    take care of path and global variables (mygrid and myenv),
3  %           and sends global variables to caller routine workspace  %           and sends global variables to caller routine workspace
4  %optional inputs: optional paramaters take the following form  %optional inputs: optional paramaters take the following form
5  %           {'name',param1,param2,...}. Are currently active:  %           {'name',param1,param2,...}. Are currently active:
6  %               {'resetGrid',resetGrid} states that mygrid will be cleared  %               {'resetGrid',resetGrid} states that mygrid will be cleared
7  %                   and re-loaded interactively (1), or not (0;default).  %                   and re-loaded interactively (1), or not (0;default).
8  %               {'listVars',varName1,varName2} is a list of variables  %               {'listVars',varName1,varName2} is a list of variables
9  %                   to check is in mygrid (empty by default).  %                   to check is in mygrid (empty by default).
10  %notes:     - in any call, if this has not yet been done,  %notes:     - in any call, if this has not yet been done,
11  %           this routine also adds gcmfaces subdirectories  %           this routine also adds gcmfaces subdirectories
12  %           to the matlab path, and it defines myenv.  %           to the matlab path, and it defines myenv.
13  %           - calls to this routine will eventually replace  %           - calls to this routine will eventually replace
14  %           both gcmfaces_path and 'global mygrid' calls.  %           both gcmfaces_path and 'global mygrid' calls.
15    
16    warning(sprintf(['This version of gcmfaces, from an old CVS server, is \n' ...
17        ' now considered deprecated. Future devopment will proceed, instead, \n' ...
18        ' via GitHub. For up to date documentation, please refer to \n' ...
19        ' http://gcmfaces.readthedocs.io/en/latest/']));
20    
21  %set optional paramaters to default values  %set optional paramaters to default values
22  resetGrid=0; listVars={};  resetGrid=0; listVars={};
23  %set more optional paramaters to user defined values  %set more optional paramaters to user defined values
24  for ii=1:nargin;  for ii=1:nargin;
25      if ~iscell(varargin{ii});      if ~iscell(varargin{ii});
# Line 32  for ii=1:nargin; Line 37  for ii=1:nargin;
37              '         Type ''help gcmfaces_global'' for details.']);              '         Type ''help gcmfaces_global'' for details.']);
38      else;      else;
39          if strcmp(varargin{ii}{1},'listVars');          if strcmp(varargin{ii}{1},'listVars');
40              eval([varargin{ii}{1} '={varargin{ii}{2:end}};']);                          eval([varargin{ii}{1} '={varargin{ii}{2:end}};']);
41          elseif strcmp(varargin{ii}{1},'resetGrid');          elseif strcmp(varargin{ii}{1},'resetGrid');
42              eval([varargin{ii}{1} '=varargin{ii}{2};']);              eval([varargin{ii}{1} '=varargin{ii}{2};']);
43          else;          else;
# Line 75  if isempty(myenv); Line 80  if isempty(myenv);
80      myenv.lessplot=0;      myenv.lessplot=0;
81      myenv.lesstest=0;      myenv.lesstest=0;
82      myenv.useNativeMatlabNetcdf = ~isempty(which('netcdf.open'));      myenv.useNativeMatlabNetcdf = ~isempty(which('netcdf.open'));
83        myenv.issueWarnings=1;
84      %... check m_map and netcdf      %... check m_map and netcdf
85  end;  end;
86    
# Line 93  end; Line 99  end;
99    
100  %check available mygrid variables:  %check available mygrid variables:
101  for ii=1:length(listVars);  for ii=1:length(listVars);
102      if ~isfield(mygrid,listVars{ii});      if ~isfield(mygrid,listVars{ii});
103          error(['mygrid does not include ' listVars{ii}]);          error(['mygrid does not include ' listVars{ii}]);
104      end;      end;
105  end;  end;
106    
107  %issue warning if mygrid is empty:  %issue warning if mygrid is empty:
108  test0=isfield(mygrid,'XC');  test0=~isfield(mygrid,'XC');
109  if ~test0;  [ST,I]=dbstack; ST={ST(:).name}';
110      warning('mygrid has not yet been loaded to memory. To use gcmfaces please use grid_load.m first.');  test1=1;
111    list1={'grid_load','startup','example_display','example_IO',...
112        'example_remap','example_griddata','example_interp','example_faces2latlon2faces',...
113        'example_bin_average','example_transports','example_budget',...
114        'profiles_process_init','gcmfaces_init','diags_pre_process','diags_grid'};
115    list1={list1{:},'profiles_prep_main','profiles_prep_select','MITprof_demo'};
116    for jj=1:length(list1);
117        test1=test1&isempty(find(strcmp(ST,list1{jj})));
118    end;
119    if test0&test1&myenv.issueWarnings;
120        warning('mygrid has not yet been loaded to memory');
121  end;  end;
122    
123  %send to workspace:  %send to workspace:

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.22