c2--567--1---------2---------3---------4---------5---------6---------712 Subroutine mixratio(p_lvl, r, err, r_pres, err_pres, n, n_pres) c c -- Mixratio/Determines ozone mixing ratio and its estimated c percentage error at prescribed pressure levels/N. Nath c /April '02 c c -- Method: Given p_lvl (pressure at n levels), average ozone c volume mixing ratio (r) at layers in between those levels, & c its estimated percentage error (err), this routine computes c the mixing ratio (r_pres) and estimated percentage error c (err_pres) at prescribed pressure levels via spline c interpolation. The dimension of r_pres and err_pres (n_pres) c must equal n_presc in this routine. c c -- Input & Output Variables: c real p_lvl(n), r(n-1), err(n-1), !input pressure levels (atm), input ! mixing ratio (ppmv), and input mixing ! ratio error (percent) 1 r_pres(n_pres), err_pres(n_pres) ! output mixing ratio (ppmv), and output ! mixing ratio error (percent) integer n, n_pres !number of levels (81 for V8 retrieval), ! & number of prescribed levels at which ! ratio & error are desired c c -- Local Variables: c integer nc parameter (nc = 81) integer n_presc !number of prescribed pressure levels parameter (n_presc = 15) real p_pres(n_presc) !prescribed pressure levels (mbar) data p_pres /0.5, 0.7, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 1 7.0, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0/ real ps !surface pressure (mbar) parameter (ps = 1013.25) real logp(nc-1), logp_pres(n_presc) integer i, j c if (n_pres .ne. n_presc) then write (*, *) 'Error in mixratio.f: n_pres must equal n_presc' stop end if c do i = 1,n-1 logp(i) = log(p_lvl(i)*p_lvl(i+1))/2.0 end do do j = 1,n_pres logp_pres(j) = log(p_pres(j)/ps) end do call spline(logp, r, n-1, logp_pres, r_pres, n_pres, 0.0, 0.0) call spline(logp, err, n-1, logp_pres, err_pres, n_pres, 0.0, 0.0) c return end