SUBROUTINE ld_radlow(wvl, success) c c PROCEDURE NAME: ld_radlow c PROCEDURE TYPE: fortran subroutine c VERSION DATE: 27.VI.97 c c PURPOSE: c Loads the lookup table requred to obtain the radiance from the c putative cloud optical thickness (or vice versa). c c The lookup table is stored in common block /radlowcom/. c c Note that to construct the radiance at a location (for arbitrary Rs), c the formula is c c I = rad(isza_l, iaz, isat, itcl, ipt) + c c Rs * tprm(isat,itcl,ipt) * flxd(isza_l,itcl,ipt) c ---------------------------------------------- c 1 - Rs * sbar(itcl, ipt) c c CALLING PARAMETERS: c Name Type i/o units Description c -------- ---- --- ----- -------------- c wvl I4 i nm reflectivity channel wavelength c success L o Flags successful completion. c c EXTERNAL ROUTINES REQUIRED: c get_lun c unget_lun c c NOTES & CAVEATS: c c REVISION HISTORY: c 19.VII.98 Introduced use of get_lun/unget_lun, rather than static use of lun (eac) c 27.VI.97 Documentation added (eac). c c============================================================================ IMPLICIT NONE INTEGER*4 nsza_p, naz_p, nsat_p, ntcl_p, npt_p PARAMETER(nsza_p=11, naz_p=7, nsat_p=9, ntcl_p=5, npt_p=2) c----------------------------------------------------------------------- c Calling parameters c INTEGER*4 wvl LOGICAL success c----------------------------------------------------------------------- c Common blocks c INTEGER*4 nsza_l, naz_l, nsat_l, ntcl_l, npt_l REAL*8 sza_l(0:nsza_p-1), az_l(0:naz_p-1), sat_l(0:nsat_p-1), & tcl_l(0:ntcl_p-1), pt_l(0:npt_p-1), & rad_l(0:nsza_p-1, 0:naz_p-1, 0:nsat_p-1, 0:ntcl_p-1, 0:npt_p-1), & tprm_l(0:nsat_p-1, 0:ntcl_p-1, 0:npt_p-1), & flxd_l(0:nsza_p-1, 0:ntcl_p-1, 0:npt_p-1), & sbar_l(0:ntcl_p-1, 0:npt_p-1) COMMON /radlowcom/ sza_l, az_l, sat_l, tcl_l, pt_l, & rad_l, flxd_l, tprm_l, sbar_l, & nsza_l, naz_l, nsat_l, ntcl_l, npt_l SAVE /radlowcom/ c----------------------------------------------------------------------- c Local variables c INTEGER*2 nsza_i, naz_i, nsat_i, ntcl_i, npt_i REAL*4 sza_i(0:nsza_p-1), az_i(0:naz_p-1), sat_i(0:nsat_p-1), & tcl_i(0:ntcl_p-1), pt_i(0:npt_p-1), & rad_i(0:nsza_p-1, 0:naz_p-1, 0:nsat_p-1, 0:ntcl_p-1, 0:npt_p-1), & tprm_i(0:nsat_p-1, 0:ntcl_p-1, 0:npt_p-1), & flxd_i(0:nsza_p-1, 0:ntcl_p-1, 0:npt_p-1), & sbar_i(0:ntcl_p-1, 0:npt_p-1) INTEGER*4 lun INTEGER*4 i, isat, isza, itcl, iaz, ipt CHARACTER*13 filename /'radlow000.bin'/ d write(6,*)'> ld_radlow' WRITE(filename(7:9),'(I3.3)') wvl CALL get_lun(lun) OPEN(UNIT=lun,FILE=filename, FORM='unformatted', STATUS='old', $ ERR=900) READ(lun) nsza_i IF (nsza_i .NE. nsza_p) GOTO 901 READ(lun) sza_i READ(lun) naz_i IF (naz_i .NE. naz_p) GOTO 902 READ(lun) az_i READ(lun) nsat_i IF (nsat_i .NE. nsat_p) GOTO 903 READ(lun) sat_i READ(lun) ntcl_i IF (ntcl_i .NE. ntcl_p) GOTO 904 READ(lun) tcl_i READ(lun) npt_i IF (npt_i .NE. npt_p) GOTO 905 READ(lun) pt_i READ(lun) rad_i READ(lun) tprm_i READ(lun) flxd_i READ(lun) sbar_i CLOSE(lun) CALL unget_lun(lun) c c--type conversions c nsza_l= nsza_i DO i= 0, nsza_l-1 sza_l(i)= sza_i(i) END DO naz_l= naz_i DO i= 0, naz_l-1 az_l(i)= az_i(i) END DO nsat_l= nsat_i DO i= 0, nsat_l-1 sat_l(i)= sat_i(i) END DO ntcl_l= ntcl_i DO i= 0, ntcl_l-1 tcl_l(i)= tcl_i(i) END DO npt_l= npt_i DO i= 0, npt_l-1 pt_l(i)= pt_i(i) END DO DO isza=0, nsza_p-1 DO iaz= 0, naz_p-1 DO isat= 0, nsat_p-1 DO itcl= 0, ntcl_p-1 DO ipt= 0, npt_p-1 rad_l(isza, iaz, isat, itcl, ipt)= & rad_i(isza, iaz, isat, itcl, ipt) END DO END DO END DO END DO END DO DO isat= 0, nsat_p-1 DO itcl= 0, ntcl_p-1 DO ipt= 0, npt_p-1 tprm_l(isat, itcl, ipt)= tprm_i(isat, itcl, ipt) END DO END DO END DO DO isza= 0, nsza_p-1 DO itcl= 0, ntcl_p-1 DO ipt= 0, npt_p-1 flxd_l(isza, itcl, ipt)= flxd_i(isza, itcl, ipt) END DO END DO END DO DO itcl= 0, ntcl_p-1 DO ipt= 0, npt_p-1 sbar_l(itcl, ipt)= sbar_i(itcl, ipt) END DO END DO success=.TRUE. d write(6,*)'< ld_radlow' RETURN 900 CONTINUE WRITE(6,90) filename GOTO 999 901 CONTINUE WRITE(6,91) filename, 'sza', nsza_p, nsza_i GOTO 999 902 CONTINUE WRITE(6,91) filename, 'az', naz_p, naz_i GOTO 999 903 CONTINUE WRITE(6,91) filename, 'sat', nsat_p, nsat_i GOTO 999 904 CONTINUE WRITE(6,91) filename, 'tcl', ntcl_p, ntcl_i GOTO 999 905 CONTINUE WRITE(6,91) filename, 'pt', npt_p, npt_i GOTO 999 999 CONTINUE success=.FALSE. RETURN 90 FORMAT(' !!! ld_radlow !!! could not open the file ',A20) 91 FORMAT(' !!! ld_radlow !!! encountered unexpected value in ', & ' file ',A20/ & t20,'Number of values for ',A4,' : expected=',i3,', found=', & i3) END