for cat in TOTALS ENE REF_TRF IND \
TNR_Aviation_CDS TNR_Aviation_CRS TNR_Aviation_LTO TNR_Aviation_SPS \
TRO_noRES TRO_RES TNR_Other TNR_Ship RCO PRO NMM CHE IRO NFE NEU PRU_SOL FOO_PAP \
MNM AWB AGS SWD_LDF SWD_INC WWT FFF;do
for i in BC CO NH3 NMVOC NOx OC PM10 PM2.5 SO2;do
https=https://cidportal.jrc.ec.europa.eu/ftp/jrc-opendata/EDGAR/datasets/v50_AP/${i}/${cat}if[$cat=='TOTALS'];then
filez=v50_${i}_2015.0.1x0.1.zip
elif[$cat=='TNR_Aviation_SPS'];then
filez=${cat}_nc.zip
else
filez=v50_${i}_2015_monthly_${cat}_nc.zip
fi
zz=${https}/${filez}
wget -q--no-check-certificate$zzif[-e${filez}];then unzip -q-o${filez};fi
done
done
spec='BC CO NH3 NMVOC NOx OC PM10 PM2.5 SO2'.split()nspec=len(spec)specn={spec[i]:iforiinrange(nspec)}ny,nx=1800,3600var=np.zeros(shape=(9+1,ny,nx))forsinspec:fname='v50_'+s+'_2015.0.1x0.1.nc'nc=netCDF4.Dataset(fname,'r')v='emi_'+s.lower()var[specn[s],:,:]=nc[v][:,:]var[-1,:,:]=var[specn['PM10'],:,:]-var[specn['PM2.5'],:,:]var=np.where(var<0,0,var)spec+=['PMC']specn.update({'PMC':len(spec)-1})lonM=[0.05+i*0.1foriinrange(nx)]latM=[-89.95+i*0.1foriinrange(ny)]lonm,latm=np.meshgrid(lonM,latM)
讀取排放量檔案之模版
將EDGAR之網格經緯度座標值轉到模版檔案的網格系統
找到在模版範圍內的EDGAR座標點(idx),準備進行griddata內插
DD=sys.argv[1]#interpolation indexing from template # get the argument
tail=DD+'.nc'fname='template'+tailnc=netCDF4.Dataset(fname,'r')V=[list(filter(lambdax:nc.variables[x].ndim==j,[iforiinnc.variables]))forjin[1,2,3,4]]nt,nlay,nrow,ncol=nc.variables[V[3][0]].shapex1d=[nc.XORIG+nc.XCELL*iforiinrange(ncol)]y1d=[nc.YORIG+nc.YCELL*iforiinrange(nrow)]x1,y1=np.meshgrid(x1d,y1d)maxx,maxy=x1[-1,-1],y1[-1,-1]minx,miny=x1[0,0],y1[0,0]pnyc=Proj(proj='lcc',datum='NAD83',lat_1=10,lat_2=40,lat_0=nc.YCENT,lon_0=nc.XCENT,x_0=0,y_0=0.0)x,y=pnyc(lonm,latm,inverse=False)boo=(x<=maxx+nc.XCELL*10)&(x>=minx-nc.XCELL*10)&(y<=maxy+nc.YCELL*10)&(y>=miny-nc.YCELL*10)idx=np.where(boo)mp=len(idx[0])xyc=[(x[idx[0][i],idx[1][i]],y[idx[0][i],idx[1][i]])foriinrange(mp)]
污染項目之對照
此處將所有NOx先放在NO2,未來再予以調整
VOCs另行處理(使用REAS的排放比例)
# spec name dict
EDGAR2EMIS={'BC':'PEC','OC':'POA','PM2.5':'FPRM','PMC':'CPRM'}spec='BC CO NH3 NMVOC NOx OC PM10 PM2.5 SO2'.split()mw={i:1foriinEDGAR2EMIS}mw.update({'CO':28,'NH3':17,'NMVOC':58,'NOx':46,'SO2':64})EDGAR2EMIS.update({'NOx':'NO2'})EDGAR2EMIS.update({i:iforiin'CO NH3 SO2'.split()})VOCs=['ALD2','ALDX','BENZ','ETH','ETHA','ETHY','ETOH','FORM','HONO','IOLE','ISOP','KET','MEOH','OLE','PAR','PRPA','TERP','TOL','XYL']nv=len(VOCs)
複製模版、內插、先處理一般污染物
單位轉換:kg/m2/s → gmole/cell/s
fname='EDGAR'+tailos.system('cp template'+tail+' '+fname)nc=netCDF4.Dataset(fname,'r+')# elongate the new ncf
# fill the new nc file
forvinV[3]:nc[v][:]=0.#interpolation scheme, for D0/D2 resolution(15Km/27Km)
forvinspec:ifvnotinEDGAR2EMIS.keys():continue#(PM10 and NMVOC)
ispec=specn[v]vc=EDGAR2EMIS[v]ifvcnotinV[3]:continuezz=np.zeros(shape=(nrow,ncol))c=np.array([var[ispec,idx[0][i],idx[1][i]]foriinrange(mp)])zz[:,:]=griddata(xyc,c[:],(x1,y1),method='linear')zz=np.where(np.isnan(zz),0,zz)nc[vc][0,0,:,:]=zz[:,:]/mw[v]*1000.*nc.XCELL*nc.YCELLprint(v)
Ding, J., Miyazaki, K., van der A, R.J., Mijling, B., Kurokawa, J., Cho, S., Janssens-Maenhout, G., Zhang, Q., Liu, F., and Levelt, P.F. (2017). Intercomparison of NOx emission inventories over East Asia. Atmos. Chem. Phys. 17 (16):10125–10141. doi:10.5194/acp-17-10125-2017.