loadConventionalGEM Loads the conventional GEM (non-ecModel) from the location specified in the modelAdapter. By default, it looks in the models/ subdirectory of the param.path specified in the modelAdapter. When loading conventional GEMs from other locations, one can directly use importModel. Input: filename name of the model file, located in the the models/ subfolder of param.path as specified in the modelAdapter (Optional, will otherwise use the value specified as param.convGEM in the modelAdapter) modelAdapter a loaded model adapter, from where the model folder is read (Optional, will otherwise use the default model adapter). Output: model model in RAVEN format Usage: model = loadConventionalGEM(filename, modelAdapter)
0001 function model = loadConventionalGEM(filename, modelAdapter) 0002 % loadConventionalGEM 0003 % Loads the conventional GEM (non-ecModel) from the location specified in 0004 % the modelAdapter. By default, it looks in the models/ subdirectory of 0005 % the param.path specified in the modelAdapter. When loading 0006 % conventional GEMs from other locations, one can directly use importModel. 0007 % 0008 % Input: 0009 % filename name of the model file, located in the the models/ 0010 % subfolder of param.path as specified in the 0011 % modelAdapter (Optional, will otherwise use the 0012 % value specified as param.convGEM in the 0013 % modelAdapter) 0014 % modelAdapter a loaded model adapter, from where the model folder is 0015 % read (Optional, will otherwise use the default model adapter). 0016 % 0017 % Output: 0018 % model model in RAVEN format 0019 % 0020 % Usage: 0021 % model = loadConventionalGEM(filename, modelAdapter) 0022 0023 0024 if nargin < 2 || isempty(modelAdapter) 0025 modelAdapter = ModelAdapterManager.getDefault(); 0026 if isempty(modelAdapter) 0027 error('Either send in a modelAdapter or set the default model adapter in the ModelAdapterManager.') 0028 end 0029 end 0030 params = modelAdapter.getParameters(); 0031 if nargin < 1 || isempty(filename) 0032 filename = params.convGEM; 0033 else 0034 filename = fullfile(params.path,'models',[filename, '.xml']) 0035 end 0036 0037 if endsWith(filename,'.xml') 0038 model = importModel(filename); 0039 elseif endsWith(filename,'.yml') 0040 model = readYAMLmodel(filename); 0041 end