From 74e1509e1b41320a364de64f76e3b84c0e5fb4df Mon Sep 17 00:00:00 2001 From: Alice Bertini Date: Tue, 24 Jan 2017 14:46:04 -0700 Subject: [PATCH] updates for CAM-Chem from Simone --- atm_diag/tables_chem.ncl | 100 +++++++++++++++++++++++++++------------ atm_diag/tables_soa.ncl | 42 ++++++++++++++-- 2 files changed, 108 insertions(+), 34 deletions(-) diff --git a/atm_diag/tables_chem.ncl b/atm_diag/tables_chem.ncl index 4377f945..f20ba1b2 100644 --- a/atm_diag/tables_chem.ncl +++ b/atm_diag/tables_chem.ncl @@ -94,8 +94,8 @@ ntime1 = dimsizes(time1) end if aerod1 = new((/ntime1,nlat1,nlon1/),"float") - if (isfilevar(inptr1, "AEROD_v")) - aerod1 = inptr1->AEROD_v + if (isfilevar(inptr1, "AODVIS")) + aerod1 = inptr1->AODVIS else aerod1 = 0. end if @@ -110,7 +110,7 @@ ntime1 = dimsizes(time1) delete(dst3) delete(dst4) delete(dst1) -delete(dst2) + delete(dst2) end if if (isfilevar(inptr1, "AODDUST1").and.isfilevar(inptr1, "AODDUST2").and.isfilevar(inptr1, "AODDUST3")) dst1 = inptr1->AODDUST1 @@ -119,8 +119,27 @@ delete(dst2) dst11 = dst1+dst2+dst3 delete(dst1) delete(dst2) -delete(dst3) + delete(dst3) + else + if (isfilevar(inptr1, "AODDUST")) + dst1 = inptr1->AODDUST + dst11 = dst1 + delete(dst1) + end if end if + dlon1=360./nlon1 + coffa=pi*re^2./180. + area1 = aerod1 + area1 = 1. + area1 = area1 + aerod1*0. + do ii=0,dimsizes(gw1)-1 + aerod1(:,ii,:)=aerod1(:,ii,:)*coffa*dlon1*gw1(ii) + dst11(:,ii,:)=dst11(:,ii,:)*coffa*dlon1*gw1(ii) + area1(:,ii,:)=area1(:,ii,:)*coffa*dlon1*gw1(ii) + end do + taerod1 = sum(aerod1)/sum(area1) + tdst11 = sum(dst11)/sum(area1) + delete(area1) ps1 = inptr1->PS if (isfilevar(inptr1,"O3")) then @@ -189,8 +208,8 @@ ntime2 = dimsizes(time2) cochm2 = 0. end if aerod2 = new((/ntime2,nlat2,nlon2/),"float") - if (isfilevar(inptr2, "AEROD_v")) - aerod2 = inptr2->AEROD_v + if (isfilevar(inptr2, "AODVIS")) + aerod2 = inptr2->AODVIS else aerod2 = 0. end if @@ -215,8 +234,28 @@ delete(dst4) dst22 = dst1+dst2+dst3 delete(dst1) delete(dst2) -delete(dst3) + delete(dst3) + else + if (isfilevar(inptr2, "AODDUST")) + dst1 = inptr2->AODDUST + dst22 = dst1 + delete(dst1) + end if end if + dlon2=360./nlon2 + coffa=pi*re^2./180. + area2 = aerod2 + area2 = 1. + area2 = area2 + aerod2*0. + do ii=0,dimsizes(gw2)-1 + aerod2(:,ii,:)=aerod2(:,ii,:)*coffa*dlon2*gw2(ii) + dst22(:,ii,:)=dst22(:,ii,:)*coffa*dlon2*gw2(ii) + area2(:,ii,:)=area2(:,ii,:)*coffa*dlon2*gw2(ii) + end do + taerod2 = sum(aerod2)/sum(area2) + tdst22 = sum(dst22)/sum(area2) + delete(area2) + ps2 = inptr2->PS if (isfilevar(inptr2,"O3")) then @@ -277,21 +316,21 @@ p21 = pres_hybrid_ccm(ps2,p0,ha21,hb21) vint1 = new((/ntime1,nlev1,nlat1,nlon1/),"float") vint1(:,:,:,:) = 0. end if - if (isfilevar(inptr1,vchml)) then - chml1=inptr1->$vchml$ + if (isfilevar(inptr1,vchmll)) then + chml1=inptr1->$vchmll$ else - if (isfilevar(inptr1,vchmll)) then - chml1=inptr1->$vchmll$ + if (isfilevar(inptr1,vchml)) then + chml1=inptr1->$vchml$ else chml1 = new((/ntime1,nlev1,nlat1,nlon1/),"float") chml1(:,:,:,:) = 0. end if end if - if (isfilevar(inptr1,vchmp)) then - chmp1=inptr1->$vchmp$ + if (isfilevar(inptr1,vchmpp)) then + chmp1=inptr1->$vchmpp$ else - if (isfilevar(inptr1,vchmpp)) then - chmp1=inptr1->$vchmpp$ + if (isfilevar(inptr1,vchmp)) then + chmp1=inptr1->$vchmp$ else chmp1 = new((/ntime1,nlev1,nlat1,nlon1/),"float") chmp1(:,:,:,:) = 0. @@ -375,8 +414,6 @@ p21 = pres_hybrid_ccm(ps2,p0,ha21,hb21) tbchml1 = sum(bchml1)*86400.*365.*factor(i) temis1 = sum(emis1)*86400.*365.*1e-9*factor(i) tdf1 = sum(df1)*86400.*365.*1e-9*factor(i) - taerod1 = dim_avg_n(aerod1,(/1,2/)) - tdst11 = dim_avg_n(dst11,(/1,2/)) if vars(i).eq."O3" then if (isfilevar(inptr1,"O3")) then do ii=0,ddd1(2)-1 @@ -413,22 +450,22 @@ p21 = pres_hybrid_ccm(ps2,p0,ha21,hb21) vint2 = new((/ntime2,nlev2,nlat2,nlon2/),"float") vint2(:,:,:,:) = 0. end if - if (isfilevar(inptr2,vchml)) then - chml2=inptr2->$vchml$ + if (isfilevar(inptr2,vchmll)) then + chml2=inptr2->$vchmll$ else - if (isfilevar(inptr2,vchmll)) then - chml2=inptr2->$vchmll$ + if (isfilevar(inptr2,vchml)) then + chml2=inptr2->$vchml$ else chml2 = new((/ntime2,nlev2,nlat2,nlon2/),"float") chml2(:,:,:,:) = 0. end if end if ;if i.eq.2 then - if (isfilevar(inptr2,vchmp)) then - chmp2=inptr2->$vchmp$ + if (isfilevar(inptr2,vchmpp)) then + chmp2=inptr2->$vchmpp$ else - if (isfilevar(inptr2,vchmpp)) then - chmp2=inptr2->$vchmpp$ + if (isfilevar(inptr2,vchmp)) then + chmp2=inptr2->$vchmp$ else chmp2 = new((/ntime2,nlev2,nlat2,nlon2/),"float") chmp2(:,:,:,:) = 0. @@ -495,7 +532,6 @@ p21 = pres_hybrid_ccm(ps2,p0,ha21,hb21) end if coo2=new((/ddd2(2)/),float) - dst22 = dim_avg_n(dst22,(/1,2/)) do ii=0, ddd2(2)-1 coo2(ii) = gw2(ii)*(2.*pi/nlon2)*re^2. end do @@ -511,8 +547,6 @@ p21 = pres_hybrid_ccm(ps2,p0,ha21,hb21) tbchml2 = sum(bchml2)*86400.*365.*factor(i) temis2 = sum(emis2)*86400.*365.*1e-9*factor(i) tdf2 = sum(df2)*86400.*365.*1e-9*factor(i) - taerod2 = dim_avg_n(aerod2,(/1,2/)) - tdst22 = dim_avg_n(dst22,(/1,2/)) if (isfilevar(inptr2,"O3")) then if vars(i).eq."O3" then do ii=0,ddd2(2)-1 @@ -636,17 +670,21 @@ end do global((i-1)*5+3,0)= tlno_prod1 if (compare .ne. "OBS") then global((i-1)*5+3,1)= tlno_prod2 - global((i-1)*5+3,2) = global(5*(i-1)+2,1) - global(5*(i-1)+2,0) ; diff + global((i-1)*5+3,2) = global(5*(i-1)+3,1) - global(5*(i-1)+3,0) ; diff end if global((i-1)*5+4,0)= taerod1 if (compare .ne. "OBS") then global((i-1)*5+4,1)= taerod2 - global((i-1)*5+4,2) = global(5*(i-1)+3,1) - global(5*(i-1)+3,0) ; diff + global((i-1)*5+4,2) = global(5*(i-1)+4,1) - global(5*(i-1)+4,0) ; diff + delete(aerod2) + delete(taerod2) end if global((i-1)*5+5,0)= tdst11 if (compare .ne. "OBS") then global((i-1)*5+5,1)= tdst22 - global((i-1)*5+5,2) = global(5*(i-1)+4,1) - global(5*(i-1)+4,0) ; diff + global((i-1)*5+5,2) = global(5*(i-1)+5,1) - global(5*(i-1)+5,0) ; diff + delete(dst22) + delete(tdst22) end if ; PRINTT THE TABLES diff --git a/atm_diag/tables_soa.ncl b/atm_diag/tables_soa.ncl index a8e844a4..75d8acdb 100644 --- a/atm_diag/tables_soa.ncl +++ b/atm_diag/tables_soa.ncl @@ -35,7 +35,7 @@ begin factor_mam = (/1.,1.,1.,1.,1.,32.066/115.11/) ; SO4 in TgS ivars = dimsizes(vars) mw_bam = (/12.001,144.132,12.011,12.011,12.011,96.06/) ; chem mw (96.06 is from SO4, 115.11 is from NH4HSO4 (mam) - mw_mam = (/12.001,144.132,12.011,12.011,12.011,115.11/) ; chem mw (96.06 is from SO4, 115.11 is from NH4HSO4 (mam) + mw_mam = (/12.001,250.,12.011,12.011,12.011,115.11/) ; chem mw (96.06 is from SO4, 115.11 is from NH4HSO4 (mam) nvars = 6*dimsizes(vars)+2 ; burden, emis, dry dep, wet dep, chem_loss, lifetime global = new ((/nvars,3/),"float", -999) ; global means,diff vars_all = new((/nvars/),"string") @@ -124,8 +124,10 @@ begin ; and then the difference between ; the fields aer = new(2,"string") +aer(:) = "bam" do i = 0, ivars-1 + print(vars(i)) vint1 = new((/ntime1,nlev1,nlat1,nlon1/),"float") vemis1 = new((/ntime1,nlat1,nlon1/),"float") vgas1 = new((/ntime1,nlat1,nlon1/),"float") @@ -136,11 +138,15 @@ aer = new(2,"string") dwf1 = new((/ntime1,nlat1,nlon1/),"float") vaqu1 = new((/ntime1,nlat1,nlon1/),"float") vnuc1 = new((/ntime1,nlat1,nlon1/),"float") + vcaqa1 = new((/ntime1,nlat1,nlon1/),"float") + vcaqb1 = new((/ntime1,nlat1,nlon1/),"float") if (compare .eq. "OBS") then nca = 1 else ; CASE 2 MODEL vint2 = new((/ntime2,nlev2,nlat2,nlon2/),"float") + vcaqa2 = new((/ntime2,nlat2,nlon2/),"float") + vcaqb2 = new((/ntime2,nlat2,nlon2/),"float") vemis2 = new((/ntime2,nlat2,nlon2/),"float") vgas2 = new((/ntime2,nlat2,nlon2/),"float") chmp2 = new((/ntime2,nlev2,nlat2,nlon2/),"float") @@ -201,6 +207,24 @@ aer = new(2,"string") vara = (/"soa_c1","soa_c2"/) aer(ca) = "mam3" end if + if (isfilevar(inptr,"soaff1_a1") .and. isfilevar(inptr,"soaff1_a2")) then + delete(varsoa) + mw(i) = 250. + varsoa = (/"soaff1_a1","soaff1_a2","soaff2_a1","soaff2_a2","soaff3_a1","soaff3_a2","soaff4_a1","soaff4_a2","soaff5_a1","soaff5_a2",\ + "soabb1_a1","soabb1_a2","soabb2_a1","soabb2_a2","soabb3_a1","soabb3_a2","soabb4_a1","soabb4_a2","soabb5_a1","soabb5_a2",\ + "soabg1_a1","soabg1_a2","soabg2_a1","soabg2_a2","soabg3_a1","soabg3_a2","soabg4_a1","soabg4_a2","soabg5_a1","soabg5_a2" /) + vara = (/"soaff1_c1","soaff1_c2","soaff2_c1","soaff2_c2","soaff3_c1","soaff3_c2","soaff4_c1","soaff4_c2","soaff5_c1","soaff5_c2",\ + "soabb1_c1","soabb1_c2","soabb2_c1","soabb2_c2","soabb3_c1","soabb3_c2","soabb4_c1","soabb4_c2","soabb5_c1","soabb5_c2",\ + "soabg1_c1","soabg1_c2","soabg2_c1","soabg2_c2","soabg3_c1","soabg3_c2","soabg4_c1","soabg4_c2","soabg5_c1","soabg5_c2" /) + aer(ca) = "mam3" + end if + if (isfilevar(inptr,"soa1_a1") .and. isfilevar(inptr,"soa1_a2")) then + delete(varsoa) + mw(i) = 250. + varsoa = (/"soa_a1","soa_a2","soa2_a1","soa2_a2","soa3_a1","soa3_a2","soa4_a1","soa4_a2","soa5_a1","soa5_a2"/) + vara = (/"soa1_c1","soa1_c2","soa2_c1","soa2_c2","soa3_c1","soa3_c2","soa4_c1","soa4_c2","soa5_c1","soa5_c2"/) + aer(ca) = "mam3" + end if end if if vars(i).eq."DUST" then if (isfilevar(inptr,"DST01") .and. isfilevar(inptr,"DST02") .and. isfilevar(inptr,"DST03") .and. isfilevar(inptr,"DST04")) then @@ -268,6 +292,13 @@ aer = new(2,"string") vara = (/"pom_c1","pom_c4"/) aer(ca) = "mam3" end if + if (isfilevar(inptr,"pomff1_a1") .and. isfilevar(inptr,"pomff1_a4")) then + delete(vara) + delete(varsoa) + varsoa = (/"pomff1_a1","pomff1_a4","pombb1_a1","pombb1_a4"/) + vara = (/"pomff1_c1","pomff1_c4","pombb1_c1","pombb1_c4"/) + aer(ca) = "mam3" + end if end if end if if vars(i).eq."BC" then @@ -547,7 +578,6 @@ aer = new(2,"string") end if - ; CASE 1 MODEL @@ -638,6 +668,7 @@ aer = new(2,"string") if (compare .ne. "OBS") then ; CASE 2 MODEL + vaqu2 = vcaqa2 + vcaqb2 delp2=(/vint2/) ddd2=dimsizes(delp2) @@ -707,7 +738,12 @@ aer = new(2,"string") if (all(ismissing(tbchmp2)) .or. all(ismissing(tddf2)) .or. all(ismissing(tdwf2))) then lifet2=0. else - lifet2 = tbvar2/(tbchmp2+tddf2-tdwf2 + tbaqu2+tbnuc2)*365. + ; lifet2 = tbvar2/(tbchmp2+tddf2-tdwf2 + tbaqu2+tbnuc2)*365. + if (tddf2-tdwf2).ne.0. then + lifet2 = tbvar2/(tddf2-tdwf2)*365 + else + lifet2=0. + end if end if end if