370 include
'COMMONS_INC_v2.f'
372 INTEGER LUN_IN, LUN_OUT, LUN_VAP, I_RET
373 COMMON /inout_units/ lun_in, lun_out, lun_vap
377 dimension h(25), t(25), p(25), vmr(25)
378 dimension wavobs(nobs_max),fwhm(nobs_max)
379 dimension tpvmr(7,81)
380 CHARACTER*1 LATHEM, LNGHEM
382 CHARACTER (LEN = 1000) :: FINAV,FOCUB,FOH2O
387 CHARACTER (LEN = 1000) :: FINPWV,FTPVMR
389 CHARACTER (LEN = 1000) :: FOUT1
393 COMMON /getinput1/ ih2ovp,ico2,io3,in2o,ico,ich4,io2,ino2
394 COMMON /getinput3/ h,t,p,vmr,nb,nl,model,iaer,v,taer55,vrto3,sno2
395 COMMON /getinput4/ wavobs,fwhm
396 COMMON /getinput5/ nobs,ifullcalc,hsurf,dlt,dlt2
397 COMMON /getinput6/ wndow1,wndow2,wp94c,wndow3,wndow4,w1p14c
398 COMMON /getinput7/ nb1,nb2,nbp94,nb3,nb4,nb1p14
399 COMMON /getinput8/ imn,idy,iyr,ih,im,is
400 COMMON /getinput9/ xlatd,xlatm,xlats,lathem
401 COMMON /getinput10/xlongd,xlongm,xlongs,lnghem
402 COMMON /getinput11/hdrec,nsamps,nlines,nbands,sorder
403 COMMON /getinput12/scalef
404 COMMON /tpvmr_init1/ tpvmr
405 COMMON /model_adj1/ clmvap,q
407 COMMON /geometry1/ solzni,solaz,obszni,obsphi,iday
409 COMMON /geometry2/ gco2,go3,gn2o,gco,gch4,go2,ssh2o,totlo3,ggeom
410 REAL G_VAP(25), G_OTHER(25)
411 COMMON /geometry3/ g_vap, g_other, g_vap_equiv
412 COMMON /geometry4/vap_slant_mdl
413 REAL MU,MU0,SSH2O_S(NH2O_MAX,2),VMRM_S(25,2)
414 COMMON /geometry5/mu,mu0,ssh2o_s
416 dimension hp(25), tp(25), pp(25), vmrp(25)
417 COMMON /model_adj2/ hp, tp, pp, vmrp
418 COMMON /model_adj3/ k_plane, dvap_plane, dvap_layer, &
419 dp_plane, dp_layer, clmvapp
420 COMMON /model_adj4/ k_surf
423 COMMON /outcube/ focub
424 COMMON /incube/ finav
425 COMMON /outh2ovap/ foh2o
428 CHARACTER (LEN = 80) :: NAME_INSTRU, NAMES(10)
429 COMMON /getinput13/ name_instru,
names
431 dimension tran_o3_std(no3pt)
432 COMMON /init_speccal16/ tran_o3_std
433 dimension tran_no2_std(no3pt)
434 COMMON /init_speccal17/ tran_no2_std
435 dimension o3cf(no3pt)
436 COMMON /o3cf_init1/ o3cf
437 dimension rno2cf(no3pt)
438 COMMON /no2cf_init1/ rno2cf
439 dimension dp(25), pm(25), tm(25), vmrm(25)
440 COMMON /init_speccal5/ dp,pm,tm,vmrm
443 COMMON /getinput14/ xpss, xppp
445 REAL XVIEWD, XVIEWM, XVIEWS
446 REAL XAZMUD, XAZMUM, XAZMUS
447 COMMON /getinput15/ xviewd,xviewm,xviews, xazmud,xazmum,xazmus
461 names(4) =
'TRWIS-III'
463 names(6) =
'Hyperion'
503 h(i) = tpvmr(model,2+(4*(i-1)))
505 p(i) = tpvmr(model,3+(4*(i-1))) / 1013.
506 t(i) = tpvmr(model,4+(4*(i-1)))
508 vmr(i) = tpvmr(model,5+(4*(i-1)))*1.0e-06
567 include
'COMMONS_INC_v2.f'
570 dimension h(25), t(25), p(25), vmr(25)
572 COMMON /getinput3/ h,t,p,vmr,nb,nl,model,iaer,v,taer55,vrto3,sno2
573 COMMON /getinput5/ nobs,ifullcalc,hsurf,dlt,dlt2
574 COMMON /model_adj1/ clmvap,q
576 dimension hp(25), tp(25), pp(25), vmrp(25)
577 COMMON /model_adj2/ hp, tp, pp, vmrp
578 COMMON /model_adj3/ k_plane, dvap_plane, dvap_layer, &
579 dp_plane, dp_layer, clmvapp
580 COMMON /model_adj4/ k_surf
583 COMMON /getinput14/ xpss, xppp
613 7455
IF(hsurf.EQ.h(i)) hsurf=h(i)+0.0001
624 5237
FORMAT(2x,
'***WARNING: Surface elevation smaller then lowest boundary of the model atmosphere.'
635 tsurf=t(k)+(dhs/dhk)*(t(k+1)-t(k))
636 vmrs =vmr(k)+(dhs/dhk)*(vmr(k+1)-vmr(k))
639 psurf=p(k)*exp(-alog(p(k)/p(k+1))*dhs/dhk)
671 damtvt=q*(p(i)-p(i+1))*(vmr(i)+vmr(i+1))/2.0
676 clmvap=amtvrt/3.34e+22
678 WRITE(91,*)
'Column vapor amount in model atmosphere from ground'
679 WRITE(91,*)
' to space = ', clmvap,
' cm'
705 IF(hplane.GE.100.0) hplane = 100. - 0.0001
708 IF(hplane.GT.hp(1))
THEN
713 7456
IF(hplane.EQ.hp(i)) hplane=hp(i)-0.0001
716 CALL locate(hp,nb,hplane,kk)
720 5239
FORMAT(2x,
'***WARNING: Plane altitude less then lowest boundary of the model atmosphere.'
725 dhkk = hp(kk+1) - hp(kk)
726 dhss = hplane - hp(kk)
729 tplane = tp(kk) + (dhss/dhkk)*(tp(kk+1)-tp(kk))
730 vmrsp = vmrp(kk) + (dhss/dhkk)*(vmrp(kk+1)-vmrp(kk))
733 pplane = pp(kk)*exp(-alog(pp(kk)/pp(kk+1))*dhss/dhkk)
757 damtvtp=q*(pp(i)-pp(i+1))*(vmrp(i)+vmrp(i+1))/2.0
758 amtvrtp=amtvrtp+damtvtp
761 clmvapp=amtvrtp/3.34e+22
763 WRITE(91,*)
'Column vapor below plane (CLMVAPP) = ', &
775 dvap_plane = q*(pp(k_plane) - pp(k_plane+1))* &
776 (vmrp(k_plane) + vmrp(k_plane+1))/2.0 / 3.34e+22
778 dvap_layer = q*(p(k_plane) - p(k_plane+1))* &
779 (vmr(k_plane) + vmr(k_plane+1))/2.0 / 3.34e+22
781 dp_plane = pp(k_plane) - pp(k_plane+1)
782 dp_layer = p(k_plane) - p(k_plane+1)
824 include
'COMMONS_INC_v2.f'
826 dimension vapvrt(nh2o_max), vap_slant(nh2o_max)
828 dimension ssh2o(nh2o_max)
829 dimension h(25), t(25), p(25), vmr(25)
830 CHARACTER*1 LATHEM,LNGHEM
837 DATA vapvrt/.00, .02, .06, .11, .16, .21, .26, .31, .36, .40,
838 .43, .46, .50, .54, .58, .62, .66, .70, .75, .80,
839 .86, .92, .98, 1.06,1.14, 1.22, 1.3, 1.4, 1.5, 1.6,
840 1.7, 1.8, 1.9, 2.05, 2.2, 2.35, 2.55, 2.75, 2.95, 3.2,
841 3.5, 3.8, 4.1, 4.4, 4.7, 5.0, 5.3, 5.6, 6.0, 6.4,
842 7.0, 7.7, 8.5, 9.4,10.4, 11.6, 13.0, 15.0, 25.0, 50./
844 DATA md/0,31,59,90,120,151,181,212,243,273,304,334/
846 COMMON /getinput3/ h,t,p,vmr,nb,nl,model,iaer,v,taer55,vrto3,sno2
848 COMMON /getinput8/ imn,idy,iyr,ih,im,is
849 COMMON /getinput9/ xlatd,xlatm,xlats,lathem
850 COMMON /getinput10/xlongd,xlongm,xlongs,lnghem
851 COMMON /model_adj1/ clmvap,q
852 COMMON /geometry1/ solzni,solaz,obszni,obsphi,iday
853 COMMON /geometry2/ gco2,go3,gn2o,gco,gch4,go2,ssh2o,totlo3,ggeom
854 COMMON /model_adj3/ k_plane, dvap_plane, dvap_layer, &
855 dp_plane, dp_layer, clmvapp
857 dimension g_vap(25), g_other(25)
858 COMMON /geometry3/ g_vap, g_other, g_vap_equiv
859 COMMON /geometry4/vap_slant_mdl
860 REAL MU,MU0, SSH2O_S(NH2O_MAX,2)
861 COMMON /geometry5/mu,mu0,ssh2o_s
863 COMMON /getinput14/ xpss, xppp
865 REAL XVIEWD, XVIEWM, XVIEWS
866 REAL XAZMUD, XAZMUM, XAZMUS
867 COMMON /getinput15/ xviewd,xviewm,xviews, xazmud,xazmum,xazmus
878 vap_slant(i) = vapvrt(i) * 2.0
885 obszni = obszni / radeg
886 obsphi = obsphi / radeg
888 solzni = solzni/radeg
895 write(91,*)
'GGEOM =',ggeom,
' OBSZNI = ',obszni,
' OBSPHI = ',obsphi
896 'solzni=',solzni,
' degrees :: MU0, MU = ',mu0, mu
900 IF(hplane.LT.27.) go3 = ggeom - 1./cos(obszni)
920 DO i = 1, k_plane - 1
926 DO i = k_plane + 1, 25
927 g_vap(i) = ggeom - 1./cos(obszni)
928 g_other(i) = ggeom - 1./cos(obszni)
933 g_vap(k_plane) = ggeom - 1./cos(obszni) &
934 + dvap_plane/dvap_layer/cos(obszni)
935 g_other(k_plane) = ggeom - 1./cos(obszni) &
936 + dp_plane/dp_layer/cos(obszni)
947 vap_slant_mdl = clmvap/cos(solzni) + clmvapp/cos(obszni)
948 vap_sol = clmvapp*mu0
955 g_vap_equiv = vap_slant_mdl / clmvap
956 write(91,*)
'G_VAP_EQUIV = ', g_vap_equiv, vap_slant_mdl, clmvap
957 write(91,*)
'VAP_SOL,VAP_SEN = ', vap_sol, vap_sen, wtrvpr
960 ssh2o(i) = vap_slant(i) / vap_slant_mdl
961 write(91,*)
'SSH2O(I), I = ', ssh2o(i), i, vap_slant_mdl, wtrvpr
962 if (wtrvpr.gt.0)
THEN
963 ssh2o_s(i,1) = vapvrt(i) / vap_sol
964 ssh2o_s(i,2) = vapvrt(i) / vap_sen
965 write(91,*)
'SSH2O_S(I,1) = ', i,ssh2o_s(i,1), vapvrt(i), vap_sol
966 write(91,*)
'SSH2O_S(I,2) = ', i,ssh2o_s(i,2), vapvrt(i), vap_sen
968 if (isplitp.ne.0)
then
969 write(6,*)
'ATREM: Split paths is not working because WaterVapor is 0'
978 lpyr = iyr - (4 * (iyr/4))
979 IF((lpyr.EQ.0).AND.(iday.GT.59).AND.(imn.NE.2)) iday = iday + 1
1077 include
'COMMONS_INC_v2.f'
1080 dimension h(25), t(25), p(25), vmr(25)
1081 dimension ssh2o(nh2o_max)
1082 dimension wavobs(nobs_max),fwhm(nobs_max)
1083 dimension finst2(100)
1084 dimension sumcf(np_hi)
1088 COMMON /getinput1/ ih2ovp,ico2,io3,in2o,ico,ich4,io2,ino2
1089 COMMON /getinput3/ h,t,p,vmr,nb,nl,model,iaer,v,taer55,vrto3,sno2
1090 COMMON /getinput4/ wavobs,fwhm
1091 COMMON /getinput5/ nobs,ifullcalc,hsurf,dlt,dlt2
1092 COMMON /getinput6/ wndow1,wndow2,wp94c,wndow3,wndow4,w1p14c
1093 COMMON /getinput7/ nb1,nb2,nbp94,nb3,nb4,nb1p14
1094 COMMON /geometry2/ gco2,go3,gn2o,gco,gch4,go2,ssh2o,totlo3,ggeom
1096 COMMON /model_adj1/ clmvap,q
1098 COMMON /init_speccal3/ nh2o
1099 dimension dp(25), pm(25), tm(25), vmrm(25)
1100 COMMON /init_speccal5/ dp,pm,tm,vmrm
1101 COMMON /init_speccal6/ ist1,ied1,ist2,ied2,istp94,iedp94
1102 COMMON /init_speccal7/ ist3,ied3,ist4,ied4,ist1p14,ied1p14
1103 COMMON /init_speccal8/ wt1,wt2,wt3,wt4,ja
1105 COMMON /init_speccal10/ ncv2,ncvhf2,ncvtt2,istrt2,iend2,finst2
1106 COMMON /init_speccal11/ natot,nbtot,nctot,ndtot
1108 REAL,
ALLOCATABLE :: ABSCF_CO2(:,:),ABSCF_O2(:,:),ABSCF_N2O(:,:),ABSCF_CH4(
1110 COMMON /geometry3/ g_vap, g_other, g_vap_equiv
1111 COMMON /geometry4/vap_slant_mdl
1113 dimension o3cf(no3pt)
1114 COMMON /o3cf_init1/ o3cf
1116 dimension tran_o3_std(no3pt)
1117 COMMON /init_speccal16/ tran_o3_std
1119 dimension rno2cf(no3pt)
1120 COMMON /no2cf_init1/ rno2cf
1122 dimension tran_no2_std(no3pt)
1123 COMMON /init_speccal17/ tran_no2_std
1125 COMMON /model_adj4/ k_surf
1126 INTEGER start(2)/1,1/
1127 INTEGER cnt(2)/NP_HI,19/
1128 CHARACTER(len=4096) :: filename
1132 SAVE first,abscf_co2,abscf_o2,abscf_n2o,abscf_ch4,abscf_co
1134 IF (first.eq.1)
THEN
1163 wavln_med(i) = vstart + float(i-1)*dwavln
1174 wavln_std(i) = 0.3 + float(i-1)*dwavln
1188 index_med(i) = ( (10000./wavln_med(i) - 3000.)/dwavno + 1.)
1199 wavln_med_index(i) = 10000. /(float(index_med(i)-1)*dwavno &
1231 ncvhf(i) = ( facdlt * fwhm(i) / dwavln + 1.)
1246 IF(dwvavr.LT.fwhm(i)) dwvavr = fwhm(i)
1254 cons2=dlt2*sqrt(3.1415926/const1)
1256 IF (dlt2 .NE. 0.0)
THEN
1258 DO 585 i=ncvhf2,ncvtt2
1259 finst2(i)=exp(-const1*(float(i-ncvhf2)*dwvavr/dlt2)**2)
1260 sumins=sumins+finst2(i)
1264 finst2(i)=finst2(ncvtt2-i+1)
1265 sumins=sumins+finst2(i)
1268 sumins=sumins*dwvavr
1271 finst2(i)=finst2(i)*dwvavr/sumins
1288 nctot=nchnla+nchnlb+nchnlc
1289 ndtot=nchnla+nchnlb+nchnlc+nchnld
1299 wndow1=wavobs(iwndw1)
1300 wndow2=wavobs(iwndw2)
1303 IF(jj.EQ.0) nb1=nb1+1
1305 IF(kk.EQ.0) nb2=nb2+1
1314 wp94c=wavobs(iwp94c)
1317 IF(ll.EQ.0) nbp94=nbp94+1
1319 istp94=iwp94c-nb3haf
1320 iedp94=iwp94c+nb3haf
1323 wt1=(wndow2-wp94c)/(wndow2-wndow1)
1324 wt2=(wp94c-wndow1)/(wndow2-wndow1)
1329 wndow3=wavobs(iwndw4)
1330 wndow4=wavobs(iwndw5)
1334 IF(jj.EQ.0) nb3=nb3+1
1336 IF(kk.EQ.0) nb4=nb4+1
1347 w1p14c=wavobs(iw1p14c)
1350 IF(ll.EQ.0) nb1p14=nb1p14+1
1352 ist1p14=iw1p14c-nb6haf
1353 ied1p14=iw1p14c+nb6haf
1356 wt3=(wndow4-w1p14c)/(wndow4-wndow3)
1357 wt4=(w1p14c-wndow3)/(wndow4-wndow3)
1360 ALLOCATE ( abscf_co2(np_hi,19) )
1361 ALLOCATE ( abscf_n2o(np_hi,19) )
1362 ALLOCATE ( abscf_co(np_hi,19) )
1363 ALLOCATE ( abscf_ch4(np_hi,19) )
1364 ALLOCATE ( abscf_o2(np_hi,19) )
1366 write(filename(1:dln),
'(a)') datpath(1:dln)
1367 write(filename(dln+1:),
'(a)')
'abscf_gas.nc'
1368 ncid = ncopn(filename,ncnowrit,ircode)
1370 nrhid = ncvid(ncid,
'abscf_co2', ircode)
1371 CALL ncvgt (ncid, nrhid, start, cnt, abscf_co2, ircode)
1372 if (ircode .ne.0)
then
1373 write(*,*)
'Error reading abscf_gas.nc: abscf_co2: rcode=',ircode
1377 nrhid = ncvid(ncid,
'abscf_n2o', ircode)
1378 CALL ncvgt (ncid, nrhid, start, cnt, abscf_n2o, ircode)
1379 if (ircode .ne.0)
then
1380 write(*,*)
'Error reading abscf_gas.nc: abscf_n2o: rcode=',ircode
1384 nrhid = ncvid(ncid,
'abscf_co', ircode)
1385 CALL ncvgt (ncid, nrhid, start, cnt, abscf_co, ircode)
1386 if (ircode .ne.0)
then
1387 write(*,*)
'Error reading abscf_gas.nc: abscf_co: rcode=',ircode
1391 nrhid = ncvid(ncid,
'abscf_ch4', ircode)
1392 CALL ncvgt (ncid, nrhid, start, cnt, abscf_ch4, ircode)
1393 if (ircode .ne.0)
then
1394 write(*,*)
'Error reading abscf_gas.nc: abscf_ch4: rcode=',ircode
1398 nrhid = ncvid(ncid,
'abscf_o2', ircode)
1399 CALL ncvgt (ncid, nrhid, start, cnt, abscf_o2, ircode)
1400 if (ircode .ne.0)
then
1401 write(*,*)
'Error reading abscf_gas.nc: abscf_o2: rcode=',ircode
1405 CALL ncclos(ncid, rcode)
1417 tran_o3_std(i) = exp(-totlo3*o3cf(i))
1427 tran_o3_std(i) = 1.0
1436 vrtno2 = sno2 * vrtno2
1439 totno2 = gno2 * vrtno2
1443 tran_no2_std(i) = exp(-totno2*rno2cf(i))
1465 tran_no2_std(i) = 1.0
1475 pm(i)=(p(i)+p(i+1))/2.0
1476 tm(i)=(t(i)+t(i+1))/2.0
1497 tran_hi_others(:) = 1.0
1511 vmrm(i)=sclco2*355.0*1.0e-06
1515 vmrm(i)= vmrm(i)*g_other(i)
1520 sumcf(:) = sumcf(:) - abscf_co2(:,j)*dp(j-k_surf+1)*vmrm(j-k_surf
1523 tran_hi_others(:) = tran_hi_others(:)*exp(sumcf(:)*q* 28.966 /
1524 6.0225e+23 / 1.0e-06)
1537 vmrm(i)= vmrm(i)*g_other(i)
1543 sumcf(:) = sumcf(:) - abscf_n2o(:,j)*dp(j-k_surf+1)*vmrm(j-k_surf
1546 tran_hi_others(:) = tran_hi_others(:)*exp(sumcf(:)*q* 28.966 /
1547 6.0225e+23 / 1.0e-06)
1564 vmrm(i)= vmrm(i)*g_other(i)
1569 sumcf(:) = sumcf(:) - abscf_co(:,j)*dp(j-k_surf+1)*vmrm(j-k_surf
1571 tran_hi_others(:) = tran_hi_others(:)*exp(sumcf(:)*q* 28.966 /
1572 6.0225e+23 / 1.0e-06)
1601 vmrm(i)=sclch4*1.6*1.0e-06
1602 vmrm(i)= vmrm(i)*g_other(i)
1608 sumcf(:) = sumcf(:) - abscf_ch4(:,j)*dp(j-k_surf+1)*vmrm(j-k_surf
1611 tran_hi_others(:) = tran_hi_others(:)*exp(sumcf(:)*q* 28.966 /
1612 6.0225e+23 / 1.0e-06)
1632 vmrm(i)= vmrm(i)*g_other(i)
1641 sumcf(:) = sumcf(:) - abscf_o2(:,j)*dp(j-k_surf+1)*vmrm(j-k_surf
1644 tran_hi_others(1:9000) = tran_hi_others(1:9000) * exp(sumcf(1:900
1645 6.0225e+23 / 1.0e-06)
1646 tran_hi_others(9001:106600) = tran_hi_others(9001:106600) * exp(sumcf
1647 6.0225e+23 / 1.0e-06)
1648 tran_hi_others(106601:np_hi) = tran_hi_others(106601:np_hi) * exp
1649 6.0225e+23 / 1.0e-06)
1754 include
'COMMONS_INC_v2.f'
1757 dimension dp(25), pm(25), tm(25), vmrm(25)
1758 dimension h(25), t(25), p(25), vmr(25)
1759 dimension wavobs(nobs_max),fwhm(nobs_max)
1760 COMMON /getinput1/ ih2ovp,ico2,io3,in2o,ico,ich4,io2,ino2
1761 COMMON /getinput3/ h,t,p,vmr,nb,nl,model,iaer,v,taer55,vrto3,sno2
1762 COMMON /getinput4/ wavobs,fwhm
1763 COMMON /getinput5/ nobs,ifullcalc,hsurf,dlt,dlt2
1764 COMMON /init_speccal3/ nh2o
1765 COMMON /init_speccal5/ dp,pm,tm,vmrm
1766 COMMON /model_adj1/ clmvap,q
1767 COMMON /model_adj4/ k_surf
1768 COMMON /model_adj3/ k_plane, dvap_plane, dvap_layer, &
1769 dp_plane, dp_layer, clmvapp
1771 dimension ssh2o(nh2o_max)
1772 dimension vaptot(nh2o_max), r0p94(nh2o_max), r1p14(nh2o_max), trntbl
1773 tran_kd(nobs_max,nh2o_max), diff_tran(nobs_max,nh2o_max
1775 COMMON /tran_table1/ sh2o,vaptot,r0p94,r1p14,trntbl,tran_kd, diff_tran
1779 REAL TRAN_HI_SA(NP_HI,2),TRAN_HI_SAP1(NP_HI,2),TRAN_HI_SB(NP_HI,
1781 COMMON /tran_tables/tran_hi_sa,tran_hi_sap1,tran_hi_sb,tran_hi_sbp1
1782 COMMON /tran_table_l2gen/trntbl_s,trntbl_so
1785 REAL MU,MU0,SSH2O_S(NH2O_MAX,2),VMRM_S(25,2)
1786 COMMON /geometry5/mu,mu0,ssh2o_s
1788 COMMON /geometry2/ gco2,go3,gn2o,gco,gch4,go2,ssh2o,totlo3,ggeom
1789 REAL G_VAP(25), G_OTHER(25)
1790 COMMON /geometry3/ g_vap, g_other, g_vap_equiv
1791 COMMON /geometry4/vap_slant_mdl
1795 CHARACTER(len=4096) :: filename
1796 dimension sumcf(np_hi), sumcf_s(np_hi,2)
1797 REAL ABSCF_H2O(NP_HI,19)
1799 REAL,
ALLOCATABLE :: TG(:), TKCDF(:,:,:),DIFFT(:,:),SUM_KD(:),F1(:)
1800 REAL,
ALLOCATABLE :: WAVNO_HI(:)
1801 CHARACTER*31 GNAM, BNAM,LNAM
1803 REAL,
ALLOCATABLE :: TDP(:),TVMRM(:), TRAN_HI(:,:)
1806 INTEGER FIRST/1/,IDOSMOOTH/0/
1808 LOGICAL DOINLINEKD/.TRUE./
1809 SAVE first, abscf_h2o, tg, tkcdf, difft,n_g, wv, idosmooth, doinlinekd
1812 ALLOCATE( tran_hi(np_hi,nh2o_max) )
1813 ALLOCATE( wavno_hi(np_hi) )
1815 if (first.eq.1)
then
1817 if (ifullcalc.eq.1)
then
1818 print*,
'ATREM: **WARNING** Full_calc is on. Processing will be extremely slow...'
1820 print*,
'ATREM: Full_calc is off. Processing using k-distribution method...'
1823 idosmooth = ico2 + in2o + ico + ich4 + io2 + io3 + ino2
1825 write(filename(1:dln),
'(a)') datpath(1:dln)
1826 write(filename(dln+1:),
'(a)')
'abscf_gas.nc'
1834 ncid = ncopn(filename,ncnowrit,ircode)
1835 nrhid = ncvid(ncid,
'abscf_h2o', ircode)
1836 CALL ncvgt (ncid, nrhid, start, cnt, abscf_h2o, ircode)
1837 if (ircode .ne.0)
then
1838 write(*,*)
'Error reading abscf_gas.nc: abscf_h2o: rcode='
1842 nrhid = ncvid(ncid,
'waveno', ircode)
1843 CALL ncvgt (ncid, nrhid, start, cnt, wavno_hi, ircode)
1844 if (ircode .ne.0)
then
1845 write(*,*)
'Error reading abscf_gas.nc: waveno: rcode=',ircode
1849 CALL ncclos(ncid, rcode)
1851 if (.not.doinlinekd)
then
1852 write(filename(1:dln),
'(a)') datpath(1:dln)
1853 write(filename(dln+1:),
'(a)')
'hico_atrem_h2o_coef7.nc'
1855 ncid = ncopn(filename,ncnowrit,ircode)
1857 CALL ncinq(ncid,ndims,nvars,natts,irecdim,ircode)
1859 if (ndims.NE.3)
then
1860 write(*,*)
'Error Wrong number of dims in file'//
trim(filename
1861 'Expected 4, but got ',ndims
1865 CALL ncdinq(ncid, 1, gnam, n_g, ircode)
1867 CALL ncdinq(ncid, 2, bnam, n_b, ircode)
1869 CALL ncdinq(ncid, 3, lnam, n_l, ircode)
1873 if (n_b.NE.nobs)
then
1874 write(*,*)
' Bands expected (',nobs,
') do not match number of bands in file'
1875 '(',n_b,
') for file='//filename
1891 ALLOCATE( tkcdf(n_l,n_b,n_g) )
1895 ALLOCATE( sum_kd(n_b))
1897 ALLOCATE( tvmrm(n_l) )
1898 ALLOCATE( tdp(n_l) )
1900 if (doinlinekd)
then
1901 tg(1:7) = (/ 0.0, 0.379, 0.5106, 0.81, 0.9548, 0.9933, 1.
1911 nrhid = ncvid(ncid,
'g', ircode)
1912 CALL ncvgt (ncid, nrhid, start, cnt, tg, ircode)
1913 if (ircode .ne.0)
then
1914 write(*,*)
'Error reading '//filename//
': rcode=',ircode
1925 nrhid = ncvid(ncid,
'k_h2o', ircode)
1926 CALL ncvgt (ncid, nrhid, start, cnt, tkcdf, ircode)
1927 if (ircode .ne.0)
then
1928 write(*,*)
'Error reading '//filename//
': rcode=',ircode
1955 vmrm(i) = (vmr(i)+vmr(i+1))/2.0
1959 if (isplitp.ne.0)
then
1960 vmrm_s(i,1) = vmrm(i)*mu0
1961 if (i.lt.k_plane)
THEN
1962 vmrm_s(i,2) = vmrm(i)*mu
1964 if (i.eq.k_plane)
THEN
1965 vmrm_s(i,2) = vmrm(i)*mu*dvap_plane/dvap_layer
1970 WRITE(91,*) i,
' VMRM SOL, OBS=',vmrm_s(i,1),vmrm_s(i,2)
1972 vmrm(i) = vmrm(i)*g_vap(i)
1973 WRITE(91,*)
'VMRM=',vmrm(i)
1976 if (ifullcalc.ne.0.or.first.eq.1)
then
1981 IF (isplitp.NE.0)
THEN
1986 sumcf(:) = sumcf(:) - abscf_h2o(:,j)*dp(j-k_surf+1)*vmrm
1987 IF (isplitp.NE.0)
THEN
1988 sumcf_s(:,1) = sumcf_s(:,1) - abscf_h2o(:,j)*dp(j-k_surf
1989 sumcf_s(:,2) = sumcf_s(:,2) - abscf_h2o(:,j)*dp(j-k_surf
2003 tran_hi(:,i) = exp(sumcf(:)*ssh2o(i) * q * 28.966 / &
2004 6.0225e+23 / 1.0e-06)
2006 vaptot(i)= vap_slant_mdl * ssh2o(i)
2014 if (isplitp.ne.0)
then
2020 tran_hi_sa(:,j) = exp(sumcf_s(:,j) *ssh2o_s(ja_l2,j
2021 6.0225e+23 / 1.0e-06)
2022 tran_hi_sap1(:,j) = exp(sumcf_s(:,j)*ssh2o_s(ja_l2+1
2023 6.0225e+23 / 1.0e-06)
2025 tran_hi_sb(:,j) = exp(sumcf_s(:,j) *ssh2o_s(jb_l2,j
2026 6.0225e+23 / 1.0e-06)
2027 tran_hi_sbp1(:,j) = exp(sumcf_s(:,j)*ssh2o_s(jb_l2+1
2028 6.0225e+23 / 1.0e-06)
2043 if (ifullcalc.eq.0)
then
2047 if (first.eq.1.AND.doinlinekd)
then
2048 ALLOCATE( tkcdfc(n_l,n_b,n_g) )
2049 write(6,*)
'Calling F kdist'
2050 call kdist_gas_abs(tkcdfc,abscf_h2o,np_hi,wavno_hi,wavobs,n_b
2063 f1(:) = exp(-tkcdf(j,:,1) *dp(j-k_surf+1)*vmrm(j-k_surf
2066 f2(:) = exp(-tkcdf(j,:,k+1)*dp(j-k_surf+1)*vmrm(j-k_surf
2067 sum_kd(:) = sum_kd(:)+(f1(:) + f2(:))*(tg(k+1) - tg(k
2071 tran_kd(:,i) = tran_kd(:,i)*sum_kd(:)
2076 vaptot(i)= vap_slant_mdl * ssh2o(i)
2081 if (ifullcalc.ne.0.or.first.eq.1)
then
2089 if (first.eq.1)
then
2091 trh2(:,i) = trntbl(:,i)
2101 trntbl_so(:,:) = 1.0
2103 IF (idosmooth.GT.0)
THEN
2107 if (ifullcalc.eq.0)
then
2109 if (first.eq.1)
then
2111 print*,k,
" FAST)TRNTBL=",tran_kd(k,60)*diff_tran(k,1
2115 trntbl(:,i) = tran_kd(:,i)*diff_tran(:,i)*trntblo(:)
2117 if (first.eq.1)
then
2119 write(6,*)
'RJH: DIFF_TRAN: ',i,j,trntbl(j,i),trntblo
2125 if (first.eq.1)
then
2127 print*,k,
" SLOW)TRNTBL=",trntbl(k,60),trntblo(k)
2132 trntbl(:,i) = trntbl(:,i)*trntblo(:)
2135 trntbl_s(:,:) = trntbl_s(:,:)*trntbl_so(:,:)
2144 DEALLOCATE(tran_hi,wavno_hi)
2148 subroutine linterp(x,y,n,xi,yi)
2149 real*4 x(n),y(n),xi,yi
2155 do while (khi-klo.gt.1)
2164 if (khi.eq.klo)
then
2171 yi = y(khi) + (xi-x(khi))/(x(khi)-x(klo))*(y(khi)-y(klo))
2173 yi = y(klo) + (xi-x(klo))/(x(khi)-x(klo))*(y(khi)-y(klo))
2178 SUBROUTINE kdist_gas_abs(kcdf,abscf,np_hi,waveno,wavobs,nwave)
2183 real*4 :: abscf(np_hi,19),waveno(np_hi),wavobs(nwave),kcdf(19,nwave
2184 real*4 alayers(np_hi,19)
2185 REAL,
ALLOCATABLE :: diflam(:),UV_lam(:),IR_lam(:),uv_dlam(:),ir_dlam(
2188 INTEGER,
ALLOCATABLE :: wavel_window(:,:)
2190 real*4 g7(7)/ 0, 0.379, 0.6, 0.81, 0.9548, 0.9933,
2195 data q/2.15199993e+25/
2199 alayers(:,i) = abscf(:,i)*q*28.966/ &
2200 6.0225e+23 / 1.0e-06
2205 ALLOCATE( diflam(nwave) )
2211 diflam(i) = wavobs(i+1) - wavobs(i)
2212 if (dlam.gt.diflam(i)) dlam = diflam(i)
2213 if (wmin.gt.wavobs(i)) wmin = wavobs(i)
2214 if (wmax.lt.wavobs(i)) wmax = wavobs(i)
2217 diflam(nwave) = diflam(nwave-1)
2219 if (wmin.gt.wavobs(nwave)) wmin = wavobs(nwave)
2220 if (wmax.lt.wavobs(nwave)) wmax = wavobs(nwave)
2222 ndxwuv = (wmin-0.0001 - 0.3)/dlam + 1
2223 ndxwir = (3.1- (wmax+0.0001))/diflam(nwave) + 1
2224 ndxtot = nwave+ndxwuv+ndxwir
2226 ALLOCATE( uv_lam(ndxwuv) )
2227 ALLOCATE( ir_lam(ndxwir) )
2228 ALLOCATE( uv_dlam(ndxwuv) )
2229 ALLOCATE( ir_dlam(ndxwir) )
2230 ALLOCATE( lam(ndxtot) )
2231 ALLOCATE( dwave(ndxtot) )
2232 ALLOCATE( dwn(ndxtot) )
2233 ALLOCATE( wn(ndxtot) )
2234 ALLOCATE( wavel_window(ndxtot,2) )
2241 uv_dlam(i) = diflam(1)
2244 dwn(k) = 10000.*dlam/(lam(k)**2)
2245 wn(k) = 10000./lam(k)
2252 dwn(k) = 10000.*diflam(i)/(lam(k)**2)
2253 wn(k) = 10000./lam(k)
2254 swav = swav + diflam(i)
2262 ir_dlam(i) = diflam(nwave)
2263 swav = swav + diflam(nwave)
2265 dwn(k) = 10000.*diflam(nwave)/(lam(k)**2)
2266 wn(k) = 10000./lam(k)
2270 ALLOCATE( kint(ndxtot,7) )
2271 ALLOCATE( k7(19,ndxtot,7) )
2275 do i=ndxwir+1,ndxtot-ndxwuv
2281 if (kwavdn.lt.0.and.waveno(k).gt.(wn(i)-dwn(i)/2.0)) kwavdn =
2282 if (kwavup.lt.0.and.waveno(k).gt.(wn(i)+dwn(i)/2.0)) kwavup =
2285 wavel_window(i,1) = kwavdn
2286 wavel_window(i,2) = kwavup
2288 if (kwavup.lt.1.or.kwavdn.lt.1)
then
2291 nsamp = kwavup - kwavdn + 1
2295 ALLOCATE( g_i(nbins+1) )
2296 ALLOCATE( k_i(nbins+1) )
2297 ALLOCATE( kk(nsamp+1) )
2300 if (kwavdn.lt.1.or.kwavup.lt.1)
then
2303 kk(1:nsamp) = alayers(kwavdn:kwavup,k)
2307 call ecdf(k_i,g_i,binnum(k),kk,nsamp)
2309 ALLOCATE( logk(nbins+1) )
2310 logk(:) = log10(k_i(:))
2315 call linterp(g_i,logk,binnum(k),g7(l),kint(i,l))
2316 k7(k,i,l) = 10**kint(i,l)
2318 if (i.gt.ndxwir.and.i.le.ndxtot-ndxwuv)
then
2319 if (isnan(k7(k,i,l)))
then
2322 kcdf(k,iw,l) = k7(k,i,l)
2329 DEALLOCATE (g_i, stat=ialloerr)
2333 if (i.gt.ndxwir.and.i.le.ndxtot-ndxwuv) iw = iw - 1
2338 DEALLOCATE( uv_lam )
2339 DEALLOCATE( ir_lam )
2340 DEALLOCATE( uv_dlam )
2341 DEALLOCATE( ir_dlam )
2346 DEALLOCATE( wavel_window )
2373 include
'COMMONS_INC_v2.f'
2375 REAL :: TRAN_HI(NP_HI,NH2O_MAX)
2376 dimension wavobs(nobs_max),fwhm(nobs_max)
2377 COMMON /getinput4/ wavobs,fwhm
2379 dimension vaptot(nh2o_max), r0p94(nh2o_max), r1p14(nh2o_max), trntbl
2380 tran_kd(nobs_max,nh2o_max), diff_tran(nobs_max,nh2o_max
2381 COMMON /tran_table1/ sh2o,vaptot,r0p94,r1p14,trntbl,tran_kd, diff_tran
2383 dimension tran_ia(nh2o_max),tran_iap1(nh2o_max)
2385 COMMON /getinput5/ nobs,ifullcalc,hsurf,dlt,dlt2
2386 REAL,
ALLOCATABLE :: TRAN_STD(:,:),TRAN_MED(:,:)
2388 REAL TRAN_HI_SA(NP_HI,2),TRAN_HI_SAP1(NP_HI,2),TRAN_HI_SB(NP_HI,
2390 COMMON /tran_tables/tran_hi_sa,tran_hi_sap1,tran_hi_sb,tran_hi_sbp1
2391 COMMON /tran_table_l2gen/trntbl_s,trntbl_so
2392 REAL TRAN_MED_INDEX_SA(NP_MED,2),TRAN_MED_INDEX_SB(NP_MED,2), &
2393 tran_med_index_sap1(np_med,2),tran_med_index_sbp1(np_med,2
2394 tran_med_sa(np_med,2),tran_med_sap1(np_med,2),tran_med_sb(np_med
2395 tran_std_sa(np_std,2),tran_std_sap1(np_std,2),tran_std_sb(np_std
2396 tran_ia_sa(2),tran_ia_sap1(2),tran_ia_sb(2),tran_ia_sbp1(2
2397 tran_iap1_sa(2),tran_iap1_sap1(2),tran_iap1_sb(2),tran_iap1_sbp1
2398 trntblsa(2),trntblsap1(2),trntblsb(2),trntblsbp1(2)
2399 COMMON /tran_tables1/tran_med_index_sa,tran_med_index_sap1,tran_med_index_sb
2400 tran_med_sa,tran_med_sap1,tran_med_sb,tran_med_sbp1, &
2401 tran_std_sa,tran_std_sap1,tran_std_sb,tran_std_sbp1
2403 INTEGER FIRST/1/,IA(NOBS_MAX)
2404 REAL FINSTR_WAVNO(5000,NP_MED), FWHM_WAVNO(NP_MED)
2405 INTEGER NCVHF_WAVNO(NP_MED)
2407 SAVE first, ia, finstr_wavno, fwhm_wavno, ncvhf_wavno
2427 IF (first.eq.1)
THEN
2429 fwhm_wavno(j) = 10000.*dlt_med &
2430 /(wavln_med_index(j)*wavln_med_index(j))
2432 ncvhf_wavno(j) = ( facdlt * fwhm_wavno(j) / dwavno + 1.)
2434 ncvtot_wavno = 2 * ncvhf_wavno(j) - 1
2442 DO 560 i = ncvhf_wavno(j), ncvtot_wavno
2443 finstr_wavno(i,j) = &
2444 exp( -const1*(float(i-ncvhf_wavno(j))*dwavno &
2446 sumins = sumins + finstr_wavno(i,j)
2450 DO 565 i = 1, ncvhf_wavno(j)-1
2451 finstr_wavno(i,j) = finstr_wavno(ncvtot_wavno-i+1,j)
2452 sumins = sumins + finstr_wavno(i,j)
2457 sumins = sumins * dwavno
2459 DO 570 i = 1, ncvtot_wavno
2460 finstr_wavno(i,j) = finstr_wavno(i,j)*dwavno/sumins
2475 ncvtot = 2 * ncvhf(j) - 1
2477 DO 1560 i = ncvhf(j), ncvtot
2479 exp( -const1*(float(i-ncvhf(j))*dwavln/fwhm(j))**2)
2480 sumins = sumins + finstr(i,j)
2486 DO 1565 i = 1, ncvhf(j)-1
2487 finstr(i,j) = finstr(ncvtot-i+1,j)
2488 sumins = sumins + finstr(i,j)
2492 sumins = sumins * dwavln
2494 DO 1570 i = 1, ncvtot
2495 finstr(i,j) = finstr(i,j)*dwavln/sumins
2499 CALL hunt(wavln_std, np_std, wavobs(j), ia(j))
2506 ALLOCATE(tran_std(np_std,nh2o_max))
2507 ALLOCATE(tran_med(np_med,nh2o_max))
2515 tran_med_index(:,:) = 0.0
2516 IF(isplitp.NE.0)
THEN
2517 tran_med_index_sa(:,:) = 0.0
2518 tran_med_index_sap1(:,:) = 0.0
2519 tran_med_index_sb(:,:) = 0.0
2520 tran_med_index_sbp1(:,:) = 0.0
2526 ndx1 = index_med(j)-(ncvhf_wavno(j)-1)
2527 ndx2 = index_med(j)+ ncvhf_wavno(j)-1
2529 DO 491 k = ndx1,ndx2
2530 tran_med_index(j,:) = tran_med_index(j,:) + tran_hi(k,:)*
2531 finstr_wavno(k-index_med(j)+ncvhf_wavno(j),j)
2535 IF(isplitp.NE.0)
THEN
2536 tran_med_index_sa(j,:) = tran_med_index_sa(j,:) + tran_hi_sa
2537 finstr_wavno(k-index_med(j)+ncvhf_wavno(j),j)
2538 tran_med_index_sap1(j,:) = tran_med_index_sap1(j,:) + tran_hi_sap1
2539 finstr_wavno(k-index_med(j)+ncvhf_wavno(j),j)
2540 tran_med_index_sb(j,:) = tran_med_index_sb(j,:) + tran_hi_sb
2541 finstr_wavno(k-index_med(j)+ncvhf_wavno(j),j)
2542 tran_med_index_sbp1(j,:) = tran_med_index_sbp1(j,:) + tran_hi_sbp1
2543 finstr_wavno(k-index_med(j)+ncvhf_wavno(j),j)
2558 tran_med(1,:) = tran_med_index(1,:)
2559 tran_med(np_med,:) = tran_med_index(np_med,:)
2560 IF(isplitp.NE.0)
THEN
2561 tran_med_sa(1,:) = tran_med_index_sa(1,:)
2562 tran_med_sa(np_med,:) = tran_med_index_sa(np_med,:)
2563 tran_med_sap1(1,:) = tran_med_index_sap1(1,:)
2564 tran_med_sap1(np_med,:) = tran_med_index_sap1(np_med,:)
2565 tran_med_sb(1,:) = tran_med_index_sb(1,:)
2566 tran_med_sb(np_med,:) = tran_med_index_sb(np_med,:)
2567 tran_med_sbp1(1,:) = tran_med_index_sbp1(1,:)
2568 tran_med_sbp1(np_med,:) = tran_med_index_sbp1(np_med,:)
2572 IF(wavln_med_index(j).LE.wavln_med(j))
THEN
2573 tran_med(j,:) = tran_med_index(j,:)
2576 IF(isplitp.NE.0)
THEN
2577 tran_med_sa(j,:) = tran_med_index_sa(j,:)
2578 tran_med_sap1(j,:) = tran_med_index_sap1(j,:)
2579 tran_med_sb(j,:) = tran_med_index_sb(j,:)
2580 tran_med_sbp1(j,:) = tran_med_index_sbp1(j,:)
2583 dlt = wavln_med_index(j) - wavln_med_index(j-1)
2584 fjm1 = (wavln_med_index(j) - wavln_med(j)) /dlt
2585 fj = (wavln_med(j) - wavln_med_index(j-1))/dlt
2586 tran_med(j,:) = fjm1*tran_med_index(j-1,:) + fj*tran_med_index
2589 IF(isplitp.NE.0)
THEN
2590 tran_med_sa(j,:) = fjm1*tran_med_index_sa(j-1,:) + fj
2591 tran_med_sap1(j,:) = fjm1*tran_med_index_sap1(j-1,:) + fj
2592 tran_med_sb(j,:) = fjm1*tran_med_index_sb(j-1,:) + fj
2593 tran_med_sbp1(j,:) = fjm1*tran_med_index_sbp1(j-1,:) + fj
2610 DO i = npshif+1, np_std
2611 tran_std(i,:) = tran_std(i,:)*tran_med(i-npshif,:)
2615 IF(isplitp.NE.0)
THEN
2617 tran_std_sa(i,:) = 1.
2618 tran_std_sap1(i,:) = 1.
2619 tran_std_sb(i,:) = 1.
2620 tran_std_sbp1(i,:) = 1.
2622 DO i = npshif+1, np_std
2623 tran_std_sa(i,:) = tran_std_sa(i,:) *tran_med_sa(i-npshif
2624 tran_std_sap1(i,:) = tran_std_sap1(i,:)*tran_med_sap1(i-npshif
2625 tran_std_sb(i,:) = tran_std_sb(i,:) *tran_med_sb(i-npshif
2626 tran_std_sbp1(i,:) = tran_std_sbp1(i,:)*tran_med_sbp1(i-npshif
2649 IF(isplitp.NE.0)
THEN
2652 tran_iap1_sa(:) = 0.0
2653 tran_ia_sap1(:) = 0.0
2654 tran_iap1_sap1(:) = 0.0
2656 tran_iap1_sb(:) = 0.0
2657 tran_ia_sbp1(:) = 0.0
2658 tran_iap1_sbp1(:) = 0.0
2676 DO 1491 k = ia(j)-(ncvhf(j)-1), ia(j)+ncvhf(j)-1
2677 tran_ia(:) = tran_ia(:) + tran_std(k,:)* &
2678 finstr(k-ia(j)+ncvhf(j),j)
2681 IF(isplitp.NE.0)
THEN
2682 tran_ia_sa(:) = tran_ia_sa(:) + tran_std_sa(k,:)*
2683 finstr(k-ia(j)+ncvhf(j),j)
2684 tran_ia_sap1(:) = tran_ia_sap1(:) + tran_std_sap1(k,:)*
2685 finstr(k-ia(j)+ncvhf(j),j)
2686 tran_ia_sb(:) = tran_ia_sb(:) + tran_std_sb(k,:)*
2687 finstr(k-ia(j)+ncvhf(j),j)
2688 tran_ia_sbp1(:) = tran_ia_sbp1(:) + tran_std_sbp1(k,:)*
2689 finstr(k-ia(j)+ncvhf(j),j)
2704 DO 1492 k = ia_p1-(ncvhf(j)-1), ia_p1+ncvhf(j)-1
2705 tran_iap1(:) = tran_iap1(:) + tran_std(k,:)* &
2706 finstr(k-ia_p1+ncvhf(j),j)
2707 IF(isplitp.NE.0)
THEN
2708 tran_iap1_sa(:) = tran_iap1_sa(:) + tran_std_sa(k,:)
2709 finstr(k-ia_p1+ncvhf(j),j)
2710 tran_iap1_sap1(:) = tran_iap1_sap1(:) + tran_std_sap1(k,
2711 finstr(k-ia_p1+ncvhf(j),j)
2712 tran_iap1_sb(:) = tran_iap1_sb(:) + tran_std_sb(k,:)
2713 finstr(k-ia_p1+ncvhf(j),j)
2714 tran_iap1_sbp1(:) = tran_iap1_sbp1(:) + tran_std_sbp1(k,
2715 finstr(k-ia_p1+ncvhf(j),j)
2722 dlt_ia = wavln_std(ia_p1) - wavln_std(ia(j))
2723 fia = (wavln_std(ia_p1) - wavobs(j)) /dlt_ia
2726 trntbl(j,:) = fia*tran_ia(:) + fia_p1*tran_iap1(:)
2731 IF(isplitp.NE.0)
THEN
2732 trntblsa(:) = fia*tran_ia_sa(:) + fia_p1*tran_iap1_sa(:)
2733 trntblsap1(:) = fia*tran_ia_sap1(:) + fia_p1*tran_iap1_sap1(
2734 trntblsb(:) = fia*tran_ia_sb(:) + fia_p1*tran_iap1_sb(:)
2735 trntblsbp1(:) = fia*tran_ia_sbp1(:) + fia_p1*tran_iap1_sbp1(
2736 trntbl_s(j,:) = 0.5*(f1a*trntblsa(:) + f2a*trntblsap1(:) + &
2737 f1b*trntblsb(:) + f2b*trntblsbp1(:) )
2748 IF (ifullcalc.eq.0)
THEN
2751 diff_tran(j,k) = (trntbl(j,k)-tran_kd(j,k))/tran_kd(j,k) +
2753 write(*,*)
'RJH: TRAN2: ',j, k, tran_kd(j,k),trntbl(j,k),diff_tran
2764 DEALLOCATE(tran_std,tran_med)
2794 include
'COMMONS_INC_v2.f'
2796 dimension tran_o3_std(no3pt)
2797 COMMON /init_speccal16/ tran_o3_std
2799 dimension tran_no2_std(no3pt)
2800 COMMON /init_speccal17/ tran_no2_std
2802 dimension wavobs(nobs_max),fwhm(nobs_max)
2803 COMMON /getinput4/ wavobs,fwhm
2805 dimension vaptot(nh2o_max), r0p94(nh2o_max), r1p14(nh2o_max), trntbl
2806 tran_kd(nobs_max,nh2o_max), diff_tran(nobs_max,nh2o_max
2807 COMMON /tran_table1/ sh2o,vaptot,r0p94,r1p14,trntbl,tran_kd, diff_tran
2808 REAL TRAN_HI_SA(NP_HI,2),TRAN_HI_SAP1(NP_HI,2),TRAN_HI_SB(NP_HI,
2810 COMMON /tran_tables/tran_hi_sa,tran_hi_sap1,tran_hi_sb,tran_hi_sbp1
2811 COMMON /tran_table_l2gen/trntbl_s,trntbl_so
2812 REAL MU,MU0, SSH2O_S(NH2O_MAX,2)
2813 COMMON /geometry5/mu,mu0,ssh2o_s
2815 real*4 tran_ia,tran_iap1, tran_std_o(np_std),tran_std_os(np_std,2)
2817 COMMON /getinput5/ nobs,ifullcalc,hsurf,dlt,dlt2
2818 REAL TRAN_MED_O(NP_MED),TRAN_MED_INDEX_O(NP_MED)
2819 REAL TRAN_MED_OS(NP_MED,2),TRAN_MED_INDEX_OS(NP_MED,2)
2820 INTEGER FIRST/1/,IA(NOBS_MAX)
2821 REAL FINSTR_WAVNO(5000,NP_MED), FWHM_WAVNO(NP_MED)
2822 INTEGER NCVHF_WAVNO(NP_MED)
2824 SAVE first, ia, finstr_wavno, fwhm_wavno, ncvhf_wavno
2844 IF (first.eq.1)
THEN
2846 fwhm_wavno(j) = 10000.*dlt_med &
2847 /(wavln_med_index(j)*wavln_med_index(j))
2849 ncvhf_wavno(j) = ( facdlt * fwhm_wavno(j) / dwavno + 1.)
2851 ncvtot_wavno = 2 * ncvhf_wavno(j) - 1
2854 DO 560 i = ncvhf_wavno(j), ncvtot_wavno
2855 finstr_wavno(i,j) = &
2856 exp( -const1*(float(i-ncvhf_wavno(j))*dwavno &
2858 sumins = sumins + finstr_wavno(i,j)
2861 DO 565 i = 1, ncvhf_wavno(j)-1
2862 finstr_wavno(i,j) = finstr_wavno(ncvtot_wavno-i+1,j)
2863 sumins = sumins + finstr_wavno(i,j)
2866 sumins = sumins * dwavno
2868 DO 570 i = 1, ncvtot_wavno
2869 finstr_wavno(i,j) = finstr_wavno(i,j)*dwavno/sumins
2886 ncvtot = 2 * ncvhf(j) - 1
2888 DO 1560 i = ncvhf(j), ncvtot
2890 exp( -const1*(float(i-ncvhf(j))*dwavln &
2892 sumins = sumins + finstr(i,j)
2895 DO 1565 i = 1, ncvhf(j)-1
2896 finstr(i,j) = finstr(ncvtot-i+1,j)
2897 sumins = sumins + finstr(i,j)
2900 sumins = sumins * dwavln
2902 DO 1570 i = 1, ncvtot
2903 finstr(i,j) = finstr(i,j)*dwavln/sumins
2908 CALL hunt(wavln_std, np_std, wavobs(j), ia(j))
2913 airmass = 1.0/mu0 + 1.0/mu
2918 tran_med_index_o(:) = 0.0
2919 IF(isplitp.NE.0) tran_med_index_os(:,:) = 0.0
2927 ndx1 = index_med(j)-(ncvhf_wavno(j)-1)
2928 ndx2 = index_med(j)+ ncvhf_wavno(j)-1
2930 DO 491 k = ndx1,ndx2
2931 tran_med_index_o(j) = tran_med_index_o(j) + tran_hi_others(k
2932 finstr_wavno(k-index_med(j)+ncvhf_wavno(j),j)
2937 IF(isplitp.NE.0)
THEN
2938 airm = -log(tran_hi_others(k))/airmass
2939 tran_hi_others_sol = exp(-airm/mu0)
2940 tran_hi_others_sen = exp(-airm/mu)
2942 tran_med_index_os(j,1) = tran_med_index_os(j,1) + tran_hi_others_sol
2943 finstr_wavno(k-index_med(j)+ncvhf_wavno(j),j)
2944 tran_med_index_os(j,2) = tran_med_index_os(j,2) + tran_hi_others_sen
2945 finstr_wavno(k-index_med(j)+ncvhf_wavno(j),j)
2956 tran_med_o(1) = tran_med_index_o(1)
2957 tran_med_o(np_med) = tran_med_index_o(np_med)
2958 IF(isplitp.NE.0)
THEN
2959 tran_med_os(1,:) = tran_med_index_os(1,:)
2960 tran_med_os(np_med,:) = tran_med_index_os(np_med,:)
2964 IF(wavln_med_index(j).LE.wavln_med(j))
THEN
2965 tran_med_o(j) = tran_med_index_o(j)
2966 IF(isplitp.NE.0) tran_med_os(j,:) = tran_med_index_os(j,:)
2968 dlt = wavln_med_index(j) - wavln_med_index(j-1)
2969 fjm1 = (wavln_med_index(j) - wavln_med(j)) /dlt
2970 fj = (wavln_med(j) - wavln_med_index(j-1))/dlt
2971 tran_med_o(j) = fjm1*tran_med_index_o(j-1) + fj*tran_med_index_o
2974 tran_med_os(j,:) = fjm1*tran_med_index_os(j-1,:) + fj*tran_med_index_os
2983 IF(isplitp.NE.0) tran_std_os(:,:) = 1.
2985 tran_std_o(1:no3pt) = tran_o3_std(1:no3pt) * tran_no2_std(1:no3pt
2986 IF(isplitp.NE.0)
THEN
2987 am(1:no3pt) = -log(tran_std_o(1:no3pt))/airmass
2988 tran_std_os(1:no3pt,1) = exp(-am(1:no3pt)/mu0)
2989 tran_std_os(1:no3pt,2) = exp(-am(1:no3pt)/mu)
2992 tran_std_o(npshif+1:np_std) = tran_std_o(npshif+1:np_std)*tran_med_o
2993 IF(isplitp.NE.0)
THEN
2994 tran_std_os(npshif+1:np_std,:) = tran_std_os(npshif+1:np_std,
3017 DO 1491 k = ia(j)-(ncvhf(j)-1), ia(j)+ncvhf(j)-1
3018 tran_ia = tran_ia + tran_std_o(k)* &
3019 finstr(k-ia(j)+ncvhf(j),j)
3021 IF(isplitp.NE.0)
THEN
3022 tran_ias(:) = tran_ias(:) + tran_std_os(k,:)* &
3023 finstr(k-ia(j)+ncvhf(j),j)
3034 DO 1492 k = ia_p1-(ncvhf(j)-1), ia_p1+ncvhf(j)-1
3035 tran_iap1 = tran_iap1 + tran_std_o(k)* &
3036 finstr(k-ia_p1+ncvhf(j),j)
3038 tran_iap1s(:) = tran_iap1s(:) + tran_std_os(k,:)* &
3039 finstr(k-ia_p1+ncvhf(j),j)
3044 dlt_ia = wavln_std(ia_p1) - wavln_std(ia(j))
3045 fia = (wavln_std(ia_p1) - wavobs(j)) /dlt_ia
3048 trntblo(j) = fia*tran_ia + fia_p1*tran_iap1
3051 IF(isplitp.NE.0)
THEN
3052 trntbl_so(j,:) = fia*tran_ias(:) + fia_p1*tran_iap1s(:)
3103 dimension const1(nh2o_max),const2(nh2o_max),const3(nh2o_max)
3104 dimension const4(nh2o_max),const5(nh2o_max),const6(nh2o_max)
3106 COMMON /getinput7/ nb1,nb2,nbp94,nb3,nb4,nb1p14
3107 COMMON /init_speccal6/ ist1,ied1,ist2,ied2,istp94,iedp94
3108 COMMON /init_speccal7/ ist3,ied3,ist4,ied4,ist1p14,ied1p14
3109 COMMON /init_speccal8/ wt1,wt2,wt3,wt4,ja
3110 dimension vaptot(nh2o_max), r0p94(nh2o_max), r1p14(nh2o_max),trntbl
3111 tran_kd(nobs_max,nh2o_max), diff_tran(nobs_max,nh2o_max
3112 COMMON /tran_table1/ sh2o,vaptot,r0p94,r1p14,trntbl, tran_kd, diff_tran
3117 const1(:)=const1(:)+trntbl(i,:)
3119 const1(:)=const1(:)/float(nb1)
3122 const2(:)=const2(:)+trntbl(i,:)
3124 const2(:)=const2(:)/float(nb2)
3127 DO 575 i=istp94,iedp94
3128 const3(:)=const3(:)+trntbl(i,:)
3130 const3(:)=const3(:)/float(nbp94)
3132 r0p94(:)=const3(:)/((wt1*const1(:)) + (wt2*const2(:)))
3136 const4(:)=const4(:)+trntbl(i,:)
3138 const4(:)=const4(:)/float(nb3)
3142 const5(:)=const5(:)+trntbl(i,:)
3144 const5(:)=const5(:)/float(nb4)
3147 DO 595 i=ist1p14,ied1p14
3148 const6(:)=const6(:)+trntbl(i,:)
3150 const6(:)=const6(:)/float(nb1p14)
3152 r1p14(:)=const6(:)/((wt3*const4(:)) + (wt4*const5(:)))
3174 SUBROUTINE locate(xx,n,x,j)
3180 10
if(ju-jl.gt.1)
then
3182 if((xx(n).ge.xx(1)).eqv.(x.ge.xx(jm)))
then
3191 else if(x.eq.xx(n))
then
3216 SUBROUTINE cubspln(N,XORGN,YORGN,XINT,YINT)
3219 dimension xorgn(1050),yorgn(1050),y2(1050)
3220 dimension xint(nobs_max),yint(nobs_max)
3223 COMMON /getinput5/ nobs,ifullcalc,hsurf,dlt,dlt2
3232 CALL spline(xorgn,yorgn,n,yp1,ypn,y2)
3236 CALL splint(xorgn,yorgn,y2,n,x,y)
3272 subroutine spline(x,y,n,yp1,ypn,y2)
3275 real x(n),y(n),y2(n),u(nmax)
3276 real yp1,ypn,sig,p,qn,un
3277 if (yp1.gt..99e30)
then
3282 u(1)=(3./(x(2)-x(1)))*((y(2)-y(1))/(x(2)-x(1))-yp1)
3285 sig=(x(i)-x(i-1))/(x(i+1)-x(i-1))
3288 u(i)=(6.*((y(i+1)-y(i))/(x(i+1)-x(i))-(y(i)-y(i-1)) &
3289 /(x(i)-x(i-1)))/(x(i+1)-x(i-1))-sig*u(i-1))/p
3291 if (ypn.gt..99e30)
then
3296 un=(3./(x(n)-x(n-1)))*(ypn-(y(n)-y(n-1))/(x(n)-x(n-1)))
3298 y2(n)=(un-qn*u(n-1))/(qn*y2(n-1)+1.)
3300 y2(k)=y2(k)*y2(k+1)+u(k)
3331 subroutine splint(xa,ya,y2a,n,x,y)
3333 real xa(n),ya(n),y2a(n)
3337 1
if (khi-klo.gt.1)
then
3347 if (h.eq.0.) stop
'bad xa input.'
3350 y=a*ya(klo)+b*ya(khi)+ &
3351 ((a**3-a)*y2a(klo)+(b**3-b)*y2a(khi))*(h**2)/6.
3372 SUBROUTINE hunt(xx,n,x,jlo)
3377 ascnd=xx(n).ge.xx(1)
3378 if(jlo.le.0.or.jlo.gt.n)
then
3384 if(x.ge.xx(jlo).eqv.ascnd)
then
3388 else if(x.ge.xx(jhi).eqv.ascnd)
then
3398 else if(x.lt.xx(jlo).eqv.ascnd)
then
3404 3
if(jhi-jlo.eq.1)
then
3405 if(x.eq.xx(n))jlo=n-1
3410 if(x.ge.xx(jm).eqv.ascnd)
then
3436 INTEGER FUNCTION findmatch(LIST,NOBS,ELEM)
3438 dimension
list(nobs_max)
3443 IF(list(i).GT.elem)
GOTO 470
3446 diff1=
abs(list(i-1)-elem)
3447 diff2=
abs(list(i)-elem)
3448 IF (diff1.LT.diff2)
THEN