%------------------------------------------------------------------------ % NAME: qp_abs % % A function to calculate the absorption corresponding to a Q % structure, with the possibility to replace F_MONO and P_ABS. % % The optional arguments F_MONO and P_ABS can be empty, and % then original vectors are used. % % Not all fields of Q must be set. % % FORMAT: y = qp_ympb( Q [, f_mono, p_abs ] ) % % OUT: Abs Calculated absorption. % IN: Q Setting structure. % OPTIONAL: f_mono Alternative monochromatic frequency grid. % p_abs Alternative absorption pressure grid. % TEMPLATE: basic.tmplt %------------------------------------------------------------------------ % HISTORY: 2002.01.17 Created by Patrick Eriksson. function Abs = qp_abs( Q, f_mono, p_abs ) %=== Create temporary dir % tmpdir = temporary_directory( Q.TMP_AREA ); %=== If necessary, use TMPDIR as CALCGRIDS_DIR % if nargin > 1 % %= Copy all .aa and .ab files to TMPDIR D = dir( [Q.CALCGRIDS_DIR,'/*.a*'] ); for i = 1:length(D) copyfile( [Q.CALCGRIDS_DIR,'/',D(i).name], [tmpdir,'/',D(i).name] ); end % Q.CALCGRIDS_DIR = tmpdir; % if exist('f_mono') & ~isempty(f_mono) write_datafile( [Q.CALCGRIDS_DIR,'/',Q.F_MONO], f_mono, 'VECTOR' ); end % if exist('p_abs') & ~isempty(p_abs) write_datafile( [Q.CALCGRIDS_DIR,'/',Q.P_ABS], p_abs, 'VECTOR' ); end end %=== Get full path of template file and create cfile % template = which( 'basic.tmplt' ); % QE.ABS_SAVE = 1; QE.ABS_EXIT = 1; % [cfile,basename] = qtool( Q, tmpdir, template, QE ); %=== Run ARTS % qp_arts( Q, cfile ); %=== Load spectrum % Abs = read_artsvar( basename, 'abs' ); %=== Delete the temporary directory delete_tmp_dir( Q.TMP_AREA, tmpdir );