1 function e=read_namelist_fire_emissions(file)
2 % e=read_namelist_emissions(file)
3 % read namelist.fire_emissions and return structure with one field per
4 % species with array emission factors for each fuel category
6 if ~exist('file','var'),
7 file='namelist.fire_emissions';
9 command = ['grep "[a-zA-Z0-9]=" ',file,...
10 ' | sed ''s/=/=[/'' | sed ''s/$/];/'' | grep -v ''^\!'' | grep -v printsums | sed ''s/^/e./'' | grep -v compatible'];
11 [status,result]=system(command);
14 error('shell command failed')
16 eval(result) % now all the lines in namelist.fire_emissions are variables length number of fuel categories
21 ncat(i)=length(e.(species));
22 e.(species)(ncat(i)+1)=0;
24 if any(ncat~=ncat(1)),
25 error('all lines must have the same number of fuel categories');