pref_ind = 1; % level of reference pressure for the HSE zref_ind = 1; % level of reference pressure for the HSE % call structure Q=qpack('spectro_sample') %create the retrieval grid, This is just to have a consistent %retrieval grid even the atmosphere setup is changed grid.lowstrato = [2:2:30]*1e3; grid_2km = [2:2:60]*1e3; grid_3km = [2:3:60]*1e3; grid_4km = [2:4:60]*1e3; % read into the pressure profile PTZ_FILE = Q.APRIORI_PTZ; ptz=read_datafile(PTZ_FILE, 'Matrix'); % find the corresponding values for pref and zref necessary % for hydrostatic calculation.ptz=read_datafile(PTZ_FILE, 'Matrix'); pref = ptz(pref_ind, 1); zref = ptz(pref_ind, 3); p_abs=loggrid([ptz(1,1),ptz(size(ptz,1), 1)], 15); % create the grid in pressure units grid.lowstrato=interp1(ptz(:,3), ptz(:,1), grid.lowstrato ); grid_2km=interp1(ptz(:,3), ptz(:,1), grid_2km ); grid_3km=interp1(ptz(:,3), ptz(:,1), grid_3km ); grid_4km=interp1(ptz(:,3), ptz(:,1), grid_4km ); % % write into the files write_datafile([Q.CALCGRIDS_DIR,'/p_abs.aa'], p_abs,... 'Vector'); write_datafile([Q.RETRIEVDEF_DIR,'/grid.lowstrato.aa'], grid.lowstrato, ... 'Vector'); write_datafile([Q.RETRIEVDEF_DIR,'/grid_2km.aa'], grid_2km, ... 'Vector'); write_datafile([Q.RETRIEVDEF_DIR,'/grid_3km.aa'], grid_3km, ... 'Vector'); write_datafile([Q.RETRIEVDEF_DIR,'/grid_4km.aa'], grid_4km, ... 'Vector'); Q.HSE_PREF = ptz(pref_ind, 1); Q.HSE_ZREF = ptz(pref_ind, 3); qp_H(Q); qp_Se(Q); qp_Sx(Q); qpcls_invchar(Q);