emission_read__co2.F90 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691
  1. #define TRACEBACK write (gol,'("in ",a," (",a,i6,")")') rname, __FILE__, __LINE__ ; call goErr
  2. #define IF_NOTOK_RETURN(action) if (status/=0) then; TRACEBACK; action; return; end if
  3. #define IF_ERROR_RETURN(action) if (status> 0) then; TRACEBACK; action; return; end if
  4. !
  5. #include "tm5.inc"
  6. !
  7. !-----------------------------------------------------------------------------
  8. ! TM5 !
  9. !-----------------------------------------------------------------------------
  10. !BOP
  11. !
  12. ! !MODULE: EMISSION_READ
  13. !
  14. ! !DESCRIPTION: This module provides objects and methods related to
  15. ! CMIP6 and IPCC-AR5 emissions.
  16. !
  17. ! AR5 netCDF files are provided by CMIP5:
  18. !
  19. ! There are a few keys in the rc-file which control the behaviour of
  20. ! this module and the data used:
  21. ! # specify the (main) provider of emission sets
  22. ! input.emis.provider : AR5
  23. ! # where to find the emissions (this will be used by install-emis-ar5)
  24. ! input.emis.dir : ${TEMP}/EMIS/AR5
  25. ! # year of emissions (AR5 emissions will be linearly interpolated)
  26. ! input.emis.year : 2000
  27. ! # choose RCP out of RCP26, RCP45, RCP60, RCP85
  28. ! input.emis.AR5.RCP : RCP45
  29. !
  30. !\\
  31. !\\
  32. ! !INTERFACE:
  33. !
  34. MODULE EMISSION_READ
  35. !
  36. ! !USES:
  37. !
  38. use GO, only : gol, goErr, goPr, goLabel
  39. use emission_data, only : emis_input_dir_cmip6
  40. use emission_data, only : emis_input_dir_ar5
  41. use emission_data, only : vd_class_name_len
  42. use dims, only : nlon360, nlat180, iglbsfc
  43. use chem_param, only : xmc, xmco2
  44. use Dims, only : okdebug
  45. USE MDF, ONLY : MDF_Open, MDF_NETCDF, MDF_READ
  46. USE MDF, ONLY : MDF_Inq_VarID, MDF_Get_Var, MDF_Close
  47. implicit none
  48. private
  49. !
  50. ! !PUBLIC MEMBER FUNCTIONS:
  51. !
  52. public :: emission_read_init, emission_read_done
  53. public :: emission_ar5_regrid_aircraft
  54. !public :: numb_2dsec, numb_3dsec
  55. public :: numb_sectors, sectors_def
  56. public :: numb_providers, providers_def
  57. public :: sector_name_len
  58. public :: emission_cmip6_readsector
  59. public :: emission_ar5_readCO2
  60. public :: ar5_dim_3ddata
  61. public :: sector_type, provider_type
  62. !
  63. ! !PRIVATE DATA MEMBERS:
  64. !
  65. character(len=*), parameter :: mname = 'emission_read'
  66. ! ------------------------------
  67. ! global characteristics
  68. ! ------------------------------
  69. ! AR5: CO2 emissions from land use are provided at 0.5x0.5, from fossil fuel use at 1x1
  70. integer, parameter :: nlat360 = 360 ! number of latitudes for CMIP6, AR5 (0.5deg)
  71. integer, parameter :: nlon720 = 720 ! number of longitudes for CMIP6, AR5 (0.5deg)
  72. integer, parameter :: sector_name_len = 18 ! length of sector descriptor
  73. integer, parameter :: categ_name_len = 14 ! length of category descriptor
  74. integer, parameter :: numb_sectors = 12 ! number of sectors (All providers!)
  75. !integer, parameter :: numb_2dsec = 10 ! number of 2d sectors (all except aircraft)
  76. !integer, parameter :: numb_3dsec = 1 ! number of 3d sectors (aircraft)
  77. integer, parameter :: numb_providers = 2 ! CMIP6, AR5
  78. ! Since CMIP6 emissions from aviation are provided on the same vertical grid
  79. ! as for AR5, this variable is also used for CMIP6:
  80. integer, parameter :: ar5_dim_3ddata = 25 ! number of layers for aircraft data
  81. ! full list of providers
  82. character(10), dimension(numb_providers), parameter :: all_providers = &
  83. & (/ 'CMIP6 ', 'AR5 '/)
  84. ! Once CO2 will be combined with chemical tracers in one model,
  85. ! a separate category for AR5 CO2 could be introduced, because the file format is different
  86. ! The above is an old comment; the code is not working for AR5 CO2 emissions
  87. ! List of providers effectively used
  88. character(10), PUBLIC, allocatable :: used_providers(:) ! CO2
  89. ! flag for degenerated cases
  90. logical, PUBLIC :: has_emis = .true.
  91. ! ------------------------------
  92. character(len=15), parameter :: filestr_common_pre = 'IPCC_emissions'
  93. character(len=25), parameter :: filestr_common_post = '0.5x0.5.nc'
  94. ! ------------------------------
  95. ! identifier of RCPs (RCP26, RCP45,...)
  96. ! ------------------------------
  97. character(len=5) :: filestr_rcpiden
  98. !------------------------------
  99. ! SSP scenario name
  100. !------------------------------
  101. character(len=14) :: ssp_name
  102. ! ------------------------------
  103. ! available years and related parameters/variables
  104. ! ------------------------------
  105. !
  106. ! CMIP6
  107. ! availability (min, max years) - Limit MACC and MEGAN to one year for EC-Earth
  108. integer, dimension(2), parameter :: cmip6_avail = (/1850, 2100/)
  109. !---------------------------------------------
  110. ! CMIP5 CO2 emission data
  111. !---------------------------------------------
  112. ! historical data
  113. !---------------------------------------------
  114. ! emissions from fossil-fuel use are provided as monthly gridded fields for 1751-2007 (1x1 degree)
  115. ! (http://dods.ipsl.jussieu.fr/cpipsl/ANDRES/)
  116. ! emissions from land use are provided as yearly gridded fields for 1850-2005 (0.5x0.5 degree)
  117. ! (http://www.mpimet.mpg.de/en/wissenschaft/land-im-erdsystem/...
  118. ! .../wechselwirkung-klima-biogeosphaere/landcover-change-emission-data.html)
  119. ! we only use the data for the years 1850-2005:
  120. integer, dimension(2), parameter :: ar5_avail = (/1850, 2005/)
  121. ! global totals (Pg C/yr) are provided as well:
  122. ! the numbers for the reference year 2005 are:
  123. !real, parameter :: co2_ff_ref = 7.6137 ! Pg C/yr as provided
  124. real, parameter :: co2_ff_ref = 7.617692 ! Pg C/yr as calculated from the gridded fields
  125. !real, parameter :: co2_lu_ref = 1.196 ! Pg C/yr as provided
  126. real, parameter :: co2_lu_ref = 1.4673 ! Pg C/yr as calculated from the gridded field
  127. ! for the land-use emissions up to 2001 the totals calculated from the gridded fields agree well
  128. ! with the totals given by the data provider
  129. ! however, for the last four years 2002-2005 the gridded fields give substantially higher totals
  130. ! this suggests that the emission totals provided for land use have been harmonized with the RCPs
  131. ! while the gridded fields have not
  132. real :: co2_ref
  133. ! future CO2 emissions for the RCPs (2006-2100) are provided as yearly totals (Pg C/yr)
  134. ! we currently use the global totals, but regional totals are available as well
  135. ! values obtained from the IIASA RCP website (http://tntcat.iiasa.ac.at/RcpDb/)
  136. ! for 2006-2100 we combined these totals with the spatial distribution for 2005
  137. integer, parameter :: ar5_nr_avail_yrs = 11
  138. integer, dimension(ar5_nr_avail_yrs), parameter :: &
  139. ar5_avail_yrs = (/ 2005, 2010, 2020, 2030, 2040, &
  140. 2050, 2060, 2070, 2080, 2090, 2100 /)
  141. real, dimension(ar5_nr_avail_yrs), parameter :: &
  142. co2ff_rcp26 = (/ 7.971, 8.821, 9.288, 7.157, 4.535, 3.186, 1.419, 0.116, -0.433, -0.870, -0.931/), &
  143. co2ff_rcp60 = (/ 7.971, 8.512, 8.950, 9.995, 11.554, 13.044, 14.824, 16.506, 17.281, 14.313, 13.753/), &
  144. co2ff_rcp45 = (/ 7.971, 8.607, 9.872, 10.953, 11.338, 11.031, 9.401, 7.118, 4.182, 4.193, 4.203/), &
  145. co2ff_rcp85 = (/ 7.971, 8.926, 11.538, 13.839, 16.787, 20.205, 23.596, 25.962, 27.406, 28.337, 28.740/), &
  146. ! for 2000 and 2005 the global total fossil-fuel emissions for the RCPs
  147. ! are 2.7% resp. 5% higher than the totals given by the provider of the historical dataset
  148. ! this suggests that this dataset has not been harmonized with the RCPs
  149. co2lu_rcp26 = (/ 1.196, 1.056, 0.973, 0.789, 0.489, 0.201, 0.615, 0.538, 0.550, 0.602, 0.511/), &
  150. co2lu_rcp60 = (/ 1.196, 0.877, 0.406, -0.557, -0.714, -0.464, -0.258, -0.029, 0.244, 0.242, 0.181/), &
  151. co2lu_rcp45 = (/ 1.196, 0.911, 0.341, 0.216, 0.199, 0.249, 0.184, 0.104, 0.008, 0.027, 0.046/), &
  152. co2lu_rcp85 = (/ 1.196, 1.044, 0.906, 0.715, 0.645, 0.576, 0.501, 0.412, 0.309, 0.194, 0.077/)
  153. real, dimension(ar5_nr_avail_yrs) :: co2_rcp
  154. logical, dimension(:), allocatable :: ltimeind
  155. character(len=7) :: ar5ff_coverage = 'monthly'
  156. character(len=7) :: ar5lu_coverage = 'yearly '
  157. ! ------------------------------
  158. ! gridbox area (to be read only once per proc)
  159. ! ------------------------------
  160. character(len=25),parameter :: cmip6_filestr_gridboxarea = 'gridbox_area.nc '
  161. character(len=25),parameter :: ar5_filestr_gridboxarea = 'gridbox_area.nc'
  162. logical, save :: area_found_05
  163. real, dimension(:,:), allocatable :: gridbox_area_05 ! gridbox area on 0.5x0.5 deg - used for AR5
  164. ! -----------------------
  165. ! data type for sectors
  166. ! -----------------------
  167. type sector_type
  168. sequence
  169. character(len=sector_name_len) :: name ! name of sector
  170. character(len=categ_name_len) :: catname ! name of category to be found in
  171. logical :: f3d ! 3d-data y/n
  172. character(len=vd_class_name_len) :: vdisttype ! vertical distribution type (equal to "classes" still to be defined)
  173. character(len=8) :: prov ! provider of information (AR5)
  174. character(len=26), dimension(:), pointer :: species ! list of species available for that sector (use for AR5 only)
  175. end type sector_type
  176. type provider_type
  177. character(len=8) :: name
  178. integer :: nsect2d, nsect3d
  179. end type provider_type
  180. type(sector_type), dimension(numb_sectors) :: sectors_def
  181. type(provider_type), dimension(numb_providers) :: providers_def
  182. !
  183. ! !REVISION HISTORY:
  184. ! 1 Oct 2010 - Achim Strunk - v0 for AR5
  185. ! 19 Jun 2012 - P. Le Sager - cosmetic for lon-lat MPI domain decomposition
  186. ! (all reading/regridding on root for now)
  187. ! 20 Nov 2012 - Ph. Le Sager - defined and build lists of used providers
  188. ! - deal with inventories years availability
  189. ! - switch to MDF interface to read data
  190. !
  191. ! !TODO:
  192. ! - should be renamed something like "emission_inventories" or "emiss_providers"
  193. ! - and need to get a **SEPARATE** module for each inventories, before it
  194. ! becomes unmanageable again
  195. !
  196. !EOP
  197. !------------------------------------------------------------------------
  198. CONTAINS
  199. !--------------------------------------------------------------------------
  200. ! TM5 !
  201. !--------------------------------------------------------------------------
  202. !BOP
  203. !
  204. ! !IROUTINE: EMISSION_READ_INIT
  205. !
  206. ! !DESCRIPTION: Initialise reading related parameters and
  207. ! allocate needed arrays
  208. !
  209. !\\
  210. ! !INTERFACE:
  211. !
  212. SUBROUTINE EMISSION_READ_INIT( rcF, status )
  213. !
  214. ! !USES:
  215. !
  216. use GO, only : TrcFile, ReadRc
  217. use partools, only : isRoot
  218. use emission_data, only : LCMIP6
  219. use emission_data, only : LAR5
  220. use meteodata, only : set, gph_dat
  221. use dims, only : im, jm, lm, nregions
  222. !
  223. ! !INPUT PARAMETERS:
  224. !
  225. type(TrcFile) :: rcF
  226. !
  227. ! !OUTPUT PARAMETERS:
  228. !
  229. integer, intent(out) :: status
  230. !
  231. ! !REVISION HISTORY:
  232. ! 1 Oct 2010 - Achim Strunk - v0 for AR5
  233. ! 20 Nov 2012 - Ph. Le Sager - build lists of used providers
  234. !
  235. ! !REMARKS:
  236. !
  237. !EOP
  238. !------------------------------------------------------------------------
  239. !BOC
  240. character(len=*), parameter :: rname=mname//'/emission_read_init'
  241. integer :: isect, iprov, nused, region
  242. logical :: mask(numb_providers)
  243. ! --- begin --------------------------------------
  244. if (LCMIP6) then
  245. ! The SSP scenario data are provided for the years 2015-2100.
  246. ! SSP5-8.5 is the official scenario run in C4MIP and is therefore set as the default here
  247. ! SSP1-1.9 and SSP1-2.6 (with negative emissions) and SSP2-4.5 are now supported
  248. call ReadRc( rcF, 'input.CMIP6.SSP', ssp_name, status, default = 'SSP5-8.5' )
  249. IF_ERROR_RETURN(status=1)
  250. write(gol,'("SSP CMIP6 future scenario for emissions: ",a)') trim(ssp_name); call goPr
  251. else if (LAR5) then
  252. call ReadRc( rcF, 'input.emis.AR5.RCP', filestr_rcpiden, status, default='RCP26' )
  253. IF_ERROR_RETURN(status=1)
  254. endif
  255. ! ------------------
  256. ! build list of used providers
  257. ! ------------------
  258. ! CO2
  259. mask = (/ LCMIP6, LAR5 /)
  260. nused = count(mask)
  261. if (nused /= 0) then
  262. allocate( used_providers(nused) )
  263. used_providers = pack( all_providers, mask)
  264. else
  265. has_emis = .false.
  266. end if
  267. ! info
  268. if ( has_emis ) then
  269. write(gol,*) 'EMISS-INFO - Emissions providers used for CO2: ', used_providers ; call goPr
  270. else
  271. write(gol,*) 'EMISS-INFO - Emissions providers used for CO2: NONE' ; call goPr
  272. end if
  273. ! ------------------
  274. ! initialise sectors
  275. ! ------------------
  276. ! Type sequence is (name, category, is_3D_data, vdisttype, providers)
  277. sectors_def( 1) = sector_type('emiss_ff ', 'anthropogenic ', .false., 'combenergy ', 'AR5 ', NULL() ) ! Fossil Fuel
  278. sectors_def( 2) = sector_type('emiss_lu ', 'anthropogenic ', .false., 'nearsurface ', 'AR5 ', NULL() ) ! Land Use (assumed near surface for the moment, but that is open for discussion)
  279. ! CMIP6
  280. sectors_def( 3) = sector_type('ENE ', 'anthropogenic ', .false., 'combenergy ', 'CMIP6 ', NULL() ) ! Energy sector
  281. sectors_def( 4) = sector_type('RCO ', 'anthropogenic ', .false., 'combrescom ', 'CMIP6 ', NULL() ) ! Residential, commercial and other
  282. sectors_def( 5) = sector_type('IND ', 'anthropogenic ', .false., 'industry ', 'CMIP6 ', NULL() ) ! Industrial sector
  283. sectors_def( 6) = sector_type('WST ', 'anthropogenic ', .false., 'waste ', 'CMIP6 ', NULL() ) ! Waste treatment and disposal
  284. sectors_def( 7) = sector_type('AGR ', 'anthropogenic ', .false., 'surface ', 'CMIP6 ', NULL() ) ! Agriculture (excl. agricultural waste burning, which is included in CMIP6 biomass burning emissions)
  285. ! CO2 emissions from AGR are zero in CMIP6
  286. sectors_def( 8) = sector_type('SLV ', 'anthropogenic ', .false., 'nearsurface ', 'CMIP6 ', NULL() ) ! Solvents production and application
  287. sectors_def( 9) = sector_type('TRA ', 'anthropogenic ', .false., 'surface ', 'CMIP6 ', NULL() ) ! Transportation sector (land)
  288. sectors_def(10) = sector_type('SHP ', 'ships ', .false., 'nearsurface ', 'CMIP6 ', NULL() ) ! International shipping
  289. sectors_def(11) = sector_type('AIR ', 'aircraft ', .true. , 'aircraft ', 'CMIP6 ', NULL() ) ! Aircraft
  290. sectors_def(12) = sector_type('NEG ', 'anthropogenic ', .false., 'surface ', 'CMIP6 ', NULL() ) ! Negative CO2 Emissions
  291. ! -------------------------
  292. ! initialise providers info
  293. ! ------------------------
  294. do iprov = 1, numb_providers
  295. providers_def(iprov)%name = all_providers(iprov)
  296. providers_def(iprov)%nsect2d = count( (sectors_def%prov == all_providers(iprov)) .and. (sectors_def%f3d .eqv. .false.))
  297. providers_def(iprov)%nsect3d = count( (sectors_def%prov == all_providers(iprov)) .and. (sectors_def%f3d .eqv. .true.))
  298. if(okdebug) then
  299. write(gol,'("EMISS-INFO - Inventory ",a," has ",i3, " 2d-sectors, and ",i3," 3d-sectors")')&
  300. & all_providers(iprov), providers_def(iprov)%nsect2d, providers_def(iprov)%nsect3d ; call goPr
  301. endif
  302. end do
  303. ! -------------------------
  304. ! initialise GeopPotential Height on 1x1
  305. ! ------------------------
  306. do region=1, nregions
  307. call Set( gph_dat(region), status, used=.true. )
  308. end do
  309. ! ----------------------------------------
  310. ! allocate gridbox_area arrays
  311. ! ----------------------------------------
  312. allocate( gridbox_area_05( nlon720, nlat360 ) )
  313. ! OK
  314. status = 0
  315. END SUBROUTINE EMISSION_READ_INIT
  316. !EOC
  317. !--------------------------------------------------------------------------
  318. ! TM5 !
  319. !--------------------------------------------------------------------------
  320. !BOP
  321. !
  322. ! !IROUTINE: EMISSION_READ_DONE
  323. !
  324. ! !DESCRIPTION: Free allocated arrays.
  325. !\\
  326. !\\
  327. ! !INTERFACE:
  328. !
  329. subroutine emission_read_done( status )
  330. !
  331. ! !OUTPUT PARAMETERS:
  332. !
  333. integer, intent(out) :: status
  334. !
  335. ! !REVISION HISTORY:
  336. ! 1 Oct 2010 - Achim Strunk - v0
  337. !
  338. !EOP
  339. !------------------------------------------------------------------------
  340. !BOC
  341. character(len=*), parameter :: rname=mname//'/emission_read_done'
  342. deallocate( gridbox_area_05 )
  343. deallocate( used_providers )
  344. ! OK
  345. status = 0
  346. END SUBROUTINE EMISSION_READ_DONE
  347. !EOC
  348. !--------------------------------------------------------------------------
  349. ! TM5 !
  350. !--------------------------------------------------------------------------
  351. !BOP
  352. !
  353. ! !FUNCTION: EMISSION_COARSEN_TO_1X1
  354. !
  355. ! !DESCRIPTION: Coarsen the gridded information to 1x1 deg.
  356. ! (taken from GEMS/MACC repository)
  357. !\\
  358. !\\
  359. ! !INTERFACE:
  360. !
  361. function emission_coarsen_to_1x1( emis_in, dim_nlon, dim_nlat, shift_lon, status )
  362. !
  363. ! !RETURN VALUE:
  364. !
  365. real, dimension(360,180) :: emission_coarsen_to_1x1
  366. !
  367. ! !INPUT PARAMETERS:
  368. !
  369. integer, intent(in) :: dim_nlon
  370. integer, intent(in) :: dim_nlat
  371. real, intent(in) :: emis_in(dim_nlon, dim_nlat)
  372. logical, intent(in) :: shift_lon
  373. !
  374. ! OUTPUT PARAMETERS:
  375. !
  376. integer , intent(out) :: status
  377. !
  378. ! !REVISION HISTORY:
  379. ! 1 Oct 2010 - Achim Strunk - v0 for AR5
  380. ! 1 Dec 2011 - Narcisa Banda - works for any input resolution lower than 1x1
  381. ! if 1x1 can be divided into exact number of gridcells (no interpolation)
  382. ! 1 Jul 2012 - Narcisa Banda - added the shift_lon logical flag:
  383. ! true if the data is read on longitudes [0,360] (then they need to be shifted on [-180,180])
  384. ! false if the data is read already on [-180,180]
  385. !
  386. !EOP
  387. !------------------------------------------------------------------------
  388. !BOC
  389. integer :: i, j
  390. integer :: nri, nrj
  391. ! --- begin -----------------------------------
  392. ! combine grid cells :
  393. ! from [ 0,360]x[-90,90] 001:360,361:720 001:360
  394. ! to [-180,180]x[-90,90] 001:180,181:360 001:180
  395. if ((mod(dim_nlon, 360) /= 0 ) .or. (mod(dim_nlat, 180) /= 0)) then
  396. write(gol,*) 'coarsening of emissions to 1x1 does not work for this resolution'
  397. status = 1
  398. return
  399. endif
  400. nri = dim_nlon/360
  401. nrj = dim_nlat/180
  402. if (shift_lon) then
  403. ! combine grid cells :
  404. ! from [ 0,360]x[-90,90] 001:360,361:720 001:360
  405. ! to [-180,180]x[-90,90] 001:180,181:360 001:180
  406. do j = 1, 180
  407. ! west half
  408. do i = 1, 180
  409. emission_coarsen_to_1x1(i,j) = sum(emis_in(nri*180+nri*i-nri+1:nri*180+nri*i,nrj*j-nrj+1:nrj*j))
  410. end do
  411. ! east half
  412. do i = 1, 180
  413. emission_coarsen_to_1x1(180+i,j) = sum(emis_in(nri*i-nri+1:nri*i,nrj*j-nrj+1:nrj*j))
  414. end do
  415. end do
  416. else
  417. do j=1, 180
  418. do i=1, 360
  419. emission_coarsen_to_1x1(i,j) = sum(emis_in(nri*i-nri+1:nri*i,nrj*j-nrj+1:nrj*j))
  420. end do
  421. end do
  422. endif
  423. ! ok
  424. status = 0
  425. end function emission_coarsen_to_1x1
  426. !EOC
  427. !--------------------------------------------------------------------------
  428. ! TM5 !
  429. !--------------------------------------------------------------------------
  430. !BOP
  431. !
  432. ! !FUNCTION: VALID_YEAR
  433. !
  434. ! !DESCRIPTION: return a valid year for an emission inventory, based on
  435. ! requested year.
  436. !\\
  437. !\\
  438. ! !INTERFACE:
  439. !
  440. FUNCTION VALID_YEAR( iyear, iminmax, provider_name, verbose)
  441. !
  442. ! !RETURN VALUE:
  443. !
  444. integer :: valid_year
  445. !
  446. ! !INPUT PARAMETERS:
  447. !
  448. integer, intent(in) :: iyear, iminmax(2)
  449. character(len=*), intent(in) :: provider_name
  450. logical, intent(in) :: verbose
  451. !
  452. ! !REVISION HISTORY:
  453. ! 26 Nov 2012 - Ph. Le Sager - v0
  454. !
  455. !EOP
  456. !------------------------------------------------------------------------
  457. !BOC
  458. valid_year = MIN(iminmax(2),MAX(iyear,iminmax(1)))
  459. ! info only once a year, and per inventory
  460. if (verbose) then
  461. write(gol,'(a,i4," (avail: ",i4,"-",i4,")")') ' EMISS-INFO - EMISS YEAR for '//trim(provider_name)//' : ', &
  462. valid_year, iminmax ; call goPr
  463. end if
  464. END FUNCTION VALID_YEAR
  465. !EOC
  466. !--------------------------------------------------------------------------
  467. ! TM5 !
  468. !--------------------------------------------------------------------------
  469. !BOP
  470. !
  471. ! !IROUTINE: EMISSION_CMIP6_READSECTOR
  472. !
  473. ! !DESCRIPTION: Reading one sector of the files for the requested month and
  474. ! returning an interpolated 3d emission field (d3data)
  475. ! and, for the CMIP6 2-D sectors, an interpolated 2d field
  476. ! containing emissions from solid biofuel combustion (d2data_bf).
  477. !\\
  478. !\\
  479. ! !INTERFACE:
  480. !
  481. subroutine emission_cmip6_ReadSector( comp, iyear, imonth, sector, d3data, status, d2data_bf )
  482. !
  483. use dims , only : icalendo
  484. !
  485. ! !INPUT PARAMETERS:
  486. !
  487. character(len=*) , intent(in) :: comp
  488. integer , intent(in) :: iyear
  489. integer , intent(in) :: imonth
  490. integer , intent(in) :: sector
  491. !
  492. ! !OUTPUT PARAMETERS:
  493. !
  494. integer , intent(out) :: status
  495. real, dimension(nlon360,nlat180,ar5_dim_3ddata), intent(out) :: d3data
  496. real, dimension(nlon360,nlat180), intent(out), optional :: d2data_bf
  497. !
  498. !EOP
  499. !------------------------------------------------------------------------
  500. !BOC
  501. character(len=*), parameter :: rname = mname//'/emission_cmip6_readsector'
  502. character(len=256) :: fname
  503. character(len=256) :: fname_gridboxarea
  504. character(len=256) :: varfilename, varname, secname
  505. integer :: lt, year, startyear
  506. character(len=25) :: sec_str, sec_str2
  507. character(len=13) :: time_str
  508. character(len=128) :: source_str
  509. character(len=50) :: version_str
  510. logical :: existfile
  511. character(len=4) :: cyear
  512. logical :: first=.true.
  513. ! --- begin -----------------------------------
  514. ! only allow CO2 component
  515. if ( index(comp,'CO2') /= 1 ) then
  516. write (gol,'(a)') ' CMIP6 emissions of component '//trim(comp)//' not supported in co2 version' ; call goErr
  517. status=1; TRACEBACK; return
  518. endif
  519. if (present(d2data_bf)) then
  520. write (gol,'("CMIP6 emissions of solid biofuel combustion (d2data_bf) not supported in co2 version")') ; call goErr
  521. status=1; TRACEBACK; return
  522. endif
  523. ! initialise target array
  524. d3data = 0.0
  525. if (present(d2data_bf)) d2data_bf = 0.0
  526. ! read in gridbox-area; once per CPU
  527. if( .not. area_found_05 ) then
  528. fname_gridboxarea = trim(emis_input_dir_cmip6)//'/'//trim(cmip6_filestr_gridboxarea)
  529. call emission_ReadGridboxArea(fname_gridboxarea, 'gridbox_area', gridbox_area_05, &
  530. & nlon720, nlat360, status )
  531. IF_NOTOK_RETURN(status=1)
  532. area_found_05=.true.
  533. endif
  534. ! deal with out-of-bounds requested years
  535. year = valid_year( iyear, cmip6_avail, 'CMIP6', first)
  536. first=.false.
  537. if ( trim(sectors_def(sector)%catname) == 'aircraft' .and. year < 1920 ) then
  538. ! CMIP6 aircraft emissions before 1920 are zero and not read anymore
  539. d3data(:,:,:) = 0.
  540. else
  541. ! cyear will contain strings with the years
  542. write(cyear,'(I4.4)') year
  543. ! ------------------------
  544. ! construct filename
  545. ! e.g.: <emisdir>/NOx-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-v2016-06-18_gr_175001-179912.nc
  546. ! ------------------------
  547. if ( index(comp,'CH4') /= 1 ) then
  548. if (year >= 1750 .and. year < 1800) then
  549. time_str='175001-179912'
  550. startyear=1750
  551. else if (year >= 1800 .and. year < 1850) then
  552. time_str='180001-184912'
  553. startyear=1800
  554. else if (year >= 1850 .and. year < 1851) then
  555. time_str='185001-185012'
  556. startyear=1850
  557. else if (year >= 1851 .and. year < 1900) then
  558. time_str='185101-189912'
  559. startyear=1851
  560. else if (year >= 1900 .and. year < 1950) then
  561. time_str='190001-194912'
  562. startyear=1900
  563. else if (year >= 1950 .and. year < 2000) then
  564. time_str='195001-199912'
  565. startyear=1950
  566. else if (year >= 2000 .and. year < 2015) then
  567. time_str='200001-201412'
  568. startyear=2000
  569. else if (year >= 2015 .and. year <= 2100) then
  570. time_str='201501-210012'
  571. startyear=2015
  572. else
  573. write (gol,'("CMIP6 emissions beyond 2100 not available")') ; call goErr
  574. status=1; TRACEBACK; return
  575. endif
  576. if (year >= 1750 .and. year < 2015) then
  577. if (trim(sectors_def(sector)%catname) == 'aircraft') then
  578. if ( index(comp,'SO2') /= 1 ) then
  579. version_str='2017-08-30'
  580. else
  581. ! SO2 aicraft emissions have had another update in Oct. 2017
  582. version_str='2017-10-05'
  583. endif
  584. else
  585. version_str='2017-05-18'
  586. endif
  587. else if (year >= 2015 .and. year <=2100) then
  588. version_str='1-1'
  589. else
  590. write (gol,'("CMIP6 emissions beyond 2100 not available")') ; call goErr
  591. status=1; TRACEBACK; return
  592. endif
  593. else
  594. ! CH4
  595. if (year >= 1750 .and. year < 1850) then
  596. write (gol,'("WARNING - Anthropogenic emissions of CH4 not available prior to 1850")') ; call goPr
  597. write (gol,'("WARNING - 1850 values are used")') ; call goPr
  598. year = 1850
  599. endif
  600. if (year >= 1850 .and. year < 1970) then
  601. time_str='185001-196012'
  602. startyear=1850
  603. version_str='2017-05-18-supplemental-data'
  604. else if (year >= 1970 .and. year < 2015) then
  605. time_str='197001-201412'
  606. startyear=1970
  607. version_str='2017-05-18'
  608. else if (year >= 2015 .and. year <= 2100) then
  609. time_str='201501-210012'
  610. startyear=2015
  611. version_str='1-1'
  612. else
  613. write (gol,'("CMIP6 emissions beyond 2100 not available")') ; call goErr
  614. status=1; TRACEBACK; return
  615. endif
  616. endif
  617. if (year <= 2014 ) then
  618. source_str='input4MIPs_emissions_CMIP_CEDS'
  619. else
  620. select case(trim(ssp_name))
  621. case("SSP1-1.9")
  622. source_str='input4MIPs_emissions_ScenarioMIP_IAMC-IMAGE-ssp119'
  623. case("SSP1-2.6")
  624. source_str='input4MIPs_emissions_ScenarioMIP_IAMC-IMAGE-ssp126'
  625. case("SSP2-4.5")
  626. source_str='input4MIPs_emissions_ScenarioMIP_IAMC-MESSAGE-GLOBIOM-ssp245'
  627. case("SSP5-8.5")
  628. source_str='input4MIPs_emissions_ScenarioMIP_IAMC-REMIND-MAGPIE-ssp585'
  629. case default
  630. write (gol,'("Emissions not implemented for scenario: ", a)') trim(ssp_name); call goErr
  631. status=1; TRACEBACK; return
  632. end select
  633. endif
  634. ! construct emissions filename
  635. if ( trim(sectors_def(sector)%catname) == 'anthropogenic' .or. &
  636. trim(sectors_def(sector)%catname) == 'ships' ) then
  637. if ( index(comp,'VOC') == 1 ) then
  638. ! individual VOC species
  639. sec_str='em-speciated-VOC-anthro'
  640. sec_str2='em_speciated_VOC_anthro'
  641. version_str=trim(version_str)//'-supplemental-data'
  642. else
  643. sec_str='em-anthro'
  644. sec_str2='em_anthro'
  645. endif
  646. varname=trim(comp)//'_'//trim(sec_str2)
  647. ! change dash to underscore in few cases
  648. if ( index(varname, 'VOC') == 1 ) varname(6:6)= '_'
  649. if ( index(varname, 'hexanes-pl') == 7 ) varname(7:16) = 'hexanes_pl'
  650. if ( index(varname, 'other-') == 7 ) varname(7:12) = 'other_'
  651. else if ( trim(sectors_def(sector)%catname) == 'aircraft' ) then
  652. sec_str='em-AIR-anthro'
  653. sec_str2='em_AIR_anthro'
  654. varname=trim(comp)//'_'//trim(sec_str2)
  655. else
  656. write (gol,'("Invalid CMIP6 sector")') ; call goErr
  657. status=1; TRACEBACK; return
  658. endif
  659. varfilename=trim(comp)//'-'//trim(sec_str)
  660. ! For NO, the species name in the file name has to be set to NOx
  661. fname = trim(emis_input_dir_cmip6) //'/'// &
  662. trim(varfilename) //'_'// &
  663. trim(source_str) //'-'// &
  664. trim(version_str) //'_'// &
  665. 'gn' //'_'// &
  666. trim(time_str) // &
  667. '.nc'
  668. ! test existence of file
  669. inquire( file=trim(fname), exist=existfile)
  670. if( .not. existfile ) then
  671. write (gol,'(" CMIP6 file `",a,"` not found ")') trim(fname); call goErr
  672. status = 1; TRACEBACK; return
  673. end if
  674. ! ------------------------------------------------
  675. ! data record is read by emission_cmip6_Read2/3DRecord
  676. secname = sectors_def(sector)%name
  677. ! distinguish 2d/3d sectors
  678. if( sectors_def(sector)%f3d ) then
  679. d3data(:,:,:) = emission_cmip6_Read3DRecord( fname, varname, secname, imonth, year, startyear, status )
  680. else
  681. d3data(:,:,1) = emission_cmip6_Read2DRecord( fname, varname, secname, imonth, year, startyear, status )
  682. endif
  683. endif
  684. IF_NOTOK_RETURN(status=1)
  685. end subroutine emission_cmip6_ReadSector
  686. !EOC
  687. !--------------------------------------------------------------------------
  688. ! TM5 !
  689. !--------------------------------------------------------------------------
  690. !BOP
  691. !
  692. ! !FUNCTION: EMISSION_CMIP6_READ2DRECORD
  693. !
  694. ! !DESCRIPTION: Read a single 2d record of a given file and
  695. ! return a 2d emission field interpolated on 1x1 grid.
  696. !\\
  697. !\\
  698. ! !INTERFACE:
  699. !
  700. function emission_cmip6_Read2DRecord( fname, varname, secname, imonth, year, startyear, status )
  701. !
  702. ! !RETURN VALUE:
  703. !
  704. real :: emission_cmip6_Read2DRecord(nlon360,nlat180)
  705. !
  706. ! !INPUT PARAMETERS:
  707. !
  708. character(len=*), intent(in) :: fname, varname
  709. character(len=sector_name_len), intent(in) :: secname
  710. integer, intent(in) :: imonth, year, startyear
  711. !
  712. ! !OUTPUT PARAMETERS:
  713. !
  714. integer, intent(out) :: status
  715. !
  716. !EOP
  717. !------------------------------------------------------------------------
  718. !BOC
  719. character(len=*), parameter :: rname = mname//'/emission_cmip6_Read2DRecord'
  720. character(len=256) :: fname2
  721. integer :: fid, varid, isec
  722. integer :: fid2, varid2, year_first, year_second
  723. !real :: emis_in(nlon720, nlat360, 1)
  724. real :: emis_in(nlon720, nlat360, 1, 1)
  725. real, allocatable :: emis_help(:,:,:,:)
  726. real :: x
  727. ! --- begin -----------------------------------
  728. emission_cmip6_Read2DRecord = 0.0
  729. select case( trim(secname) )
  730. case ('AGR')
  731. isec=0
  732. case ('ENE')
  733. isec=1
  734. case ('IND')
  735. isec=2
  736. case ('TRA')
  737. isec=3
  738. case ('RCO')
  739. isec=4
  740. case ('SLV')
  741. isec=5
  742. case ('WST')
  743. isec=6
  744. case ('SHP')
  745. isec=7
  746. ! Negative emissions are only present in scenario files (year>2014) so make sure we don't read them when reading the historical forcings
  747. case ('NEG')
  748. isec=8
  749. if ( year < 2015 ) then
  750. if( okdebug ) then
  751. write (gol,'("EMISS - CMIP6 - no `",a,"` emissions to read in file ",a)') &
  752. secname, trim(fname) ; call goErr
  753. endif
  754. status = 0
  755. return
  756. endif
  757. case default
  758. write (gol,'("EMISS - CMIP6 - no `",a,"` emissions in file ",a)') &
  759. secname, trim(fname) ; call goErr
  760. status=1; TRACEBACK; return
  761. end select
  762. ! initialise
  763. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  764. IF_NOTOK_RETURN(status=1)
  765. CALL MDF_Inq_VarID( fid, TRIM(varname), varid, status )
  766. IF_ERROR_RETURN(status=1)
  767. if ( varid < 0 ) then
  768. write (gol,'("EMISS - CMIP6 - no `",a,"` emissions in file ",a)') &
  769. varname, trim(fname) ; call goErr
  770. status=1; TRACEBACK; return
  771. else
  772. if( okdebug ) then
  773. write (gol,'("EMISS-INFO - CMIP6 - found `",a,"` emissions in file ",a)') &
  774. trim(varname), trim(fname) ; call goPr
  775. endif
  776. ! SSP scenario emissions are provided for 2015, 2020, 2030, ... 2100
  777. if (year >= 2015 .and. year < 2020) then
  778. ! First year of the period
  779. year_first = 2015
  780. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,isec+1,imonth/) )
  781. IF_NOTOK_RETURN(status=1)
  782. if (year /= year_first) then
  783. ! Also read data for 2020
  784. ! and apply a linear interpolation between the two years
  785. allocate(emis_help(nlon720, nlat360, 1, 1))
  786. year_second = 2020
  787. ! Read data for 2020 by raising the index by 12
  788. CALL MDF_Get_Var( fid, varid, emis_help, status, start=(/1,1,isec+1,imonth+12/) )
  789. ! Interpolate montly data between the two provided years
  790. x = float(year-year_first)/5.
  791. emis_in(:,:,1,1) = (1.-x) * emis_in(:,:,1,1) + x * emis_help(:,:,1,1)
  792. deallocate(emis_help)
  793. endif
  794. else if (year >= 2020) then
  795. ! First year of the decade:
  796. year_first = int(year/10) * 10
  797. ! Change to reference year to 2020 by raising the index by 12
  798. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,isec+1,imonth+12+12*(year_first-2020)/10/) )
  799. IF_NOTOK_RETURN(status=1)
  800. if (year /= year_first) then
  801. ! Also read data for the first year of the next decade
  802. ! and apply a linear interpolation between the two years
  803. allocate(emis_help(nlon720, nlat360, 1, 1))
  804. year_second = year_first + 10
  805. CALL MDF_Get_Var( fid, varid, emis_help, status, start=(/1,1,isec+1,imonth+12+12*(year_second-2020)/10/) )
  806. ! Interpolate monthly data between the two provided years
  807. x = float(year-year_first)/10.
  808. emis_in(:,:,1,1) = (1.-x) * emis_in(:,:,1,1) + x * emis_help(:,:,1,1)
  809. deallocate(emis_help)
  810. endif
  811. else
  812. ! read yearly emissions directly from file
  813. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,isec+1,imonth+12*(year-startyear)/) )
  814. IF_NOTOK_RETURN(status=1)
  815. endif
  816. ! convert from kg(species)/m^2/s to kg(species)/gridbox/s
  817. emis_in(:,:,1,1) = emis_in(:,:,1,1) * gridbox_area_05
  818. ! now coarsen to nlon360,nlat180
  819. emission_cmip6_Read2DRecord = emission_coarsen_to_1x1( emis_in(:,:,1,1), nlon720, nlat360,.false., status )
  820. IF_NOTOK_RETURN(status=1)
  821. end if
  822. CALL MDF_Close( fid, status )
  823. IF_NOTOK_RETURN(status=1)
  824. status = 0
  825. return
  826. end function emission_cmip6_Read2DRecord
  827. !EOC
  828. !--------------------------------------------------------------------------
  829. ! TM5 !
  830. !--------------------------------------------------------------------------
  831. !BOP
  832. !
  833. ! !FUNCTION: EMISSION_CMIP6_READ3DRECORD
  834. !
  835. ! !DESCRIPTION: read one 3D sector
  836. !
  837. !\\
  838. !\\
  839. ! !INTERFACE:
  840. !
  841. function emission_cmip6_Read3DRecord( fname, varname, secname, imonth, year, startyear, status )
  842. !
  843. ! !RETURN VALUE:
  844. !
  845. real :: emission_cmip6_Read3DRecord(nlon360,nlat180,ar5_dim_3ddata)
  846. !
  847. ! !INPUT/OUTPUT PARAMETERS:
  848. !
  849. character(len=*), intent(in) :: fname, varname
  850. character(32), intent(in) :: secname
  851. !
  852. ! !INPUT PARAMETERS:
  853. !
  854. integer, intent(in) :: imonth, year, startyear
  855. !
  856. ! !OUTPUT PARAMETERS:
  857. !
  858. integer, intent(out) :: status
  859. !
  860. ! !REVISION HISTORY:
  861. ! 1 Oct 2010 - Achim Strunk -
  862. !
  863. ! !REMARKS:
  864. !
  865. !EOP
  866. !------------------------------------------------------------------------
  867. !BOC
  868. character(len=*), parameter :: rname = mname//'/emission_cmip6_Read3DRecord'
  869. integer :: fid, varid, lk
  870. real, dimension(nlon720,nlat360,ar5_dim_3ddata,1) :: emis_in
  871. integer :: fid2, varid2, year_first, year_second
  872. real, allocatable :: emis_help(:,:,:,:)
  873. real :: x
  874. real, parameter :: layer_depth = 610. ! fixed height (m) of the vertical levels
  875. ! on which the CMIP6 aircraft emissions
  876. ! are provided.
  877. ! --- begin -----------------------------------
  878. ! initialise
  879. emission_cmip6_Read3DRecord = 0.0
  880. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  881. IF_NOTOK_RETURN(status=1)
  882. CALL MDF_Inq_VarID( fid, TRIM(varname), varid, status )
  883. IF_ERROR_RETURN(status=1)
  884. if ( varid < 0 ) then
  885. write (gol,'("EMISS - CMIP6 - no `",a,"` emissions in file ",a)') &
  886. secname, trim(fname) ; call goErr
  887. status=1; TRACEBACK; return
  888. else
  889. if( okdebug ) then
  890. write (gol,'("EMISS-INFO - CMIP6 - found `",a,"` emissions in file ",a)') &
  891. secname, trim(fname) ; call goPr
  892. endif
  893. ! SSP scenario emissions are provided for 2015, 2020, 2030, ... 2100
  894. if (year >= 2015 .and. year < 2020) then
  895. ! First year of the period
  896. year_first = 2015
  897. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,1,imonth/) )
  898. IF_NOTOK_RETURN(status=1)
  899. if (year /= year_first) then
  900. ! Also read data for 2020
  901. ! and apply a linear interpolation between the two years
  902. allocate(emis_help(nlon720, nlat360, ar5_dim_3ddata, 1))
  903. year_second = 2020
  904. ! Read data for 2020 by raising the index by 12
  905. CALL MDF_Get_Var( fid, varid, emis_help, status, start=(/1,1,1,imonth+12/) )
  906. ! Interpolate montly data between the two provided years
  907. x = float(year-year_first)/5.
  908. emis_in(:,:,:,1) = (1.-x) * emis_in(:,:,:,1) + x * emis_help(:,:,:,1)
  909. deallocate(emis_help)
  910. endif
  911. else if (year >= 2020) then
  912. ! First year of the decade:
  913. year_first = int(year/10) * 10
  914. ! Change to reference year to 2020 by raising the index by 12
  915. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,1,imonth+12+12*(year_first-2020)/10/) )
  916. IF_NOTOK_RETURN(status=1)
  917. if (year /= year_first) then
  918. ! Also read data for the first year of the next decade
  919. ! and apply a linear interpolation between the two years
  920. allocate(emis_help(nlon720, nlat360, ar5_dim_3ddata, 1))
  921. year_second = year_first + 10
  922. CALL MDF_Get_Var( fid, varid, emis_help, status, start=(/1,1,1,imonth+12+12*(year_second-2020)/10/) )
  923. ! Interpolate monthly data between the two provided years
  924. x = float(year-year_first)/10.
  925. emis_in(:,:,:,1) = (1.-x) * emis_in(:,:,:,1) + x * emis_help(:,:,:,1)
  926. deallocate(emis_help)
  927. endif
  928. else
  929. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,1,imonth+12*(year-startyear)/) )
  930. IF_NOTOK_RETURN(status=1)
  931. endif
  932. do lk = 1, ar5_dim_3ddata
  933. ! convert from kg(species)/m^2/s to kg(species)/m/s;
  934. ! Note that CMIP6 aircraft emissions are given in kg(species)/m^2/s,
  935. ! while AR5 aircraft emissions are given in kg(species)/m^3/s.
  936. ! In order to be able to use the same vertical regridding routine lateron,
  937. ! we convert to the same unit and include a division by the layer depth.
  938. emis_in(:,:,lk,1) = emis_in(:,:,lk,1) * gridbox_area_05 / layer_depth
  939. ! now coarsen to nlon360,nlat180
  940. emission_cmip6_Read3DRecord(:,:,lk) = emission_coarsen_to_1x1( emis_in(:,:,lk,1) ,&
  941. & nlon720, nlat360, .false., status )
  942. IF_NOTOK_RETURN(status=1)
  943. end do
  944. end if
  945. CALL MDF_Close( fid, status )
  946. IF_NOTOK_RETURN(status=1)
  947. status = 0
  948. return
  949. end function emission_cmip6_Read3DRecord
  950. !EOC
  951. !--------------------------------------------------------------------------
  952. ! TM5 !
  953. !--------------------------------------------------------------------------
  954. !BOP
  955. !
  956. ! !IROUTINE: EMISSION_AR5_READCO2
  957. !
  958. ! !DESCRIPTION: Reading one sector of the files to be interpolated and
  959. ! returning an interpolated 3d emission field (d3data)
  960. !\\
  961. !\\
  962. ! !INTERFACE:
  963. !
  964. subroutine emission_ar5_ReadCO2( comp, iyear, imonth, sector, d3data, status )
  965. !
  966. ! !INPUT PARAMETERS:
  967. !
  968. character(len=*) , intent(in) :: comp
  969. integer , intent(in) :: iyear
  970. integer , intent(in) :: imonth
  971. integer , intent(in) :: sector
  972. !
  973. ! !OUTPUT PARAMETERS:
  974. !
  975. integer , intent(out) :: status
  976. real, dimension(nlon360,nlat180,ar5_dim_3ddata), intent(out) :: d3data
  977. !
  978. ! !REVISION HISTORY:
  979. ! 1 Oct 2010 - Achim Strunk - v0
  980. !
  981. !EOP
  982. !------------------------------------------------------------------------
  983. !BOC
  984. character(len=*), parameter :: rname = mname//'/emission_ar5_readCO2'
  985. character(len=256) :: fname
  986. character(len=256) :: fname_gridboxarea
  987. character(32) :: secname
  988. integer :: lt, year
  989. logical :: existfile
  990. integer, dimension(2) :: ltimes
  991. character(len=4), dimension(2) :: ar5_cyears
  992. real, dimension(2) :: ar5_ipcoef_years
  993. logical :: first=.true.
  994. real :: co2_rcp_target, co2_scale
  995. ! --- begin -----------------------------------
  996. ! initialise target array
  997. d3data = 0.0
  998. ! read in gridbox-area; once per CPU
  999. ! For CO2 the area field is read from the CO2 LU file
  1000. !if( .not. area_found_05 ) then
  1001. ! fname_gridboxarea = trim(emis_input_dir_ar5)//'/'//trim(ar5_filestr_gridboxarea)
  1002. ! call emission_ReadGridboxArea(fname_gridboxarea, 'gridbox_area', gridbox_area_05, &
  1003. ! & nlon720, nlat360, status )
  1004. ! IF_NOTOK_RETURN(status=1)
  1005. ! area_found_05=.true.
  1006. !endif
  1007. ! deal with out-of-bounds requested years
  1008. year = valid_year( iyear, ar5_avail, 'AR5', first)
  1009. first=.false.
  1010. secname = sectors_def(sector)%name
  1011. if ( iyear > year ) then
  1012. ! ------------------------
  1013. ! data for the year ar5_avail(2)=2005 will be read from file
  1014. ! and need to be scaled (index=1: earlier year; index=2: later year)
  1015. ! ------------------------
  1016. ! ----------------------------------------
  1017. ! get the right times to interpolate and related coefficients
  1018. ! (ar5_avail_yrs(ltimes))
  1019. !
  1020. ! --> resulting scale factor will be a linear interpolation between neighbouring values
  1021. !
  1022. ! ----------------------------------------
  1023. allocate( ltimeind( ar5_nr_avail_yrs ) )
  1024. ltimeind = .false.
  1025. where( ar5_avail_yrs < iyear ) ltimeind = .true.
  1026. ! times(1): index representing time instance earlier than current year
  1027. ! times(2): -"- -"- later than current year
  1028. ltimes(2) = count( ltimeind ) + 1
  1029. ltimes(1) = ltimes(2) - 1
  1030. ! check a match with available years
  1031. ! (in order to use only value instead of two)
  1032. if( ar5_avail_yrs(ltimes(2)) == iyear ) &
  1033. ltimes(1) = ltimes(2)
  1034. deallocate( ltimeind )
  1035. ! ar5_cyears will contain strings with the years
  1036. write(ar5_cyears(1),'(I4.4)') ar5_avail_yrs(ltimes(1))
  1037. write(ar5_cyears(2),'(I4.4)') ar5_avail_yrs(ltimes(2))
  1038. ! ar5_ipcoef_years will contain interpolation coefficients
  1039. ! default: factors 1.0/0.0
  1040. ar5_ipcoef_years(1) = 1.0
  1041. ar5_ipcoef_years(2) = 0.0
  1042. if( ltimes(2) /= ltimes(1) ) then
  1043. ar5_ipcoef_years(1) = (ar5_avail_yrs(ltimes(2)) - iyear) / &
  1044. real( ar5_avail_yrs(ltimes(2)) - ar5_avail_yrs(ltimes(1)) )
  1045. ar5_ipcoef_years(2) = 1.0 - ar5_ipcoef_years(1)
  1046. end if
  1047. select case (trim (secname) )
  1048. case ( 'emiss_ff' )
  1049. co2_ref=co2_ff_ref
  1050. select case (trim(filestr_rcpiden) )
  1051. case ('RCP26')
  1052. co2_rcp(:)=co2ff_rcp26(:)
  1053. case ('RCP45')
  1054. co2_rcp(:)=co2ff_rcp45(:)
  1055. case ('RCP60')
  1056. co2_rcp(:)=co2ff_rcp60(:)
  1057. case ('RCP85')
  1058. co2_rcp(:)=co2ff_rcp85(:)
  1059. case default
  1060. write(gol, '("ERROR: no RCP scenario specified for CO2 emissions")') ; call goErr
  1061. end select
  1062. case ( 'emiss_lu')
  1063. co2_ref=co2_lu_ref
  1064. select case (trim(filestr_rcpiden) )
  1065. case ('RCP26')
  1066. co2_rcp(:)=co2lu_rcp26(:)
  1067. case ('RCP45')
  1068. co2_rcp(:)=co2lu_rcp45(:)
  1069. case ('RCP60')
  1070. co2_rcp(:)=co2lu_rcp60(:)
  1071. case ('RCP85')
  1072. co2_rcp(:)=co2lu_rcp85(:)
  1073. end select
  1074. end select
  1075. co2_rcp_target=co2_rcp(ltimes(1))*ar5_ipcoef_years(1)+co2_rcp(ltimes(2))*ar5_ipcoef_years(2)
  1076. co2_scale=co2_rcp_target/co2_ref
  1077. else
  1078. ! no scaling for years <= 2005
  1079. co2_scale=1.
  1080. endif
  1081. ! ------------------------
  1082. ! read CO2 emission file
  1083. ! ------------------------
  1084. select case ( trim (secname) )
  1085. case ( 'emiss_ff' )
  1086. fname = trim(emis_input_dir_ar5) //'/'// &
  1087. 'CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC_mask11.nc'
  1088. case ( 'emiss_lu' )
  1089. fname = trim(emis_input_dir_ar5) //'/'// &
  1090. 'carbon_emissions_landuse_20person.nc'
  1091. case default
  1092. write(gol, '("ERROR: emission sector ",a,"not available for CO2")') &
  1093. trim(secname); call goErr
  1094. status=1; return
  1095. end select
  1096. ! test existence of file
  1097. inquire( file=trim(fname), exist=existfile)
  1098. if( .not. existfile ) then
  1099. write (gol,'("ERROR: file `",a,"` not found ")') trim(fname); call goErr
  1100. status=1; return
  1101. end if
  1102. select case ( trim (secname) )
  1103. case ( 'emiss_ff' )
  1104. d3data(:,:,1) = d3data(:,:,1) + co2_scale * &
  1105. emission_ar5_ReadCO2FF( fname, year, imonth, status )
  1106. case ( 'emiss_lu' )
  1107. d3data(:,:,1) = d3data(:,:,1) + co2_scale * &
  1108. emission_ar5_ReadCO2LU( fname, year, status )
  1109. case default
  1110. write(gol, '("ERROR: emission sector ",a,"not available for CO2")') &
  1111. trim(secname); call goErr
  1112. status=1; return
  1113. end select
  1114. IF_NOTOK_RETURN(status=1)
  1115. end subroutine emission_ar5_ReadCO2
  1116. !EOC
  1117. !--------------------------------------------------------------------------
  1118. ! TM5 !
  1119. !--------------------------------------------------------------------------
  1120. !BOP
  1121. !
  1122. ! !FUNCTION: EMISSION_AR5_READCO2FF
  1123. !
  1124. ! !DESCRIPTION: Read monthly AR5 fossil-fuel CO2 emissions on a 1x1 grid
  1125. !\\
  1126. !\\
  1127. ! !INTERFACE:
  1128. !
  1129. function emission_ar5_ReadCO2FF( fname, year, imonth, status )
  1130. !
  1131. ! !RETURN VALUE:
  1132. !
  1133. real :: emission_ar5_ReadCO2FF(360,180)
  1134. !
  1135. ! !INPUT PARAMETERS:
  1136. !
  1137. character(len=*), intent(in) :: fname
  1138. integer, intent(in) :: year, imonth
  1139. !
  1140. ! !OUTPUT PARAMETERS:
  1141. !
  1142. integer, intent(out) :: status
  1143. !
  1144. ! !REVISION HISTORY:
  1145. ! 20 May 2014 - T. van Noije
  1146. !
  1147. !EOP
  1148. !------------------------------------------------------------------------
  1149. !BOC
  1150. character(len=*), parameter :: rname = mname//'/emission_ar5_ReadCO2FF'
  1151. integer :: fid, varid
  1152. real :: emis_in(360, 180), area(360,180)
  1153. ! --- begin -----------------------------------
  1154. ! initialise
  1155. emission_ar5_ReadCO2FF = 0.0
  1156. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  1157. IF_NOTOK_RETURN(status=1)
  1158. CALL MDF_Inq_VarID( fid, 'FF', varid, status )
  1159. IF_ERROR_RETURN(status=1)
  1160. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,12*(year-1751)+imonth/) )
  1161. IF_NOTOK_RETURN(status=1)
  1162. CALL MDF_Inq_VarID( fid, 'AREA', varid, status )
  1163. IF_ERROR_RETURN(status=1)
  1164. CALL MDF_Get_Var( fid, varid, area, status, start=(/1,1/) )
  1165. IF_NOTOK_RETURN(status=1)
  1166. ! to speed up reading of area could be done only once
  1167. ! convert from g(C)/m^2/s to kg(CO2)/gridbox/s
  1168. emission_ar5_ReadCO2FF(:,:) = emis_in(:,:) * area(:,:) * 1.e-3 * xmco2/xmc
  1169. IF_NOTOK_RETURN(status=1)
  1170. CALL MDF_Close( fid, status )
  1171. IF_NOTOK_RETURN(status=1)
  1172. status = 0
  1173. return
  1174. end function emission_ar5_ReadCO2FF
  1175. !EOC
  1176. !--------------------------------------------------------------------------
  1177. ! TM5 !
  1178. !--------------------------------------------------------------------------
  1179. !BOP
  1180. !
  1181. ! !FUNCTION: EMISSION_AR5_READCO2LU
  1182. !
  1183. ! !DESCRIPTION: Read yearly AR5 land-use CO2 emissions on a 0.5x0.5 grid
  1184. ! and convert to a 1x1 grid
  1185. !\\
  1186. !\\
  1187. ! !INTERFACE:
  1188. !
  1189. function emission_ar5_ReadCO2LU( fname, year, status )
  1190. !
  1191. ! !RETURN VALUE:
  1192. !
  1193. real :: emission_ar5_ReadCO2LU(nlon360,nlat180)
  1194. !
  1195. ! !INPUT PARAMETERS:
  1196. !
  1197. character(len=*), intent(in) :: fname
  1198. integer, intent(in) :: year
  1199. !
  1200. ! !OUTPUT PARAMETERS:
  1201. !
  1202. integer, intent(out) :: status
  1203. !
  1204. ! !REVISION HISTORY:
  1205. ! 20 May 2014 - T. van Noije
  1206. !
  1207. !EOP
  1208. !------------------------------------------------------------------------
  1209. !BOC
  1210. character(len=*), parameter :: rname = mname//'/emission_ar5_ReadCO2LU'
  1211. integer :: fid, varid
  1212. real :: emis_in(nlon720, nlat360), area(nlon720, nlat360)
  1213. ! --- begin -----------------------------------
  1214. ! initialise
  1215. emission_ar5_ReadCO2LU = 0.0
  1216. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  1217. IF_NOTOK_RETURN(status=1)
  1218. CALL MDF_Inq_VarID( fid, 'carbon_emission', varid, status )
  1219. IF_ERROR_RETURN(status=1)
  1220. CALL MDF_Get_Var( fid, varid, emis_in, status, start=(/1,1,year-1850+1/) )
  1221. IF_NOTOK_RETURN(status=1)
  1222. CALL MDF_Inq_VarID( fid, 'area', varid, status )
  1223. IF_ERROR_RETURN(status=1)
  1224. CALL MDF_Get_Var( fid, varid, area, status, start=(/1,1/) )
  1225. IF_NOTOK_RETURN(status=1)
  1226. ! to speed up reading of area could be done only once
  1227. ! convert from g(C)/m^2/s to kg(CO2)/gridbox/s
  1228. !emis_in(:,:) = emis_in(:,:) * gridbox_area_05(:,:) * 1.e-3 * xmco2/xmc
  1229. emis_in(:,:) = emis_in(:,:) * area(:,:) * 1.e-3 * xmco2/xmc
  1230. ! now coarsen to nlon360,nlat180
  1231. emission_ar5_ReadCO2LU = emission_coarsen_to_1x1( emis_in(:,:), nlon720, nlat360,.true., status )
  1232. IF_NOTOK_RETURN(status=1)
  1233. CALL MDF_Close( fid, status )
  1234. IF_NOTOK_RETURN(status=1)
  1235. status = 0
  1236. return
  1237. end function emission_ar5_ReadCO2LU
  1238. !EOC
  1239. !--------------------------------------------------------------------------
  1240. ! TM5 !
  1241. !--------------------------------------------------------------------------
  1242. !BOP
  1243. !
  1244. ! !IROUTINE: EMISSION_READGRIDBOXAREA
  1245. !
  1246. ! !DESCRIPTION:
  1247. ! reading gridbox surface areas for 0.5 x 0.5 Edgar 4
  1248. ! needed to scale the emissions from mass/m^2 to mass/grid
  1249. !\\
  1250. !\\
  1251. ! !INTERFACE:
  1252. !
  1253. subroutine emission_ReadGridboxArea(fname, recname, gridbox_area, dim_nlon, dim_nlat, status )
  1254. !
  1255. ! !INPUT PARAMETERS:
  1256. !
  1257. character(len=*), intent(in) :: fname
  1258. character(len=*), intent(in) :: recname
  1259. integer, intent(in) :: dim_nlon
  1260. integer, intent(in) :: dim_nlat
  1261. !
  1262. ! !OUTPUT PARAMETERS:
  1263. !
  1264. integer, intent(out) :: status
  1265. real, dimension(dim_nlon, dim_nlat), intent(out) :: gridbox_area
  1266. !
  1267. ! !REVISION HISTORY:
  1268. !
  1269. ! 1 Oct 2010 - Achim Strunk - v0
  1270. ! 1 Dec 2011 - Narcisa Banda - generalized it for any gridbox area size
  1271. !
  1272. ! !REMARKS:
  1273. !
  1274. !EOP
  1275. !------------------------------------------------------------------------
  1276. !BOC
  1277. character(len=*), parameter :: rname = mname//'/emission_ReadGridboxArea'
  1278. integer :: fid, varid
  1279. ! --- begin -----------------------------------
  1280. CALL MDF_Open( TRIM(fname), MDF_NETCDF, MDF_READ, fid, status )
  1281. IF_NOTOK_RETURN(status=1)
  1282. CALL MDF_Inq_VarID( fid, TRIM(recname), varid, status )
  1283. IF_ERROR_RETURN(status=1)
  1284. CALL MDF_Get_Var( fid, varid, gridbox_area, status )
  1285. IF_NOTOK_RETURN(status=1)
  1286. CALL MDF_Close( fid, status )
  1287. IF_NOTOK_RETURN(status=1)
  1288. status = 0
  1289. end subroutine emission_ReadGridboxArea
  1290. !EOC
  1291. !--------------------------------------------------------------------------
  1292. ! TM5 !
  1293. !--------------------------------------------------------------------------
  1294. !BOP
  1295. !
  1296. ! !IROUTINE: EMISSION_AR5_REGRID_AIRCRAFT
  1297. !
  1298. ! !DESCRIPTION: Vertical regridding of the AR5 aircraft data.
  1299. ! The vertical levels of the input data are hard coded.
  1300. ! (Taken from GFED_daily_AR5 (VH) and left as is)
  1301. !\\
  1302. !\\
  1303. ! !INTERFACE:
  1304. !
  1305. subroutine emission_ar5_regrid_aircraft(region, i0, j0, field_in, field_out, status )
  1306. !
  1307. ! !USES:
  1308. !
  1309. use meteodata, only : gph_dat
  1310. use tm5_distgrid, only : dgrid, get_distgrid
  1311. use dims, only : lm
  1312. !
  1313. ! !OUTPUT PARAMETERS:
  1314. !
  1315. integer, intent(out) :: status
  1316. !
  1317. ! !INPUT PARAMETERS:
  1318. !
  1319. integer, intent(in) :: region, i0, j0
  1320. real, dimension(i0:, j0:, 1:), intent(in) :: field_in
  1321. real, dimension(i0:, j0:, 1:), intent(out) :: field_out
  1322. !
  1323. ! !REVISION HISTORY:
  1324. ! 1 Oct 2010 - Achim Strunk - Taken from GFED_daily_AR5 (VH) and left as is
  1325. ! 3 Dec 2012 - Ph. Le Sager - modified for lat-lon mpi decomposition
  1326. ! - work with zoom regions
  1327. ! - mass conservation per column
  1328. !
  1329. ! !REMARKS:
  1330. !
  1331. !EOP
  1332. !------------------------------------------------------------------------
  1333. !BOC
  1334. character(len=*), parameter :: rname = mname//'/emission_ar5_regrid_aircraft'
  1335. integer, parameter :: lm_in=25
  1336. real, dimension(:,:,:), pointer :: gph ! geopotential height (m)
  1337. integer :: i,j,l
  1338. real, dimension(lm_in) :: height_in_min, height_in_max
  1339. real, allocatable :: dz(:), height(:)
  1340. real :: height_min,height_max
  1341. real :: height_out_min,height_out_max
  1342. real, dimension(lm_in), parameter :: height_in=(/ & ! Height in meter
  1343. 305., 915., 1525., 2135., 2745., 3355., 3965., 4575., 5185., 5795., &
  1344. 6405., 7015., 7625., 8235., 8845., 9455.,10065.,10675.,11285., &
  1345. 11895.,12505.,13115.,13725.,14335.,14945./)
  1346. real :: dz_in(25)
  1347. integer :: l_in, i1, i2, j1, j2, lmr
  1348. real :: total_in, total_out, total_ratio
  1349. ! --- begin --------------------------------------
  1350. call golabel()
  1351. gph => gph_dat(region)%data
  1352. CALL GET_DISTGRID( dgrid(region), I_STRT=i1, I_STOP=i2, J_STRT=j1, J_STOP=j2 )
  1353. lmr = lm(region)
  1354. allocate(dz(lmr), height(lmr+1))
  1355. ! sanity check
  1356. if (okdebug) then
  1357. if (i1/=i0 .or. j1/=j0) then
  1358. status = 1 ; TRACEBACK
  1359. return
  1360. end if
  1361. if (lm_in /= ubound(field_in,3) ) then
  1362. write(gol,*)'wrong vertical input resolution'; call goErr
  1363. status = 1
  1364. TRACEBACK; return
  1365. endif
  1366. if ((ubound(field_out,3)+1) /= ubound(gph,3)) then
  1367. write(gol,*)'wrong vertical output resolution'; call goErr
  1368. status = 1
  1369. TRACEBACK; return
  1370. endif
  1371. end if
  1372. ! locally flat atmosphere assumed
  1373. ! area linear in i,j
  1374. ! height above sea level
  1375. height_in_min(1)=0.
  1376. do l_in = 2,lm_in
  1377. height_in_min(l_in)=(height_in(l_in-1)+height_in(l_in))/2.
  1378. enddo
  1379. height_in_max(lm_in)=15555.
  1380. do l_in = 1,lm_in-1
  1381. height_in_max(l_in)=(height_in(l_in)+height_in(l_in+1))/2.
  1382. enddo
  1383. ! init
  1384. field_out = 0.0
  1385. ! regrid
  1386. do i=i1, i2
  1387. do j=j1, j2
  1388. total_in = 0.0
  1389. ! calculate total input emissions
  1390. do l_in=1, lm_in
  1391. dz_in(l_in) = height_in_max(l_in)-height_in_min(l_in)
  1392. total_in =total_in + field_in(i,j,l_in)*dz_in(l_in)
  1393. enddo
  1394. ! zero based height:
  1395. height(1) = 0.0
  1396. do l=1, lmr
  1397. dz(l) = gph(i,j,l+1) - gph(i,j,l)
  1398. height(l+1) = height(l) + dz(l)
  1399. enddo
  1400. do l=1,lmr-1
  1401. height_out_min=height(l)
  1402. height_out_max=height(l+1)
  1403. ! write(*,*)'DO AR5- regrid - C2',i,j,l,height_out_min,height_out_max
  1404. do l_in=1,lm_in
  1405. if (height_out_max .le. height_in_min(l_in)) exit
  1406. if (height_out_min .lt. height_in_max(l_in)) then
  1407. height_max=min(height_out_max,height_in_max(l_in))
  1408. height_min=max(height_out_min,height_in_min(l_in))
  1409. ! helpfield as field_in is ordered from high to low
  1410. ! field_out(i,j,l) = field_out(i,j,l) + helpfield2(i,j,lm_in-l_in+1)* &
  1411. ! (height_max-height_min)/(height_in_max(l_in)-height_in_min(l_in))
  1412. ! helpfield as field_in is ordered from low to high
  1413. ! write(*,*)'DO AR5- regrid - C',i,j,l,l_in,height_max-height_min
  1414. field_out(i,j,l) = field_out(i,j,l) + field_in(i,j,l_in)* &
  1415. (height_max-height_min) ! kg/m -> kg / gridbox
  1416. endif
  1417. enddo
  1418. enddo
  1419. ! conserve total exactly: not possible because units are in kg/m...
  1420. total_out = sum(field_out(i,j,:))
  1421. if (total_out /= 0) then
  1422. total_ratio = total_in/total_out
  1423. field_out(i,j,:) = field_out(i,j,:)*total_ratio
  1424. end if
  1425. enddo
  1426. enddo
  1427. deallocate(dz, height)
  1428. call golabel()
  1429. ! ok
  1430. status = 0
  1431. end subroutine emission_ar5_regrid_aircraft
  1432. !EOC
  1433. END MODULE EMISSION_READ