FUNCTION erythinterp(oz, pr, rs, tcl, p, q) c c PROCEDURE NAME: erythinterp c PROCEDURE TYPE: fortran function c VERSION DATE: 27.VI.97 c c PURPOSE: c Interpolate the erythemal exposure table to obtain the estimated c exposure for the given parameters. c c CALLING PARAMETERS: c Name Type i/o units Description c -------- ---- --- ----- -------------- c erythinterp R8 o arb. Returned value of the function c oz R8 i DU profile ozone c pr R8 i atm terrain surface pressure c rs R8 i frac. surface reflectivity c tcl R8 i putative cloud optical thickness c p R8 i cos(latitude - solar dec. ang) c q R8 i cos(latitude + solar dec. ang) c c EXTERNAL ROUTINES REQUIRED: c lagrangeco calculates order and coefficients for Lagrange c polynomial interpolation. c c NOTES & CAVEATS: c This routine does NO error checking. It is up to the calling program c to check that the calling parameter values are reasonable. c c REVISION HISTORY: c 27.VI.97 Documentation added (eac) c c============================================================================ IMPLICIT NONE c----------------------------------------------------------------------- c Calling parameters c REAL*8 erythinterp, oz, pr, rs, tcl, p, q c----------------------------------------------------------------------- c Common blocks c INCLUDE "eryth.cmn" c----------------------------------------------------------------------- c Local variables c INTEGER*4 oz0, ozdeg, ioz INTEGER*4 pr0, prdeg, ipr INTEGER*4 rs0, rsdeg, irs INTEGER*4 tcl0, tcldeg,itcl INTEGER*4 p0, pdeg, ip INTEGER*4 q0, qdeg, iq INTEGER*4 inrange REAL*8 ozcoef(0:3), prcoef(0:3), rscoef(0:3), tclcoef(0:3) REAL*8 pcoef(0:3), qcoef(0:3) REAL*8 sum, prod REAL*8 logpr INTEGER*4 j c c--EXECUTABLE c logpr= log(pr) d write(6,*)'> erythinterp' d write(6,*)oz, pr, rs, tcl, p, q CALL lagrangeco( oz, eryth_oz, eryth_noz, & oz0, ozdeg, ozcoef, inrange) CALL lagrangeco( logpr, eryth_logpr, eryth_npr, & pr0, prdeg, prcoef, inrange) CALL lagrangeco( rs, eryth_rs, eryth_nrs, & rs0, rsdeg, rscoef, inrange) CALL lagrangeco( tcl, eryth_tc, eryth_ntc, & tcl0, tcldeg, tclcoef, inrange) CALL lagrangeco( p, eryth_p, eryth_np, & p0, pdeg, pcoef, inrange) CALL lagrangeco( q, eryth_q, eryth_nq, & q0, qdeg, qcoef, inrange) sum=0. DO ioz= 0, ozdeg DO ipr= 0, prdeg DO irs= 0, rsdeg DO itcl= 0, tcldeg DO ip= 0, pdeg DO iq= 0, qdeg prod= ozcoef(ioz)*prcoef(ipr)*rscoef(irs)*tclcoef(itcl)* & pcoef(ip)*qcoef(iq) sum= sum + prod*eryth_val(q0+iq, p0+ip, tcl0+itcl, & rs0+irs, pr0+ipr, oz0+ioz) END DO END DO END DO END DO END DO END DO erythinterp= sum RETURN END